Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator is not able to push builder image to the internal registry (OpenShift cluster) #4297

Closed
bouskaJ opened this issue Apr 27, 2023 · 3 comments
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@bouskaJ
Copy link
Contributor

bouskaJ commented Apr 27, 2023

I have OpenShift cluster and I am testing Camel-K 2.0 nightly build. I would like to use OCP internal registry. I install Camel-K operator with the followngn command
kamel install --olm=false --maven-repository=https://repository.apache.org/content/repositories/snapshots@id=apache-snapshots@snapshots --operator-image docker.io/testcamelk/camel-k:2.0.0-nightly

Created IntegrationPlatform is

apiVersion: camel.apache.org/v1
kind: IntegrationPlatform
metadata:
  annotations:
    camel.apache.org/operator.id: camel-k
  creationTimestamp: "2023-04-27T15:59:58Z"
  generation: 1
  labels:
    app: camel-k
  name: camel-k
  namespace: test
  resourceVersion: "76135016"
  uid: 7ecf1ee9-bd47-4c3c-abaf-db66585801e9
spec:
  build:
    maven:
      settings:
        configMapKeyRef:
          key: settings.xml
          name: camel-k-maven-settings
      settingsSecurity: {}
    registry: {}
  kamelet: {}
  traits: {}
status:
  build:
    PublishStrategyOptions:
      KanikoPersistentVolumeClaim: camel-k
    baseImage: docker.io/eclipse-temurin:11
    buildCatalogToolTimeout: 1m0s
    buildStrategy: pod
    maven:
      cliOptions:
      - -V
      - --no-transfer-progress
      - -Dstyle.color=never
      localRepository: /etc/maven/m2
      settings:
        configMapKeyRef:
          key: settings.xml
          name: camel-k-maven-settings
    publishStrategy: S2I
    runtimeVersion: 3.20.1-SNAPSHOT
    timeout: 5m0s
  cluster: OpenShift
  conditions:
  - lastTransitionTime: "2023-04-27T16:00:01Z"
    lastUpdateTime: "2023-04-27T16:00:01Z"
    message: integration platform created
    reason: IntegrationPlatformCreated
    status: "True"
    type: Ready
  info:
    gitCommit: 1ff6dc40829ca1c200a11d2cb4a07ec376ae4b8d
    goOS: linux
    goVersion: go1.18.10
  kamelet:
    repositories:
    - uri: none
  observedGeneration: 1
  phase: Ready
  version: 2.0.0-nightly

but the operator is not able to push the builder image

- apiVersion: camel.apache.org/v1
  kind: IntegrationPlatform
  metadata:
    annotations:
      camel.apache.org/operator.id: camel-k
    creationTimestamp: "2023-04-27T15:59:58Z"
    generation: 1
    labels:
      app: camel-k
    name: camel-k
    namespace: test
    resourceVersion: "76135016"
    uid: 7ecf1ee9-bd47-4c3c-abaf-db66585801e9
  spec:
    build:
      maven:
        settings:
          configMapKeyRef:
            key: settings.xml
            name: camel-k-maven-settings
        settingsSecurity: {}
      registry: {}
    kamelet: {}
    traits: {}
  status:
    build:
      PublishStrategyOptions:
        KanikoPersistentVolumeClaim: camel-k
      baseImage: docker.io/eclipse-temurin:11
      buildCatalogToolTimeout: 1m0s
      buildStrategy: pod
      maven:
        cliOptions:
        - -V
        - --no-transfer-progress
        - -Dstyle.color=never
        localRepository: /etc/maven/m2
        settings:
          configMapKeyRef:
            key: settings.xml
            name: camel-k-maven-settings
      publishStrategy: S2I
      runtimeVersion: 3.20.1-SNAPSHOT
      timeout: 5m0s
    cluster: OpenShift
    conditions:
    - lastTransitionTime: "2023-04-27T16:00:01Z"
      lastUpdateTime: "2023-04-27T16:00:01Z"
      message: integration platform created
      reason: IntegrationPlatformCreated
      status: "True"
      type: Ready
    info:
      gitCommit: 1ff6dc40829ca1c200a11d2cb4a07ec376ae4b8d
      goOS: linux
      goVersion: go1.18.10
    kamelet:
      repositories:
      - uri: none
    observedGeneration: 1
    phase: Ready
    version: 2.0.0-nightly
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""
➜  camel-k git:(config_ids) ✗ oc get IntegrationPlatform camel-k -o yaml
apiVersion: camel.apache.org/v1
kind: IntegrationPlatform
metadata:
  annotations:
    camel.apache.org/operator.id: camel-k
  creationTimestamp: "2023-04-27T15:59:58Z"
  generation: 1
  labels:
    app: camel-k
  name: camel-k
  namespace: test
  resourceVersion: "76135016"
  uid: 7ecf1ee9-bd47-4c3c-abaf-db66585801e9
spec:
  build:
    maven:
      settings:
        configMapKeyRef:
          key: settings.xml
          name: camel-k-maven-settings
      settingsSecurity: {}
    registry: {}
  kamelet: {}
  traits: {}
