jack
jack

Reputation: 833

fabric8-maven-plugin generates livenessProbe and readinessProbe for initcontainers and deployment fails

I am using initContainers in the deployment.yml and uses fabric8-maven-plugin to deploy the applicaiton into openshift.

initContainers snippet from deployment.yml

spec:
  template:
    spec:
      volumes:
      - emptyDir: {}
        name: work-dir
      containers:
      - name: hello-world       
        resources:
          requests:
            cpu: "0.2"
#           memory: 256Mi
          limits:
            cpu: "1.0"
#           memory: 256Mi
        volumeMounts:
        - mountPath: /var/work-dir
          name: work-dir
      initContainers:
      - args:
        - -c        
        command:
        - /bin/bash    
        image: docker-registry.default.svc:5000/openshift/rhel-openssl-keytool
        imagePullPolicy: Always
        name: init-hello-world
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/work-dir
          name: work-dir

The openshift.yml generated by f-m-p adds the livenessProbe and readinessProbe to the initContainers which is invalid. generated DC:

initContainers:
        - args:
          - -c
          command:
          - /bin/bash
          image: docker-registry.default.svc:5000/openshift/rhel-openssl-keytool
          imagePullPolicy: Always
          livenessProbe:
            httpGet:
              path: /health
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 180
          name: init-hello-world
          readinessProbe:
            httpGet:
              path: /health
              port: 8080
              scheme: HTTP
            initialDelaySeconds: 10
          resources: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
          - mountPath: /var/work-dir
            name: work-dir

The deployment (mvn fabric8:deploy) fails with the "io.fabric8.kubernetes.client.KubernetesClientException spec.template.spec.initContainers[0].livenessProbe: Invalid value:"

    [INFO] Updating DeploymentConfig from openshift.yml
[ERROR] Failed to update DeploymentConfig from openshift.yml. io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: PUT at: https
://openshifthost.com/deploymentconfigs/sample-project. Message: Deployment
Config "sample-project" is invalid: [spec.template.spec.initContainers[0].livenessProbe: Invalid value: api.Probe{Handler:api.Handler{Ex
ec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7340), TCPSocket:(*api.TCPSocketAction)(nil)}, InitialDelaySeconds:180, TimeoutSeconds
:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containers, spec.template.spec.initContainers[0].readinessProb
e: Invalid value: api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7b90), TCPSocket:(*api.TCPSocketActi
on)(nil)}, InitialDelaySeconds:10, TimeoutSeconds:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containers].
Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.template.spec.initContainers[0].livenessProbe, m
essage=Invalid value: api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7340), TCPSocket:(*api.TCPSocket
Action)(nil)}, InitialDelaySeconds:180, TimeoutSeconds:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containe
rs, reason=FieldValueInvalid, additionalProperties={}), StatusCause(field=spec.template.spec.initContainers[0].readinessProbe, message=Invalid value:
api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil), HTTPGet:(*api.HTTPGetAction)(0xc4459a7b90), TCPSocket:(*api.TCPSocketAction)(nil)}, Initial
DelaySeconds:10, TimeoutSeconds:1, PeriodSeconds:10, SuccessThreshold:1, FailureThreshold:3}: must not be set for init containers, reason=FieldValueIn
valid, additionalProperties={})], group=null, kind=DeploymentConfig, name=sample-project, retryAfterSeconds=null, uid=null, additionalPr
operties={}), kind=Status, message=DeploymentConfig "sample-project" is invalid: [spec.template.spec.initContainers[0].livenessProbe: In
valid value: api.Probe{Handler:api.Handler{Exec:(*api.ExecAction)(nil),

I believe initContainer should not contain livenessProbe and readinessProbe as it will end before application containers, not sure why f-m-p generates this. Am I missing some configuration or is this a bug with fabric8-maven-plugin?

Version of fabric8.maven.plugin.version used - 3.5.33.fuse-000067-redhat-1.

Note: Removing the livnessProbe and readinessProbe of initcontainers from openshift.yml and apply resource (mvn fabric8:apply) was successful.

Upvotes: 1

Views: 389

Answers (1)

jack
jack

Reputation: 833

This is a issue in the fabric8 plugin. https://github.com/fabric8io/fabric8-maven-plugin/issues/1283

Upvotes: 1

Related Questions