Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-8488

fabric8:resource replaces an explicit ImageChange trigger, preventing deployments from existing image streams

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • FIS 2.0
    • FIS 2.0
    • FIS-Fabric8
    • None
    • Documentation (Ref Guide, User Guide, etc.), User Experience
    • % %
    • FIS 2.0 Sprint 6

      Trying to wrap an openshift deployment config as a fabric8 maven resource (e.g. to be used in tests with f8 arquillian),

      having a deployment definition src/main/fabric8/deployment.yml

      $ cat src/main/fabric8/deployment.yml 
      spec:
        replicas: 1
        selector:
          name: amq-pod
        strategy:
          recreateParams:
            timeoutSeconds: 600
          resources: {}
          type: Recreate
        template:
          metadata:
            creationTimestamp: null
            labels:
              name: amq-pod
            name: amq-pod
          spec:
            containers:
            - env:
              - name: AMQ_KEYSTORE_TRUSTSTORE_DIR
                value: /opt/amq/conf
              - name: AMQ_TRUSTSTORE_PASSWORD
                value: password
              - name: AMQ_KEYSTORE_PASSWORD
                value: password
              - name: AMQ_KEYSTORE
                value: broker.ks
              - name: AMQ_TRUSTSTORE
                value: broker.ts
              imagePullPolicy: Always
              image: foobar
              name: amq
              ports:
              - containerPort: 8778
                name: jolokia
                protocol: TCP
              readinessProbe:
                exec:
                  command:
                  - /bin/bash
                  - -c
                  - /opt/amq/bin/readinessProbe.sh
                failureThreshold: 3
                periodSeconds: 10
                successThreshold: 1
                timeoutSeconds: 1
              resources: {}
              terminationMessagePath: /dev/termination-log
            dnsPolicy: ClusterFirst
            restartPolicy: Always
            securityContext: {}
            terminationGracePeriodSeconds: 30
        test: false
        triggers:
        - type: ConfigChange
        - type: ImageChange
          imageChangeParams:
            automatic: true
            containerNames:
            - amq
            from:
              kind: ImageStreamTag
              namespace: openshift
              name: jboss-amq-6.2:1.3
      

      After running fabric8:resource...

      mvn clean fabric8:resource -Dfabric8.mode=openshift -Dfabric8.build.strategy=s2i
      

      The resulting openshift yaml contains

      $ cat target/classes/META-INF/fabric8/openshift/f8-arq-deploymentconfig.yml 
      ---
      apiVersion: "v1"
      kind: "DeploymentConfig"
      metadata:
        annotations:
          fabric8.io/git-commit: "d1f9c16036e5035a98b4a179f3353c4c6e5f6a57"
          fabric8.io/metrics-path: "dashboard/file/kubernetes-pods.json/?var-project=f8-arq&var-version=2.0.0-SNAPSHOT"
          fabric8.io/git-branch: "fis-2.0"
        labels:
          provider: "fabric8"
          project: "f8-arq"
          version: "2.0.0-SNAPSHOT"
          group: "com.redhat.xpaas"
        name: "f8-arq"
      spec:
        replicas: 1
        selector:
          project: "f8-arq"
          provider: "fabric8"
          group: "com.redhat.xpaas"
        strategy:
          rollingParams:
            timeoutSeconds: 10800
          type: "Rolling"
        template:
          metadata:
            annotations:
              fabric8.io/git-commit: "d1f9c16036e5035a98b4a179f3353c4c6e5f6a57"
              fabric8.io/metrics-path: "dashboard/file/kubernetes-pods.json/?var-project=f8-arq&var-version=2.0.0-SNAPSHOT"
              fabric8.io/git-branch: "fis-2.0"
            labels:
              name: "amq-pod"
              provider: "fabric8"
              project: "f8-arq"
              version: "2.0.0-SNAPSHOT"
              group: "com.redhat.xpaas"
            name: "amq-pod"
          spec:
            containers:
            - env:
              - name: "AMQ_KEYSTORE_TRUSTSTORE_DIR"
                value: "/opt/amq/conf"
              - name: "AMQ_TRUSTSTORE_PASSWORD"
                value: "password"
              - name: "AMQ_KEYSTORE_PASSWORD"
                value: "password"
              - name: "AMQ_KEYSTORE"
                value: "broker.ks"
              - name: "AMQ_TRUSTSTORE"
                value: "broker.ts"
              image: "foobar"
              imagePullPolicy: "Always"
              name: "amq"
              ports:
              - containerPort: 8778
                name: "jolokia"
                protocol: "TCP"
              readinessProbe:
                exec:
                  command:
                  - "/bin/bash"
                  - "-c"
                  - "/opt/amq/bin/readinessProbe.sh"
                failureThreshold: 3
                periodSeconds: 10
                successThreshold: 1
                timeoutSeconds: 1
              resources: {}
              terminationMessagePath: "/dev/termination-log"
            dnsPolicy: "ClusterFirst"
            restartPolicy: "Always"
            securityContext: {}
            terminationGracePeriodSeconds: 30
        triggers:
        - type: "ConfigChange"
        - imageChangeParams:
            automatic: true
            containerNames:
            - "amq"
            from:
              kind: "ImageStreamTag"
              name: "foobar:null"
          type: "ImageChange"
      

      Note that "image" in the OpenShift DeploymentConfig is meaningless. The image to be deployed is defined by the image change trigger.

              Unassigned Unassigned
              maschmid@redhat.com Marek Schmidt
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: