Skip to content

Commit 67278af

Browse files
Merge pull request #94 from trevorbox/fix-helm
Helm chart generation now includes crds and uses the default service a…
2 parents 75af315 + e30c91c commit 67278af

File tree

6 files changed

+37
-27
lines changed

6 files changed

+37
-27
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,10 @@ bundle-build:
127127
# Generate helm chart
128128
helmchart: kustomize
129129
mkdir -p ./charts/${OPERATOR_NAME}/templates
130+
mkdir -p ./charts/${OPERATOR_NAME}/crds
130131
cp ./config/helmchart/templates/* ./charts/${OPERATOR_NAME}/templates
131132
$(KUSTOMIZE) build ./config/helmchart | sed 's/release-namespace/{{.Release.Namespace}}/' > ./charts/${OPERATOR_NAME}/templates/rbac.yaml
133+
$(KUSTOMIZE) build ./config/crd > ./charts/${OPERATOR_NAME}/crds/crds.yaml
132134
version=${VERSION} envsubst < ./config/helmchart/Chart.yaml.tpl > ./charts/${OPERATOR_NAME}/Chart.yaml
133135
version=${VERSION} image_repo=$${IMG%:*} envsubst < ./config/helmchart/values.yaml.tpl > ./charts/${OPERATOR_NAME}/values.yaml
134136
helm lint ./charts/${OPERATOR_NAME}

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,29 @@ oc login --token ${token}
250250
make run ENABLE_WEBHOOKS=false
251251
```
252252

253+
### Test helm chart locally
254+
255+
Define an image and tag. For example...
256+
257+
```shell
258+
export imageRepository="quay.io/redhat-cop/namespace-configuration-operator"
259+
export imageTag="v1.0.2"
260+
```
261+
262+
Deploy chart...
263+
264+
```shell
265+
make helmchart IMG=${imageRepository} VERSION=${imageTag}
266+
helm upgrade -i namespace-configuration-operator-local charts/namespace-configuration-operator -n namespace-configuration-operator-local --create-namespace
267+
```
268+
269+
Delete...
270+
271+
```shell
272+
helm delete namespace-configuration-operator-local -n namespace-configuration-operator-local
273+
kubectl delete -f charts/namespace-configuration-operator/crds/crds.yaml
274+
```
275+
253276
### Building/Pushing the operator image
254277

255278
```shell

config/helmchart/templates/_helpers.tpl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,3 @@ Selector labels
5050
app.kubernetes.io/name: {{ include "namespace-configuration-operator.name" . }}
5151
app.kubernetes.io/instance: {{ .Release.Name }}
5252
{{- end }}
53-
54-
{{/*
55-
Create the name of the service account to use
56-
*/}}
57-
{{- define "namespace-configuration-operator.serviceAccountName" -}}
58-
{{- if .Values.serviceAccount.create }}
59-
{{- default (include "namespace-configuration-operator.fullname" .) .Values.serviceAccount.name }}
60-
{{- else }}
61-
{{- default "default" .Values.serviceAccount.name }}
62-
{{- end }}
63-
{{- end }}

config/helmchart/templates/manager.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ spec:
2222
imagePullSecrets:
2323
{{- toYaml . | nindent 8 }}
2424
{{- end }}
25-
serviceAccountName: {{ include "namespace-configuration-operator.serviceAccountName" . }}
2625
containers:
2726
- command:
2827
- /manager
@@ -33,6 +32,18 @@ spec:
3332
name: {{ .Chart.Name }}
3433
resources:
3534
{{- toYaml .Values.resources | nindent 12 }}
35+
livenessProbe:
36+
httpGet:
37+
path: /healthz
38+
port: 8081
39+
initialDelaySeconds: 15
40+
periodSeconds: 20
41+
readinessProbe:
42+
httpGet:
43+
path: /readyz
44+
port: 8081
45+
initialDelaySeconds: 5
46+
periodSeconds: 10
3647
{{- with .Values.nodeSelector }}
3748
nodeSelector:
3849
{{- toYaml . | nindent 8 }}

config/helmchart/values.yaml.tpl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,9 @@ imagePullSecrets: []
1414
nameOverride: ""
1515
fullnameOverride: ""
1616

17-
serviceAccount:
18-
# Specifies whether a service account should be created
19-
create: true
20-
# Annotations to add to the service account
21-
annotations: {}
22-
# The name of the service account to use.
23-
# If not set and create is true, a name is generated using the fullname template
24-
name: ""
25-
2617
podAnnotations: {}
2718

2819
resources:
29-
limits:
30-
cpu: 100m
31-
memory: 30Mi
3220
requests:
3321
cpu: 100m
3422
memory: 20Mi

config/manager/manager.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ spec:
4444
initialDelaySeconds: 5
4545
periodSeconds: 10
4646
resources:
47-
limits:
48-
cpu: 100m
49-
memory: 30Mi
5047
requests:
5148
cpu: 100m
5249
memory: 20Mi

0 commit comments

Comments
 (0)