status:
  build:
    PublishStrategyOptions:
      KanikoPersistentVolumeClaim: camel-k
    baseImage: docker.io/eclipse-temurin:11
    buildCatalogToolTimeout: 1m0s
    buildStrategy: pod
    maven:
      cliOptions:
      - -V
      - --no-transfer-progress
      - -Dstyle.color=never
      localRepository: /etc/maven/m2
      settings:
        configMapKeyRef:
          key: settings.xml
          name: camel-k-maven-settings
    publishStrategy: S2I
    runtimeVersion: 3.20.1-SNAPSHOT
    timeout: 5m0s
  cluster: OpenShift
  conditions:
  - lastTransitionTime: "2023-04-27T16:00:01Z"
    lastUpdateTime: "2023-04-27T16:00:01Z"
    message: integration platform created
    reason: IntegrationPlatformCreated
    status: "True"
    type: Ready
  info:
    gitCommit: 1ff6dc40829ca1c200a11d2cb4a07ec376ae4b8d
    goOS: linux
    goVersion: go1.18.10
  kamelet:
    repositories:
    - uri: none
  observedGeneration: 1
  phase: Ready
  version: 2.0.0-nightly
➜  camel-k git:(config_ids) ✗ oc get CamelCatalog -o yaml
apiVersion: v1
items:
- apiVersion: camel.apache.org/v1
  kind: CamelCatalog
  metadata:
    annotations:
      camel.apache.org/operator.id: camel-k
    creationTimestamp: "2023-04-27T16:00:01Z"
    generation: 1
    labels:
      app: camel-k
      camel.apache.org/catalog.loader.version: 3.20.1
      camel.apache.org/catalog.version: 3.20.1
      camel.apache.org/runtime.version: 3.20.1-SNAPSHOT
    name: camel-catalog-3.20.1-snapshot
    namespace: test
    resourceVersion: "76135454"
    uid: e74bbe32-44be-4020-92b2-7932b7721882
  spec:
    artifacts:
      camel-k-cron:
        artifactId: camel-k-cron
        groupId: org.apache.camel.k

      metadata:
        camel-quarkus.version: 2.16.0
        camel.version: 3.20.1
        quarkus.native-builder-image: quay.io/quarkus/ubi-quarkus-mandrel:22.2.0.0-Final-java11
        quarkus.version: 2.16.0.Final
      provider: quarkus
      version: 3.20.1-SNAPSHOT
  status:
    conditions:
    - lastTransitionTime: "2023-04-27T16:00:14Z"
      lastUpdateTime: "2023-04-27T16:00:14Z"
      message: |
        Head "https://index.docker.io/v2/camel-k-runtime-quarkus-builder/blobs/sha256:eab66ae1072584be15ec16ad61037111bc2770ba0c04a1443506c619d6663267": GET https://auth.docker.io/token?scope=repository%3A%2Fcamel-k-runtime-quarkus-builder%3Apush%2Cpull&scope=repository%3Acamel-k-runtime-quarkus-builder%3Apull&service=registry.docker.io: unexpected status code 400 Bad Request: {"details":"invalid repository name"}
      reason: Builder Image
      status: "False"
      type: Ready
    observedGeneration: 1
    phase: Error

I did a little digging and it seems that the Catalog initialize action is trying to get the registry from the IntegrationPlatform which is empty in my case. See https://github.com/apache/camel-k/blob/main/pkg/controller/catalog/initialize.go#L80-L85. It seems that the image name is resolved as /camel-k-runtime-quarkus-builder that is substituted as docker.io/camel-k-runtime-quarkus-builder

@squakez squakez added the kind/bug Something isn't working label Apr 27, 2023
@squakez squakez added this to the 2.0.0 milestone Apr 27, 2023
@squakez
Copy link
Contributor

squakez commented Apr 27, 2023

Thanks for reporting. Yes, we need to support S2I or any other Openshift way of building images, see https://github.com/apache/camel-k/blob/main/pkg/controller/catalog/initialize.go#L192

@gansheer
Copy link
Contributor

gansheer commented May 3, 2023

@squakez I would like to take care of adding the s2i (or any other openshift way) for the builder images generation.

gansheer added a commit to gansheer/camel-k that referenced this issue May 26, 2023
* Add initialize builder image on catalog with imagestream and buildconfig resource who's owner is the CamelCatalog
* Light refactoring of S2I code

Ref apache#4297
gansheer added a commit to gansheer/camel-k that referenced this issue May 26, 2023
* Add initialize builder image on catalog with imagestream and buildconfig resource who's owner is the CamelCatalog
* Light refactoring of S2I code

Ref apache#4297
gansheer added a commit to gansheer/camel-k that referenced this issue May 26, 2023
* Add initialize builder image on catalog with imagestream and buildconfig resource who's owner is the CamelCatalog
* Light refactoring of S2I code

Ref apache#4297
gansheer added a commit to gansheer/camel-k that referenced this issue May 26, 2023
squakez pushed a commit that referenced this issue May 29, 2023
* Add initialize builder image on catalog with imagestream and buildconfig resource who's owner is the CamelCatalog
* Light refactoring of S2I code

Ref #4297
@gansheer
Copy link
Contributor

gansheer commented Jun 5, 2023

I think we can close this issue @squakez . The others follow up issues created does not prevent the feature from working.

@squakez squakez closed this as completed Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants