Skip to content

Commit 9c6bdb7

Browse files
committed
expose configurable parameters via helm chart values
Signed-off-by: odubajDT <[email protected]>
1 parent 6f38fe6 commit 9c6bdb7

File tree

6 files changed

+75
-11
lines changed

6 files changed

+75
-11
lines changed

chart/open-feature-operator/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,20 @@ The command removes all the Kubernetes components associated with the chart and
119119
| `sidecarConfiguration.resources.requests.cpu` | Sets cpu resource requests for kube-rbac-proxy. | `200m` |
120120
| `sidecarConfiguration.resources.requests.memory` | Sets memory resource requests for kube-rbac-proxy. | `32Mi` |
121121

122+
### In-process configuration
123+
124+
| Name | Description | Value |
125+
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------- | ----------- |
126+
| `inProcessConfiguration.port` | Sets the value of the `XXX_PORT` environment variable for the pod containers. | `8015` |
127+
| `inProcessConfiguration.host` | Sets the value of the `XXX_HOST` environment variable for the pod containers. | `localhost` |
128+
| `inProcessConfiguration.socketPath` | Sets the value of the `XXX_SOCKET_PATH` environment variable for the pod containers. | `""` |
129+
| `inProcessConfiguration.tls` | Sets the value of the `XXX_TLS` environment variable for the pod containers. | `false` |
130+
| `inProcessConfiguration.offlineFlagSourcePath` | Sets the value of the `XXX_OFFLINE_FLAG_SOURCE_PATH` environment variable for the pod containers. | `""` |
131+
| `inProcessConfiguration.selector` | Sets the value of the `XXX_SELECTOR` environment variable for the pod containers. | `""` |
132+
| `inProcessConfiguration.envVarPrefix` | Sets the value of the `XXX_ENV_VAR_PREFIX` environment variable for the pod containers. | `FLAGD` |
133+
| `inProcessConfiguration.cache.type` | Sets the value of the `XXX_CACHE` environment variable for the pod containers. | `lru` |
134+
| `inProcessConfiguration.cache.size` | Sets the value of the `XXX_CACHE_MAX_SIZE` environment variable for the pod containers. | `1000` |
135+
122136
### Flagd-proxy configuration
123137

124138
| Name | Description | Value |

chart/open-feature-operator/values.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,28 @@ sidecarConfiguration:
4545
## @param sidecarConfiguration.resources.requests.memory Sets memory resource requests for kube-rbac-proxy.
4646
memory: 32Mi
4747

48+
## @section In-process configuration
49+
inProcessConfiguration:
50+
## @param inProcessConfiguration.port Sets the value of the `XXX_PORT` environment variable for the pod containers.
51+
port: 8015
52+
## @param inProcessConfiguration.host Sets the value of the `XXX_HOST` environment variable for the pod containers.
53+
host: "localhost"
54+
## @param inProcessConfiguration.socketPath Sets the value of the `XXX_SOCKET_PATH` environment variable for the pod containers.
55+
socketPath: ""
56+
## @param inProcessConfiguration.tls Sets the value of the `XXX_TLS` environment variable for the pod containers.
57+
tls: "false"
58+
## @param inProcessConfiguration.offlineFlagSourcePath Sets the value of the `XXX_OFFLINE_FLAG_SOURCE_PATH` environment variable for the pod containers.
59+
offlineFlagSourcePath: ""
60+
## @param inProcessConfiguration.selector Sets the value of the `XXX_SELECTOR` environment variable for the pod containers.
61+
selector: ""
62+
## @param inProcessConfiguration.envVarPrefix Sets the value of the `XXX_ENV_VAR_PREFIX` environment variable for the pod containers.
63+
envVarPrefix: "FLAGD"
64+
cache:
65+
## @param inProcessConfiguration.cache.type Sets the value of the `XXX_CACHE` environment variable for the pod containers.
66+
type: "lru"
67+
## @param inProcessConfiguration.cache.size Sets the value of the `XXX_CACHE_MAX_SIZE` environment variable for the pod containers.
68+
size: 1000
69+
4870
## @section Flagd-proxy configuration
4971
flagdProxyConfiguration:
5072
## @param flagdProxyConfiguration.port Sets the port to expose the sync API on.

common/types/envconfig.go

