vitess-operator
vitess-operator copied to clipboard
vitessOrchestrator complete support for command: and args: key words
I realize vtorc is beta software and this might be a feature request rather than a bug.
Using command: and args: keywords to copy a file in the vtorc pod before vtorc runs doesn't work. However, command: and args: work under initContainer. Below is an example that generates an initContainer that runs "ls -l /" successfully because the results are logged under the pod's "setup" container.
spec:
vitessDashboard:
replicas: 1
resources:
limits:
memory: 512Mi
requests:
cpu: 75m
memory: 256Mi
next section:
keyspaces:
- name: demoDB
vitessOrchestrator:
extraLabels:
planetscale.com/component: vtorc
configSecret:
name: orc-config-80x
key: orc_config.json
initContainer:
name: setup
command: ["/bin/sh", "-c"]
args: ["ls -l /"]
extraVolumes:
- name: "orc-configs"
configMap:
name: "orc-config"
- name: "what"
emptyDir: {}
Based on how initContainer works, the expected results of the below config should be the results of "ls -l /" in the vtorc container log. The actual results are that the results of "ls -l /" are NOT logged. Only Vtorc is logging. I assume that means command: and args: are not being honored at the vitessOrchestrator level. The config I tried is below:
keyspaces:
- name: demoDB
vitessOrchestrator:
extraLabels:
planetscale.com/component: vtorc
configSecret:
name: orc-config-80x
key: orc_config.json
command: ["/bin/sh", "-c"]
args: ["ls -l /"]
extraVolumeMounts:
- name: "orc-configs"
mountPath: "/pickup"
- name: "what"
mountPath: /conf
extraVolumeMounts:
- name: "orc-configs"
mountPath: "/pickup"
- name: "what"
mountPath: /conf
extraVolumes:
- name: "orc-configs"
configMap:
name: "orc-config"
- name: "what"
emptyDir: {}
The workaround here is initContainer supports command: and args:.
InitContainer passes through all the normal Kubernetes commands like volumeMount. I got tripped up assuming the operator's extraVolumeMounts was used inside initContainer.
So, basically perform whatever operations you can in initContainer, then copy them into the vtorc pod until command and arg are supported.