Skip to content

Commit 6329db4

Browse files
Add labels and annotations to pods.
Currently, there is only one deployment, so avoid premature optimization by making these global (and follow the same pattern for imagePullSecrets) Requires more aggressive usage of the `strip-kustomize-helm.sh` script because we have to preserve existing annotations and labels from the config/manager directory. Signed-off-by: Christopher Pitstick <cpitstick@lat.ai>
1 parent 339e5c8 commit 6329db4

File tree

5 files changed

+35
-14
lines changed

5 files changed

+35
-14
lines changed
+19-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# This script is a hack to support helm flow control in kustomize overlays, which would otherwise break them.
44
# It allows us to render helm template bindings and add newlines.
55
# For instance, it transforms "___{{ .Value.myValue }}___" to {{ .Value.myValue }}.
6-
# It also adds newlines wherever ___newline___ is found.
7-
8-
CHARTS_DIR='./chart/open-feature-operator/templates';
6+
# It also adds newlines wherever ___newline___ is found, and other operations. See
7+
# sed_expressions below.
98

109
echo 'Running strip-kustomize-helm.sh script'
11-
filenames=`find $CHARTS_DIR -name "*.yaml"`
12-
for file in $filenames; do
13-
sed -i "s/___newline___/\\n/g" $file
14-
sed -i "s/\"___//g" $file
15-
sed -i "s/___\"//g" $file
16-
sed -i "s/___//g" $file
10+
CHARTS_DIR='./chart/open-feature-operator/templates'
11+
# Careful! Ordering of these expressions matter!
12+
sed_expressions=(
13+
"s/___newline___/\\n/g"
14+
"s/___space___/ /g"
15+
"s/\"___//g"
16+
"s/___\"//g"
17+
"/___delete_me___/d"
18+
"s/___//g"
19+
)
20+
find $CHARTS_DIR -name "*.yaml" | while read file; do
21+
for expr in "${sed_expressions[@]}"; do
22+
sed -i "$expr" "$file"
23+
done
1724
done
18-
echo 'Done running strip-kustomize-helm.sh script'
25+
26+
echo 'Done running strip-kustomize-helm.sh script'

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ set-helm-overlay:
252252
helm-package: set-helm-overlay generate release-manifests helm
253253
mkdir -p chart/open-feature-operator/templates/crds
254254
mv chart/open-feature-operator/templates/*customresourcedefinition* chart/open-feature-operator/templates/crds
255-
sh .github/scripts/strip-kustomize-helm.sh
255+
.github/scripts/strip-kustomize-helm.sh
256256
$(HELM) package --version $(CHART_VERSION) chart/open-feature-operator
257257
mkdir -p charts && mv open-feature-operator-*.tgz charts
258258
$(HELM) repo index --url https://open-feature.github.io/open-feature-operator/charts charts

chart/open-feature-operator/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ The command removes all the Kubernetes components associated with the chart and
9797
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
9898
| `defaultNamespace` | To override the namespace use the `--namespace` flag. This default is provided to ensure that the kustomize build charts in `/templates` deploy correctly when no `namespace` is provided via the `-n` flag. | `open-feature-operator-system` |
9999
| `imagePullSecrets` | Array of ImagePullSecret objects containing credentials for images pulled by the operator (flagdProxyConfiguration.image, flagdConfiguration.image, controllerManager.manager.image, controllerManager.kubeRbacProxy.image). Example: imagePullSecrets: [{"name": "my-secret"}] | `[]` |
100+
| `labels` | Labels to apply to all of the pods in the operator. | `{}` |
101+
| `annotations` | Annotations to apply to all of the pods in the operator. | `{}` |
100102

101103
### Sidecar configuration
102104

@@ -167,7 +169,7 @@ The command removes all the Kubernetes components associated with the chart and
167169
| `controllerManager.kubeRbacProxy.resources.requests.cpu` | Sets cpu resource requests for kube-rbac-proxy. | `5m` |
168170
| `controllerManager.kubeRbacProxy.resources.requests.memory` | Sets memory resource requests for kube-rbac-proxy. | `64Mi` |
169171
| `controllerManager.manager.image.repository` | Sets the image for the operator. | `ghcr.io/open-feature/open-feature-operator` |
170-
| `controllerManager.manager.image.tag` | Sets the version tag for the operator. | `v0.6.0` |
172+
| `controllerManager.manager.image.tag` | Sets the version tag for the operator. | `v0.6.1` |
171173
| `controllerManager.manager.resources.limits.cpu` | Sets cpu resource limits for operator. | `500m` |
172174
| `controllerManager.manager.resources.limits.memory` | Sets memory resource limits for operator. | `128Mi` |
173175
| `controllerManager.manager.resources.requests.cpu` | Sets cpu resource requests for operator. | `10m` |

chart/open-feature-operator/values.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
defaultNamespace: open-feature-operator-system
55
## @param imagePullSecrets Array of ImagePullSecret objects containing credentials for images pulled by the operator (flagdProxyConfiguration.image, flagdConfiguration.image, controllerManager.manager.image, controllerManager.kubeRbacProxy.image). Example: imagePullSecrets: [{"name": "my-secret"}]
66
imagePullSecrets: []
7+
## @param labels Labels to apply to all of the pods in the operator.
8+
labels: {}
9+
## @param annotations Annotations to apply to all of the pods in the operator.
10+
annotations: {}
711

812
## @section Sidecar configuration
913
sidecarConfiguration:

config/overlays/helm/manager.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ metadata:
66
spec:
77
replicas: 0{{ .Values.controllerManager.replicas }}
88
template:
9+
metadata:
10+
# this is transformed by .github/scripts/strip-kustomize-helm.sh
11+
annotations:
12+
___delete_me___: "___ ___newline___{{___space___toYaml___space___.Values.annotations___space___|___space___indent___space___8___space___}}___"
13+
# this is transformed by .github/scripts/strip-kustomize-helm.sh
14+
labels:
15+
___delete_me___: "___ ___newline___{{___space___toYaml___space___.Values.labels___space___|___space___indent___space___8___space___}}___"
916
spec:
1017
# this is transformed by .github/scripts/strip-kustomize-helm.sh
11-
___imagePullSecrets___: "___ ___newline___{{ toYaml .Values.imagePullSecrets | indent 8 }}___"
18+
___imagePullSecrets___: "___ ___newline___{{ toYaml .Values.imagePullSecrets___space___|___space___indent___space___8___space___}}___"
1219
containers:
1320
- name: manager
1421
image: "{{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag }}"

0 commit comments

Comments
 (0)