+10
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,14 @@ type EnvConfig struct {
3232
SidecarLogFormat string `envconfig:"SIDECAR_LOG_FORMAT" default:"json"`
3333
SidecarProbesEnabled bool `envconfig:"SIDECAR_PROBES_ENABLED" default:"true"`
3434
FlagdResourceEnabled bool `envconfig:"FLAGD_RESOURCE_ENABLED" default:"true"`
35+
// in-process configuration
36+
InProcessPort int `envconfig:"IN_PROCESS_PORT" default:"8015"`
37+
InProcessSocketPath string `envconfig:"IN_PROCESS_SOCKET_PATH" default:""`
38+
InProcessHost string `envconfig:"IN_PROCESS_HOST" default:"localhost"`
39+
InProcessTLS bool `envconfig:"IN_PROCESS_TLS" default:"false"`
40+
InProcessOfflineFlagSourcePath string `envconfig:"IN_PROCESS_OFFLINE_FLAG_SOURCE_PATH" default:""`
41+
InProcessSelector string `envconfig:"IN_PROCESS_SELECTOR" default:""`
42+
InProcessCache string `envconfig:"IN_PROCESS_CACHE" default:"lru"`
43+
InProcessEnvVarPrefix string `envconfig:"IN_PROCESS_ENV_VAR_PREFIX" default:"FLAGD"`
44+
InProcessCacheMaxSize int `envconfig:"IN_PROCESS_CACHE_MAX_SIZE" default:"1000"`
3545
}

config/overlays/helm/manager.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,24 @@ spec:
6868
value: "{{ .Values.managerConfig.flagsValidatonEnabled }}"
6969
- name: FLAGD_RESOURCE_ENABLED
7070
value: "{{ .Values.managerConfig.flagdResourceEnabled }}"
71+
- name: IN_PROCESS_PORT
72+
value: "{{ .Values.inProcessConfiguration.port }}"
73+
- name: IN_PROCESS_HOST
74+
value: "{{ .Values.inProcessConfiguration.host }}"
75+
- name: IN_PROCESS_SOCKET_PATH
76+
value: "{{ .Values.inProcessConfiguration.socketPath }}"
77+
- name: IN_PROCESS_TLS
78+
value: "{{ .Values.inProcessConfiguration.tls }}"
79+
- name: IN_PROCESS_OFFLINE_FLAG_SOURCE_PATH
80+
value: "{{ .Values.inProcessConfiguration.offlineFlagSourcePath }}"
81+
- name: IN_PROCESS_SELECTOR
82+
value: "{{ .Values.inProcessConfiguration.selector }}"
83+
- name: IN_PROCESS_CACHE
84+
value: "{{ .Values.inProcessConfiguration.cache.type }}"
85+
- name: IN_PROCESS_ENV_VAR_PREFIX
86+
value: "{{ .Values.inProcessConfiguration.envVarPrefix }}"
87+
- name: IN_PROCESS_CACHE_MAX_SIZE
88+
value: "{{ .Values.inProcessConfiguration.cache.size }}"
7189
args:
7290
- --leader-elect
7391
- --sidecar-cpu-limit={{ .Values.sidecarConfiguration.resources.limits.cpu }}

webhooks/common.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@ func NewFeatureFlagSourceSpec(env types.EnvConfig) *api.FeatureFlagSourceSpec {
8585
}
8686
}
8787

88-
func NewFeatureFlagInProcessConfigurationSpec() *api.FeatureFlagInProcessConfigurationSpec {
88+
func NewFeatureFlagInProcessConfigurationSpec(env types.EnvConfig) *api.FeatureFlagInProcessConfigurationSpec {
8989
return &api.FeatureFlagInProcessConfigurationSpec{
90-
Port: apicommon.DefaultRPCPort,
91-
SocketPath: "",
92-
Host: apicommon.DefaultHost,
93-
TLS: false,
94-
OfflineFlagSourcePath: "",
95-
Selector: "",
96-
Cache: apicommon.DefaultCache,
97-
CacheMaxSize: int(apicommon.DefaultCacheMaxSize),
98-
EnvVarPrefix: apicommon.DefaultEnvVarPrefix,
90+
Port: int32(env.InProcessPort),
91+
SocketPath: env.InProcessSocketPath,
92+
Host: env.InProcessHost,
93+
TLS: env.InProcessTLS,
94+
OfflineFlagSourcePath: env.InProcessOfflineFlagSourcePath,
95+
Selector: env.InProcessSelector,
96+
Cache: env.InProcessCache,
97+
CacheMaxSize: int(env.InProcessCacheMaxSize),
98+
EnvVarPrefix: env.InProcessEnvVarPrefix,
9999
}
100100
}
101101

webhooks/pod_webhook.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (m *PodMutator) createFSInProcessConfigSpec(ctx context.Context, req admiss
171171
fscNames = parseList(val)
172172
}
173173

174-
featureFlagSourceSpec := NewFeatureFlagInProcessConfigurationSpec()
174+
featureFlagSourceSpec := NewFeatureFlagInProcessConfigurationSpec(m.Env)
175175

176176
for _, fscName := range fscNames {
177177
ns, name := utils.ParseAnnotation(fscName, req.Namespace)

0 commit comments

Comments
 (0)