Skip to content

Commit 0303a4c

Browse files
pengzhoumlPeng Zhou
andauthored
MLE-14909 Create Helm Chart for Operator (#9)
* update controller-gen version * MLE-14909 add helmify to makefile to create helm chart for operator * Initial build of helm chart --------- Co-authored-by: Peng Zhou <peng.zhou@progress.com>
1 parent 7d79972 commit 0303a4c

16 files changed

+11487
-4015
lines changed

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,3 +307,13 @@ catalog-build: opm ## Build a catalog image.
307307
.PHONY: catalog-push
308308
catalog-push: ## Push a catalog image.
309309
$(MAKE) docker-push IMG=$(CATALOG_IMG)
310+
311+
HELMIFY ?= $(LOCALBIN)/helmify
312+
313+
.PHONY: helmify
314+
helmify: $(HELMIFY) ## Download helmify locally if necessary.
315+
$(HELMIFY): $(LOCALBIN)
316+
test -s $(LOCALBIN)/helmify || GOBIN=$(LOCALBIN) go install github.com/arttor/helmify/cmd/helmify@latest
317+
318+
helm: manifests kustomize helmify
319+
$(KUSTOMIZE) build config/default | $(HELMIFY) charts/marklogic-operator
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v2
2+
name: marklogic-operator
3+
description: A Helm chart for MarkLogic Operator
4+
# A chart can be either an 'application' or a 'library' chart.
5+
#
6+
# Application charts are a collection of templates that can be packaged into versioned archives
7+
# to be deployed.
8+
#
9+
# Library charts provide useful utilities or functions for the chart developer. They're included as
10+
# a dependency of application charts to inject those utilities and functions into the rendering
11+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
12+
type: application
13+
# This is the chart version. This version number should be incremented each time you make changes
14+
# to the chart and its templates, including the app version.
15+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
16+
version: 0.1.0
17+
# This is the version number of the application being deployed. This version number should be
18+
# incremented each time you make changes to the application. Versions are not expected to
19+
# follow Semantic Versioning. They should reflect the version the application is using.
20+
# It is recommended to use it with quotes.
21+
appVersion: "0.1.0"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "marklogic-operator.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "marklogic-operator.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "marklogic-operator.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "marklogic-operator.labels" -}}
37+
helm.sh/chart: {{ include "marklogic-operator.chart" . }}
38+
{{ include "marklogic-operator.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "marklogic-operator.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "marklogic-operator.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "marklogic-operator.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "marklogic-operator.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "marklogic-operator.fullname" . }}-controller-manager
5+
labels:
6+
app.kubernetes.io/component: manager
7+
app.kubernetes.io/created-by: marklogic-kubernetes-operator
8+
app.kubernetes.io/part-of: marklogic-kubernetes-operator
9+
control-plane: controller-manager
10+
{{- include "marklogic-operator.labels" . | nindent 4 }}
11+
spec:
12+
replicas: {{ .Values.controllerManager.replicas }}
13+
selector:
14+
matchLabels:
15+
control-plane: controller-manager
16+
{{- include "marklogic-operator.selectorLabels" . | nindent 6 }}
17+
template:
18+
metadata:
19+
labels:
20+
control-plane: controller-manager
21+
{{- include "marklogic-operator.selectorLabels" . | nindent 8 }}
22+
annotations:
23+
kubectl.kubernetes.io/default-container: manager
24+
spec:
25+
containers:
26+
- args: {{- toYaml .Values.controllerManager.kubeRbacProxy.args | nindent 8 }}
27+
env:
28+
- name: KUBERNETES_CLUSTER_DOMAIN
29+
value: {{ quote .Values.kubernetesClusterDomain }}
30+
image: {{ .Values.controllerManager.kubeRbacProxy.image.repository }}:{{ .Values.controllerManager.kubeRbacProxy.image.tag
31+
| default .Chart.AppVersion }}
32+
name: kube-rbac-proxy
33+
ports:
34+
- containerPort: 8443
35+
name: https
36+
protocol: TCP
37+
resources: {{- toYaml .Values.controllerManager.kubeRbacProxy.resources | nindent
38+
10 }}
39+
securityContext: {{- toYaml .Values.controllerManager.kubeRbacProxy.containerSecurityContext
40+
| nindent 10 }}
41+
- args: {{- toYaml .Values.controllerManager.manager.args | nindent 8 }}
42+
command:
43+
- /manager
44+
env:
45+
- name: KUBERNETES_CLUSTER_DOMAIN
46+
value: {{ quote .Values.kubernetesClusterDomain }}
47+
image: {{ .Values.controllerManager.manager.image.repository }}:{{ .Values.controllerManager.manager.image.tag
48+
| default .Chart.AppVersion }}
49+
livenessProbe:
50+
httpGet:
51+
path: /healthz
52+
port: 8081
53+
initialDelaySeconds: 15
54+
periodSeconds: 20
55+
name: manager
56+
readinessProbe:
57+
httpGet:
58+
path: /readyz
59+
port: 8081
60+
initialDelaySeconds: 5
61+
periodSeconds: 10
62+
resources: {{- toYaml .Values.controllerManager.manager.resources | nindent 10
63+
}}
64+
securityContext: {{- toYaml .Values.controllerManager.manager.containerSecurityContext
65+
| nindent 10 }}
66+
securityContext:
67+
runAsNonRoot: true
68+
serviceAccountName: {{ include "marklogic-operator.fullname" . }}-controller-manager
69+
terminationGracePeriodSeconds: 10
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: Role
3+
metadata:
4+
name: {{ include "marklogic-operator.fullname" . }}-leader-election-role
5+
labels:
6+
app.kubernetes.io/component: rbac
7+
app.kubernetes.io/created-by: marklogic-kubernetes-operator
8+
app.kubernetes.io/part-of: marklogic-kubernetes-operator
9+
{{- include "marklogic-operator.labels" . | nindent 4 }}
10+
rules:
11+
- apiGroups:
12+
- ""
13+
resources:
14+
- configmaps
15+
verbs:
16+
- get
17+
- list
18+
- watch
19+
- create
20+
- update
21+
- patch
22+
- delete
23+
- apiGroups:
24+
- coordination.k8s.io
25+
resources:
26+
- leases
27+
verbs:
28+
- get
29+
- list
30+
- watch
31+
- create
32+
- update
33+
- patch
34+
- delete
35+
- apiGroups:
36+
- ""
37+
resources:
38+
- events
39+
verbs:
40+
- create
41+
- patch
42+
---
43+
apiVersion: rbac.authorization.k8s.io/v1
44+
kind: RoleBinding
45+
metadata:
46+
name: {{ include "marklogic-operator.fullname" . }}-leader-election-rolebinding
47+
labels:
48+
app.kubernetes.io/component: rbac
49+
app.kubernetes.io/created-by: marklogic-kubernetes-operator
50+
app.kubernetes.io/part-of: marklogic-kubernetes-operator
51+
{{- include "marklogic-operator.labels" . | nindent 4 }}
52+
roleRef:
53+
apiGroup: rbac.authorization.k8s.io
54+
kind: Role
55+
name: '{{ include "marklogic-operator.fullname" . }}-leader-election-role'
56+
subjects:
57+
- kind: ServiceAccount
58+
name: '{{ include "marklogic-operator.fullname" . }}-controller-manager'
59+
namespace: '{{ .Release.Namespace }}'
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: {{ include "marklogic-operator.fullname" . }}-manager-role
5+
labels:
6+
{{- include "marklogic-operator.labels" . | nindent 4 }}
7+
rules:
8+
- apiGroups:
9+
- apps
10+
resources:
11+
- daemonsets
12+
- deployments
13+
- replicasets
14+
- statefulsets
15+
verbs:
16+
- create
17+
- delete
18+
- get
19+
- list
20+
- patch
21+
- update
22+
- watch
23+
- apiGroups:
24+
- ""
25+
resources:
26+
- configmaps
27+
- pods
28+
- secrets
29+
- services
30+
verbs:
31+
- create
32+
- delete
33+
- get
34+
- list
35+
- patch
36+
- update
37+
- watch
38+
- apiGroups:
39+
- database.marklogic.com
40+
resources:
41+
- marklogicclusters
42+
verbs:
43+
- create
44+
- delete
45+
- get
46+
- list
47+
- patch
48+
- update
49+
- watch
50+
- apiGroups:
51+
- database.marklogic.com
52+
resources:
53+
- marklogicclusters/finalizers
54+
verbs:
55+
- update
56+
- apiGroups:
57+
- database.marklogic.com
58+
resources:
59+
- marklogicclusters/status
60+
verbs:
61+
- get
62+
- patch
63+
- update
64+
- apiGroups:
65+
- database.marklogic.com
66+
resources:
67+
- marklogicgroups
68+
verbs:
69+
- create
70+
- delete
71+
- get
72+
- list
73+
- patch
74+
- update
75+
- watch
76+
- apiGroups:
77+
- database.marklogic.com
78+
resources:
79+
- marklogicgroups/finalizers
80+
verbs:
81+
- update
82+
- apiGroups:
83+
- database.marklogic.com
84+
resources:
85+
- marklogicgroups/status
86+
verbs:
87+
- get
88+
- patch
89+
- update
90+
---
91+
apiVersion: rbac.authorization.k8s.io/v1
92+
kind: ClusterRoleBinding
93+
metadata:
94+
name: {{ include "marklogic-operator.fullname" . }}-manager-rolebinding
95+
labels:
96+
app.kubernetes.io/component: rbac
97+
app.kubernetes.io/created-by: marklogic-kubernetes-operator
98+
app.kubernetes.io/part-of: marklogic-kubernetes-operator
99+
{{- include "marklogic-operator.labels" . | nindent 4 }}
100+
roleRef:
101+
apiGroup: rbac.authorization.k8s.io
102+
kind: ClusterRole
103+
name: '{{ include "marklogic-operator.fullname" . }}-manager-role'
104+
subjects:
105+
- kind: ServiceAccount
106+
name: '{{ include "marklogic-operator.fullname" . }}-controller-manager'
107+
namespace: '{{ .Release.Namespace }}'

0 commit comments

Comments
 (0)