cybozu-go / moco

MySQL operator on Kubernetes using GTID-based semi-synchronous replication.
https://cybozu-go.github.io/moco/
Apache License 2.0
269 stars 22 forks source link

Does operator and CR not support adding environment variables,such as time_zone #720

Closed sona-yuan closed 1 month ago

sona-yuan commented 1 month ago

What

Does operator and CR not support adding environment variables,such as time_zone

How

containers:

Checklist

YZ775 commented 1 month ago

@sona-yuan I confirmed the env written in MySQLCluster is propagated to its Pods.

MySQLCluster.spec.podTemplate is PodSpecApplyConfiguration. Please see here for detail.

apiVersion: moco.cybozu.com/v1beta2
kind: MySQLCluster
metadata:
  namespace: sandbox
  name: test
spec:
  replicas: 3
  podTemplate:
    spec:
      containers:
      - name: mysqld
        image: ghcr.io/cybozu-go/moco/mysql:8.4.0
        env:
          - name: TZ
            value: "Asia/Shanghai"
  volumeClaimTemplates:
  - metadata:
      name: mysql-data
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi
$ kubectl get pod -n sandbox moco-test-0 -oyaml | yq .spec.containers[0].env
- name: TZ
  value: Asia/Shanghai
$ kubectl exec -n sandbox moco-test-0 mysqld -it -- bash
I have no name!@moco-test-0:/$ echo $TZ
Asia/Shanghai
sona-yuan commented 1 month ago

Thank you, I get it

sona-yuan commented 1 month ago

resolve