appuio / ansible-module-openshift

Ansible Modules for Configuring OpenShift 3
Apache License 2.0
3 stars 1 forks source link

Changing dict key and value leads to error #4

Open hansmi opened 6 years ago

hansmi commented 6 years ago

I am applying a template containing, among other things, multiple deployment configurations. The containers have liveness and readiness checks, i.e.:

livenessProbe:
  failureThreshold: 3
  httpGet:
    path: /healthz
    port: 8080
    scheme: HTTP
  initialDelaySeconds: 30
  periodSeconds: 10
  successThreshold: 1
  timeoutSeconds: 2

Ansible task:

- openshift_resource:
    namespace: "{{ … }}"
    template: "{{ tempdir }}/template.yml"
    app_name: …
    arguments:
      NAMESPACE: "{{ … }}"

Changing the probe to use tcpSocket fails. First the changed probe:

livenessProbe:
  failureThreshold: 3
  tcpSocket:
    port: 8080
  initialDelaySeconds: 30
  periodSeconds: 10
  successThreshold: 1
  timeoutSeconds: 2

When applying the template again using ansible-module-openshift the error from OpenShift is "The DeploymentConfig (…) is invalid: spec.template.spec.containers[0].livenessProbe.tcpSocket: Forbidden: may not specify more than 1 handler type". Removing the deployment config (or only the probe therein) first is a workaround, but not very good for operations.

I tried setting httpGet to null in the template, but the error remained.

Expected behaviour: Dictionary keys no longer set in applied object are also unset in target.