I'm attempting to edit the yaml of a deployment config in the OpenShift web console.
I'm simply trying to add a command and some args. I have another working example with the correct syntax and indentation.
However, when I copy this into the deployment config, Im unable to save it due to a validation error. However the error doesnt relate to the change I've made.
The error message is:
Failed to process the resource. Reason: DeploymentConfig.apps.openshift.io "my-sdk" is invalid: [spec.template.spec.containers[0].name: Required value, spec.template.spec.containers[0].image: Required value]
For example, I have the following snippet from the working deployment config:
spec:
containers:
- env:
- name: MY_DB_HOST
value: postgresql
- name: MY_DB_NAME
value: MY
- name: MY_DB_PASSWORD
value: MY
- name: MY_DB_USER
value: MY
- name: MY_CACHE_ENABLED
value: 'false'
image: >-
172.30.1.1:5000/myapp/my-sdk@sha256:eb485f011eaab9342b7fcf272c9f22dded9c238987f1dec932f8e1640ac18251
imagePullPolicy: Always
name: my-sdk
ports:
- containerPort: 8080
protocol: TCP
Then I attempt to change it to the following:
spec:
containers:
- args:
- '-myarg'
command:
- node
- env:
- name: MY_DB_HOST
value: postgresql
- name: MY_DB_NAME
value: MY
- name: MY_DB_PASSWORD
value: MY
- name: MY_DB_USER
value: MY
- name: MY_CACHE_ENABLED
value: 'false'
image: >-
172.30.1.1:5000/myapp/my-sdk@sha256:eb485f011eaab9342b7fcf272c9f22dded9c238987f1dec932f8e1640ac18251
imagePullPolicy: Always
name: my-sdk
ports:
- containerPort: 8080
protocol: TCP
And with this change I get the above error. I'm 99% certain the change I made is valid, as I'm simply coping it from a functional deployment config. And the error message doesnt seem to relate at all to the change.
Update
Now I have a working deploymentconfig that contains command and arg values.
When I try to remove these, without modifying any other yaml, or indentation, I get the following useless validation error:
Failed to process the resource. Reason: ReplicationController in version "v1" cannot be handled as a ReplicationController: v1.ReplicationController.Spec: v1.ReplicationControllerSpec.Template: v1.PodTemplateSpec.Spec: v1.PodSpec.TerminationGracePeriodSeconds: SecurityContext: SchedulerName: RestartPolicy: DNSPolicy: Containers: decode slice: expect [ or n, but found {, error found in #10 byte of ...|y":"File"},"dnsPolic|..., bigger context ...|ermination-log","terminationMessagePolicy":"File"},"dnsPolicy":"ClusterFirst","restartPolicy":"Alway|...
envandargssections needs to be indented one more level. The '-' for those should be same indent ascommand. - Graham Dumpleton