Open meveno opened 9 months ago
Can you try with the following syntax?
gateway:
[ ... skipped yaml ... ]
extraInitContainers: |
name: "wait-for-elasticsearch"
image: "busybox:1.36"
command: ["sh", "-c", "until nc -z -v graviteeio-apim-elasticsearch-data.gravitee.svc.cluster.local 9200; do echo waiting for elasticsearch; sleep 2; done"]
It seems the last comment was edited but still not working ...
Not better :
Error: template: apim3/templates/gateway/gateway-deployment.yaml:129:16: executing "apim3/templates/gateway/gateway-deployment.yaml" at <.>: wrong type for value; expected string; got map[string]interface {}
Or
Error message : cannot unmarshal object into Go struct field PodSpec.spec.template.spec.initContainers of type []v1.Container
Full error :
Error: UPGRADE FAILED: cannot patch "ovalt-apim3-gateway" with kind Deployment: "" is invalid: patch: Invalid value: "{\"apiVersion\":\"apps/v1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{\"deployment.kubernetes.io/revision\":\"41\",\"meta.helm.sh/release-name\":\"ovalt\",\"meta.helm.sh/release-namespace\":\"gravitee\"},\"creationTimestamp\":\"2023-09-28T15:36:05Z\",\"generation\":19,\"labels\":{\"app.kubernetes.io/component\":\"gateway\",\"app.kubernetes.io/instance\":\"ovalt\",\"app.kubernetes.io/managed-by\":\"Helm\",\"app.kubernetes.io/name\":\"apim3\",\"app.kubernetes.io/version\":\"3.20.25\",\"helm.sh/chart\":\"apim3-3.20.25\",\"velero.io/backup-name\":\"velero-backup-20230928143010\",\"velero.io/restore-name\":\"velero-backup-20230928143010-20230928173543\"},\"managedFields\":[{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:replicas\":{}}},\"subresource\":\"scale\"},{\"manager\":\"velero-server\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-04-13T15:33:08Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:meta.helm.sh/release-name\":{},\"f:meta.helm.sh/release-namespace\":{}},\"f:labels\":{\".\":{},\"f:app.kubernetes.io/component\":{},\"f:app.kubernetes.io/instance\":{},\"f:app.kubernetes.io/managed-by\":{},\"f:app.kubernetes.io/name\":{},\"f:velero.io/backup-name\":{},\"f:velero.io/restore-name\":{}}},\"f:spec\":{\"f:progressDeadlineSeconds\":{},\"f:revisionHistoryLimit\":{},\"f:selector\":{},\"f:strategy\":{\"f:rollingUpdate\":{\".\":{},\"f:maxSurge\":{},\"f:maxUnavailable\":{}},\"f:type\":{}},\"f:template\":{\"f:metadata\":{\"f:annotations\":{\".\":{},\"f:chaos.alpha.kubernetes.io/enabled\":{}},\"f:labels\":{\".\":{},\"f:app.kubernetes.io/component\":{},\"f:app.kubernetes.io/instance\":{},\"f:app.kubernetes.io/name\":{}}},\"f:spec\":{\"f:affinity\":{},\"f:containers\":{\"k:{\\\"name\\\":\\\"ovalt-apim3-gateway\\\"}\":{\".\":{},\"f:imagePullPolicy\":{},\"f:livenessProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:successThreshold\":{}},\"f:name\":{},\"f:ports\":{\".\":{},\"k:{\\\"containerPort\\\":8082,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}}},\"f:readinessProbe\":{\".\":{},\"f:successThreshold\":{}},\"f:resources\":{\".\":{},\"f:limits\":{},\"f:requests\":{}},\"f:securityContext\":{\".\":{},\"f:runAsNonRoot\":{},\"f:runAsUser\":{}},\"f:terminationMessagePath\":{},\"f:terminationMessagePolicy\":{},\"f:volumeMounts\":{\".\":{},\"k:{\\\"mountPath\\\":\\\"/opt/graviteeio-gateway/config/gravitee.yml\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:subPath\":{}}}}},\"f:dnsPolicy\":{},\"f:restartPolicy\":{},\"f:schedulerName\":{},\"f:securityContext\":{},\"f:serviceAccount\":{},\"f:serviceAccountName\":{},\"f:terminationGracePeriodSeconds\":{},\"f:volumes\":{\".\":{},\"k:{\\\"name\\\":\\\"config\\\"}\":{\".\":{},\"f:configMap\":{\".\":{},\"f:defaultMode\":{},\"f:name\":{}},\"f:name\":{}}}}}}}},{\"manager\":\"helm\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-12-14T15:29:49Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:labels\":{\"f:app.kubernetes.io/version\":{},\"f:helm.sh/chart\":{}}},\"f:spec\":{\"f:template\":{\"f:metadata\":{\"f:annotations\":{\"f:checksum/config\":{}},\"f:labels\":{\"f:app.kubernetes.io/version\":{}}},\"f:spec\":{\"f:containers\":{\"k:{\\\"name\\\":\\\"ovalt-apim3-gateway\\\"}\":{\"f:env\":{\".\":{},\"k:{\\\"name\\\":\\\"GIO_MAX_MEM\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}},\"k:{\\\"name\\\":\\\"JAVA_OPTS\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}},\"k:{\\\"name\\\":\\\"gravitee_api_properties_encryption_secret\\\"}\":{\".\":{},\"f:name\":{},\"f:value\":{}}},\"f:image\":{},\"f:livenessProbe\":{\"f:httpGet\":{\".\":{},\"f:httpHeaders\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:timeoutSeconds\":{}},\"f:ports\":{\"k:{\\\"containerPort\\\":18082,\\\"protocol\\\":\\\"TCP\\\"}\":{\".\":{},\"f:containerPort\":{},\"f:name\":{},\"f:protocol\":{}}},\"f:readinessProbe\":{\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:httpHeaders\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:periodSeconds\":{},\"f:timeoutSeconds\":{}},\"f:resources\":{\"f:limits\":{\"f:cpu\":{},\"f:memory\":{}},\"f:requests\":{\"f:cpu\":{},\"f:memory\":{}}},\"f:startupProbe\":{\".\":{},\"f:failureThreshold\":{},\"f:httpGet\":{\".\":{},\"f:httpHeaders\":{},\"f:path\":{},\"f:port\":{},\"f:scheme\":{}},\"f:initialDelaySeconds\":{},\"f:periodSeconds\":{},\"f:successThreshold\":{},\"f:timeoutSeconds\":{}},\"f:volumeMounts\":{\"k:{\\\"mountPath\\\":\\\"/opt/graviteeio-gateway/config/logback.xml\\\"}\":{\".\":{},\"f:mountPath\":{},\"f:name\":{},\"f:subPath\":{}}}}}}}}}},{\"manager\":\"node-fetch\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-12-19T08:20:21Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:spec\":{\"f:template\":{\"f:metadata\":{\"f:annotations\":{\"f:kubectl.kubernetes.io/restartedAt\":{}}}}}}},{\"manager\":\"kube-controller-manager\",\"operation\":\"Update\",\"apiVersion\":\"apps/v1\",\"time\":\"2023-12-26T08:08:51Z\",\"fieldsType\":\"FieldsV1\",\"fieldsV1\":{\"f:metadata\":{\"f:annotations\":{\"f:deployment.kubernetes.io/revision\":{}}},\"f:status\":{\"f:availableReplicas\":{},\"f:conditions\":{\".\":{},\"k:{\\\"type\\\":\\\"Available\\\"}\":{\".\":{},\"f:lastTransitionTime\":{},\"f:lastUpdateTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}},\"k:{\\\"type\\\":\\\"Progressing\\\"}\":{\".\":{},\"f:lastTransitionTime\":{},\"f:lastUpdateTime\":{},\"f:message\":{},\"f:reason\":{},\"f:status\":{},\"f:type\":{}}},\"f:observedGeneration\":{},\"f:readyReplicas\":{},\"f:replicas\":{},\"f:updatedReplicas\":{}}},\"subresource\":\"status\"}],\"name\":\"ovalt-apim3-gateway\",\"namespace\":\"gravitee\",\"resourceVersion\":\"118259618\",\"uid\":\"838cab9c-0a4b-420c-bb33-f18e06b56abe\"},\"spec\":{\"progressDeadlineSeconds\":600,\"replicas\":2,\"revisionHistoryLimit\":10,\"selector\":{\"matchLabels\":{\"app.kubernetes.io/component\":\"gateway\",\"app.kubernetes.io/instance\":\"ovalt\",\"app.kubernetes.io/name\":\"apim3\"}},\"strategy\":{\"type\":\"RollingUpdate\",\"rollingUpdate\":{\"maxUnavailable\":1,\"maxSurge\":\"25%!\(MISSING)"}},\"template\":{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"app.kubernetes.io/component\":\"gateway\",\"app.kubernetes.io/instance\":\"ovalt\",\"app.kubernetes.io/name\":\"apim3\",\"app.kubernetes.io/version\":\"3.20.25\"},\"annotations\":{\"chaos.alpha.kubernetes.io/enabled\":\"false\",\"checksum/config\":\"9522425b214db18a9fb0f51d9bf2a2be3d2d2fb18eea1fb5cb81b6db9731c789\",\"kubectl.kubernetes.io/restartedAt\":\"2023-12-19T08:20:21Z\"}},\"spec\":{\"affinity\":{},\"containers\":[{\"env\":[{\"name\":\"gravitee_api_properties_encryption_secret\",\"value\":\"vozrMpzRmnY4383K6LHFQDSDj\"},{\"name\":\"GIO_MAX_MEM\",\"value\":\"1024m\"},{\"name\":\"JAVA_OPTS\",\"value\":\"-XX:+PrintFlagsFinal -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+PrintNMTStatistics -XshowSettings:vm -Duser.timezone=Europe/Paris -Dvertx.disableDnsResolver=true\"}],\"envFrom\":[],\"image\":\"graviteeio/apim-gateway:3.20.25\",\"imagePullPolicy\":\"IfNotPresent\",\"livenessProbe\":{\"failureThreshold\":3,\"httpGet\":{\"httpHeaders\":[{\"name\":\"Authorization\",\"value\":\"Basic YWRtaW46YWRtaW5hZG1pbg==\"}],\"path\":\"/_node/health?probes=http-server\",\"port\":18082,\"scheme\":\"HTTP\"},\"periodSeconds\":15,\"successThreshold\":1,\"timeoutSeconds\":2},\"name\":\"ovalt-apim3-gateway\",\"ports\":[{\"containerPort\":8082,\"name\":\"http\"},{\"containerPort\":18082,\"name\":\"gateway-techapi\"}],\"readinessProbe\":{\"failureThreshold\":2,\"httpGet\":{\"httpHeaders\":[{\"name\":\"Authorization\",\"value\":\"Basic YWRtaW46YWRtaW5hZG1pbg==\"}],\"path\":\"/_node/health?probes=api-sync\",\"port\":18082,\"scheme\":\"HTTP\"},\"periodSeconds\":10,\"successThreshold\":1,\"timeoutSeconds\":2},\"resources\":{\"limits\":{\"cpu\":\"2000m\",\"memory\":\"1800Mi\"},\"requests\":{\"cpu\":\"25m\",\"memory\":\"1300Mi\"}},\"securityContext\":{\"runAsNonRoot\":true,\"runAsUser\":1001},\"startupProbe\":{\"failureThreshold\":29,\"httpGet\":{\"httpHeaders\":[{\"name\":\"Authorization\",\"value\":\"Basic YWRtaW46YWRtaW5hZG1pbg==\"}],\"path\":\"/_node/health?probes=http-server\",\"port\":18082,\"scheme\":\"HTTP\"},\"initialDelaySeconds\":10,\"periodSeconds\":10,\"successThreshold\":1,\"timeoutSeconds\":1},\"volumeMounts\":[{\"mountPath\":\"/opt/graviteeio-gateway/config/gravitee.yml\",\"name\":\"config\",\"subPath\":\"gravitee.yml\"},{\"mountPath\":\"/opt/graviteeio-gateway/config/logback.xml\",\"name\":\"config\",\"subPath\":\"logback.xml\"}]}],\"dnsPolicy\":\"ClusterFirst\",\"initContainers\":{\"command\":[\"sh\",\"-c\",\"until nc -z -v graviteeio-apim-elasticsearch-data.gravitee.svc.cluster.local 9200; do echo waiting for elasticsearch; sleep 2; done\"],\"image\":\"busybox:1.36\",\"name\":\"wait-for-elasticsearch\"},\"restartPolicy\":\"Always\",\"schedulerName\":\"default-scheduler\",\"securityContext\":{},\"serviceAccount\":\"ovalt-apim3\",\"serviceAccountName\":\"ovalt-apim3\",\"terminationGracePeriodSeconds\":30,\"volumes\":[{\"name\":\"config\",\"configMap\":{\"name\":\"ovalt-apim3-gateway\",\"defaultMode\":420}}]}}},\"status\":{\"observedGeneration\":19,\"replicas\":2,\"updatedReplicas\":2,\"readyReplicas\":2,\"availableReplicas\":2,\"conditions\":[{\"type\":\"Available\",\"status\":\"True\",\"lastUpdateTime\":\"2023-12-19T05:36:57Z\",\"lastTransitionTime\":\"2023-12-19T05:36:57Z\",\"reason\":\"MinimumReplicasAvailable\",\"message\":\"Deployment has minimum availability.\"},{\"type\":\"Progressing\",\"status\":\"True\",\"lastUpdateTime\":\"2023-12-19T08:20:53Z\",\"lastTransitionTime\":\"2023-09-28T15:36:07Z\",\"reason\":\"NewReplicaSetAvailable\",\"message\":\"ReplicaSet \\\"ovalt-apim3-gateway-6545cb66fc\\\" has successfully progressed.\"}]}}": json: cannot unmarshal object into Go struct field PodSpec.spec.template.spec.initContainers of type []v1.Container
The sanytized resulting json :
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"annotations": {
"deployment.kubernetes.io/revision": "41",
"meta.helm.sh/release-name": "ovalt",
"meta.helm.sh/release-namespace": "gravitee"
},
"creationTimestamp": "2023-09-28T15:36:05Z",
"generation": 19,
"labels": {
"app.kubernetes.io/component": "gateway",
"app.kubernetes.io/instance": "ovalt",
"app.kubernetes.io/managed-by": "Helm",
"app.kubernetes.io/name": "apim3",
"app.kubernetes.io/version": "3.20.25",
"helm.sh/chart": "apim3-3.20.25",
"velero.io/backup-name": "velero-backup-20230928143010",
"velero.io/restore-name": "velero-backup-20230928143010-20230928173543"
},
"name": "ovalt-apim3-gateway",
"namespace": "gravitee",
"resourceVersion": "118259618",
"uid": "838cab9c-0a4b-420c-bb33-f18e06b56abe"
},
"spec": {
"progressDeadlineSeconds": 600,
"replicas": 2,
"revisionHistoryLimit": 10,
"selector": {
"matchLabels": {
"app.kubernetes.io/component": "gateway",
"app.kubernetes.io/instance": "ovalt",
"app.kubernetes.io/name": "apim3"
}
},
"strategy": {
"type": "RollingUpdate",
"rollingUpdate": {
"maxUnavailable": 1,
"maxSurge": "25%!\\(MISSING)"
}
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/component": "gateway",
"app.kubernetes.io/instance": "ovalt",
"app.kubernetes.io/name": "apim3",
"app.kubernetes.io/version": "3.20.25"
},
"annotations": {
"chaos.alpha.kubernetes.io/enabled": "false",
"checksum/config": "9522425b214db18a9fb0f51d9bf2a2be3d2d2fb18eea1fb5cb81b6db9731c789",
"kubectl.kubernetes.io/restartedAt": "2023-12-19T08:20:21Z"
}
},
"spec": {
"affinity": {},
"containers": [
{
"env": [
{
"name": "gravitee_api_properties_encryption_secret",
"value": "vozrMpzRmnY4383K6LHFQDSDj"
},
{
"name": "GIO_MAX_MEM",
"value": "1024m"
},
{
"name": "JAVA_OPTS",
"value": "-XX:+PrintFlagsFinal -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+PrintNMTStatistics -XshowSettings:vm -Duser.timezone=Europe/Paris -Dvertx.disableDnsResolver=true"
}
],
"envFrom": [],
"image": "graviteeio/apim-gateway:3.20.25",
"imagePullPolicy": "IfNotPresent",
"livenessProbe": {
"failureThreshold": 3,
"httpGet": {
"httpHeaders": [
{
"name": "Authorization",
"value": "Basic YWRtaW46YWRtaW5hZG1pbg=="
}
],
"path": "/_node/health?probes=http-server",
"port": 18082,
"scheme": "HTTP"
},
"periodSeconds": 15,
"successThreshold": 1,
"timeoutSeconds": 2
},
"name": "ovalt-apim3-gateway",
"ports": [
{
"containerPort": 8082,
"name": "http"
},
{
"containerPort": 18082,
"name": "gateway-techapi"
}
],
"readinessProbe": {
"failureThreshold": 2,
"httpGet": {
"httpHeaders": [
{
"name": "Authorization",
"value": "Basic YWRtaW46YWRtaW5hZG1pbg=="
}
],
"path": "/_node/health?probes=api-sync",
"port": 18082,
"scheme": "HTTP"
},
"periodSeconds": 10,
"successThreshold": 1,
"timeoutSeconds": 2
},
"resources": {
"limits": {
"cpu": "2000m",
"memory": "1800Mi"
},
"requests": {
"cpu": "25m",
"memory": "1300Mi"
}
},
"securityContext": {
"runAsNonRoot": true,
"runAsUser": 1001
},
"startupProbe": {
"failureThreshold": 29,
"httpGet": {
"httpHeaders": [
{
"name": "Authorization",
"value": "Basic YWRtaW46YWRtaW5hZG1pbg=="
}
],
"path": "/_node/health?probes=http-server",
"port": 18082,
"scheme": "HTTP"
},
"initialDelaySeconds": 10,
"periodSeconds": 10,
"successThreshold": 1,
"timeoutSeconds": 1
},
"volumeMounts": [
{
"mountPath": "/opt/graviteeio-gateway/config/gravitee.yml",
"name": "config",
"subPath": "gravitee.yml"
},
{
"mountPath": "/opt/graviteeio-gateway/config/logback.xml",
"name": "config",
"subPath": "logback.xml"
}
]
}
],
"dnsPolicy": "ClusterFirst",
"initContainers": {
"command": [
"sh",
"-c",
"until nc -z -v graviteeio-apim-elasticsearch-data.gravitee.svc.cluster.local 9200; do echo waiting for elasticsearch; sleep 2; done"
],
"image": "busybox:1.36",
"name": "wait-for-elasticsearch"
},
"restartPolicy": "Always",
"schedulerName": "default-scheduler",
"securityContext": {},
"serviceAccount": "ovalt-apim3",
"serviceAccountName": "ovalt-apim3",
"terminationGracePeriodSeconds": 30,
"volumes": [
{
"name": "config",
"configMap": {
"name": "ovalt-apim3-gateway",
"defaultMode": 420
}
}
]
}
}
}
}
Any update on this ?
Describe the bug
Can't
To Reproduce
Steps to reproduce the behaviour:
Steps to reproduce the behaviour:
gateway: [ ... skipped yaml ... ] extraInitContainers: * name: "wait-for-elasticsearch" image: "busybox:1.36" command: ["sh", "-c", "until nc -z -v graviteeio-apim-elasticsearch-data.gravitee.svc.cluster.local 9200; do echo waiting for elasticsearch; sleep 2; done"]
Expected behaviour
Yaml template deployment for gateway contains initContainers
Current behaviour
Helm can't deploy or generate template
Environment
Helm Chart Version 3.20.25
Potential impacts
Can't add initContainers to gateway