Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 9546904

Browse files
committed
remove image defaults from preset mesh config and CRD and allow the
ability to specify the images through environment variables Signed-off-by: Thomas Stringer <[email protected]>
1 parent 8dccabb commit 9546904

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

charts/osm/templates/osm-injector-deployment.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ spec:
9494
valueFrom:
9595
fieldRef:
9696
fieldPath: metadata.name
97+
- name: OSM_ENVOY_IMAGE
98+
value: "{{ .Values.osm.sidecarImage }}"
99+
- name: OSM_ENVOY_WINDOWS_IMAGE
100+
value: "{{ .Values.osm.sidecarWindowsImage }}"
101+
- name: OSM_INIT_CONTAINER_IMAGE
102+
value: '{{ include "osmSidecarInit.image" . }}'
97103
{{- if .Values.osm.imagePullSecrets }}
98104
imagePullSecrets:
99105
{{ toYaml .Values.osm.imagePullSecrets | indent 8 }}

charts/osm/templates/preset-mesh-config.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ data:
1010
"enablePrivilegedInitContainer": {{.Values.osm.enablePrivilegedInitContainer | mustToJson}},
1111
"logLevel": {{.Values.osm.envoyLogLevel | mustToJson}},
1212
"maxDataPlaneConnections": {{.Values.osm.maxDataPlaneConnections | mustToJson}},
13-
"envoyImage": {{.Values.osm.sidecarImage | mustToJson}},
14-
"envoyWindowsImage": {{.Values.osm.sidecarWindowsImage | mustToJson}},
15-
"initContainerImage": "{{ include "osmSidecarInit.image" . }}",
1613
"configResyncInterval": {{.Values.osm.configResyncInterval | mustToJson}}
1714
},
1815
"traffic": {

cmd/osm-bootstrap/crds/config_meshconfig.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,9 @@ spec:
6666
envoyImage:
6767
description: Image for the Envoy sidecar
6868
type: string
69-
default: "envoyproxy/envoy-alpine@sha256:6502a637c6c5fba4d03d0672d878d12da4bcc7a0d0fb3f1d506982dde0039abd"
7069
envoyWindowsImage:
7170
description: Image for the Envoy sidecar on Windows workers
7271
type: string
73-
default: "envoyproxy/envoy-windows@sha256:c904fda95891ebbccb9b1f24c1a9482c8d01cbca215dd081fc8c8db36db85f85"
7472
initContainerImage:
7573
description: Image for the init container
7674
type: string

pkg/configurator/methods.go

+16-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package configurator
33
import (
44
"encoding/json"
55
"fmt"
6+
"os"
67
"time"
78

89
corev1 "k8s.io/api/core/v1"
@@ -124,17 +125,29 @@ func (c *client) GetEnvoyLogLevel() string {
124125

125126
// GetEnvoyImage returns the envoy image
126127
func (c *client) GetEnvoyImage() string {
127-
return c.getMeshConfig().Spec.Sidecar.EnvoyImage
128+
image := c.getMeshConfig().Spec.Sidecar.EnvoyImage
129+
if image == "" {
130+
image = os.Getenv("OSM_ENVOY_IMAGE")
131+
}
132+
return image
128133
}
129134

130135
// GetEnvoyWindowsImage returns the envoy windows image
131136
func (c *client) GetEnvoyWindowsImage() string {
132-
return c.getMeshConfig().Spec.Sidecar.EnvoyWindowsImage
137+
image := c.getMeshConfig().Spec.Sidecar.EnvoyWindowsImage
138+
if image == "" {
139+
image = os.Getenv("OSM_ENVOY_WINDOWS_IMAGE")
140+
}
141+
return image
133142
}
134143

135144
// GetInitContainerImage returns the init container image
136145
func (c *client) GetInitContainerImage() string {
137-
return c.getMeshConfig().Spec.Sidecar.InitContainerImage
146+
image := c.getMeshConfig().Spec.Sidecar.InitContainerImage
147+
if image == "" {
148+
image = os.Getenv("OSM_INIT_CONTAINER_IMAGE")
149+
}
150+
return image
138151
}
139152

140153
// GetServiceCertValidityPeriod returns the validity duration for service certificates, and a default in case of invalid duration

0 commit comments

Comments
 (0)