Skip to content

Commit 0ccad32

Browse files
authored
[ISSUE #196] enhance chart generate by helmify (#212)
* delete old chart * add helmify target * generate chart by `make manifest` * upgrade appVersion * remove helmify bundle * remove redundant suffix * fix typo
1 parent 455dc24 commit 0ccad32

File tree

10 files changed

+102
-166
lines changed

10 files changed

+102
-166
lines changed

Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ IMG ?= controller:latest
4040
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
4141
ENVTEST_K8S_VERSION = 1.22
4242

43+
OPERATOR_CHART_DIR ?= charts/rocketmq-operator
44+
4345
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
4446
ifeq (,$(shell go env GOBIN))
4547
GOBIN=$(shell go env GOPATH)/bin
@@ -80,12 +82,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
8082
$(CONTROLLER_GEN) rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:dir=deploy output:crd:artifacts:config=deploy/crds
8183
head -n 14 deploy/role_binding.yaml > deploy/role.yaml.bak
8284
cat deploy/role.yaml >> deploy/role.yaml.bak
83-
rm deploy/role.yaml && mv deploy/role.yaml.bak deploy/role.yaml && \
84-
cp deploy/role.yaml charts/rocketmq-operator/templates/role.yaml && \
85-
cp deploy/operator.yaml charts/rocketmq-operator/templates/operator.yaml && \
86-
cp deploy/role_binding.yaml charts/rocketmq-operator/templates/role_binding.yaml && \
87-
cp deploy/service_account.yaml charts/rocketmq-operator/templates/service_account.yaml && \
88-
cp deploy/crds/* charts/rocketmq-operator/crds/
85+
rm deploy/role.yaml && mv deploy/role.yaml.bak deploy/role.yaml
86+
mkdir -p $(OPERATOR_CHART_DIR)/crds/ && cp deploy/crds/* $(OPERATOR_CHART_DIR)/crds/
8987

9088
.PHONY: generate
9189
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.

charts/rocketmq-operator/Chart.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
apiVersion: v2
22
name: rocketmq-operator
33
description: A Helm chart for Kubernetes
4-
54
# A chart can be either an 'application' or a 'library' chart.
65
#
76
# Application charts are a collection of templates that can be packaged into versioned archives
@@ -11,12 +10,10 @@ description: A Helm chart for Kubernetes
1110
# a dependency of application charts to inject those utilities and functions into the rendering
1211
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
1312
type: application
14-
1513
# This is the chart version. This version number should be incremented each time you make changes
1614
# to the chart and its templates, including the app version.
1715
# Versions are expected to follow Semantic Versioning (https://semver.org/)
1816
version: 0.1.0
19-
2017
# This is the version number of the application being deployed. This version number should be
2118
# incremented each time you make changes to the application. Versions are not expected to
2219
# follow Semantic Versioning. They should reflect the version the application is using.

charts/rocketmq-operator/templates/NOTES.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "rocketmq-operator.fullname" . }}
5+
labels:
6+
{{- include "rocketmq-operator.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.rocketmqOperator.replicas }}
9+
selector:
10+
matchLabels:
11+
name: rocketmq-operator
12+
{{- include "rocketmq-operator.selectorLabels" . | nindent 6 }}
13+
template:
14+
metadata:
15+
labels:
16+
name: rocketmq-operator
17+
{{- include "rocketmq-operator.selectorLabels" . | nindent 8 }}
18+
spec:
19+
containers:
20+
- args: {{- toYaml .Values.rocketmqOperator.manager.args | nindent 8 }}
21+
command:
22+
- /manager
23+
env:
24+
- name: WATCH_NAMESPACE
25+
valueFrom:
26+
fieldRef:
27+
fieldPath: metadata.namespace
28+
- name: POD_NAME
29+
valueFrom:
30+
fieldRef:
31+
fieldPath: metadata.name
32+
- name: OPERATOR_NAME
33+
value: {{ quote .Values.rocketmqOperator.manager.env.operatorName }}
34+
- name: KUBERNETES_CLUSTER_DOMAIN
35+
value: {{ quote .Values.kubernetesClusterDomain }}
36+
image: {{ .Values.rocketmqOperator.manager.image.repository }}:{{ .Values.rocketmqOperator.manager.image.tag
37+
| default .Chart.AppVersion }}
38+
imagePullPolicy: {{ .Values.rocketmqOperator.manager.imagePullPolicy }}
39+
livenessProbe:
40+
httpGet:
41+
path: /healthz
42+
port: 8081
43+
initialDelaySeconds: 15
44+
periodSeconds: 20
45+
name: manager
46+
readinessProbe:
47+
httpGet:
48+
path: /readyz
49+
port: 8081
50+
initialDelaySeconds: 5
51+
periodSeconds: 10
52+
resources: {}
53+
securityContext: {{- toYaml .Values.rocketmqOperator.manager.containerSecurityContext
54+
| nindent 10 }}
55+
serviceAccountName: {{ include "rocketmq-operator.fullname" . }}
56+
terminationGracePeriodSeconds: 10

charts/rocketmq-operator/templates/operator.yaml

Lines changed: 0 additions & 65 deletions
This file was deleted.

charts/rocketmq-operator/templates/role.yaml renamed to charts/rocketmq-operator/templates/rocketmq-operator-rbac.yaml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
1-
# Licensed to the Apache Software Foundation (ASF) under one or more
2-
# contributor license agreements. See the NOTICE file distributed with
3-
# this work for additional information regarding copyright ownership.
4-
# The ASF licenses this file to You under the Apache License, Version 2.0
5-
# (the "License"); you may not use this file except in compliance with
6-
# the License. You may obtain a copy of the License at
7-
#
8-
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
10-
# Unless required by applicable law or agreed to in writing, software
11-
# distributed under the License is distributed on an "AS IS" BASIS,
12-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
# See the License for the specific language governing permissions and
14-
# limitations under the License.
15-
16-
---
171
apiVersion: rbac.authorization.k8s.io/v1
182
kind: ClusterRole
193
metadata:
20-
creationTimestamp: null
21-
name: rocketmq-operator
4+
name: {{ include "rocketmq-operator.fullname" . }}
5+
labels:
6+
{{- include "rocketmq-operator.labels" . | nindent 4 }}
227
rules:
238
- apiGroups:
249
- ""
@@ -241,3 +226,18 @@ rules:
241226
- get
242227
- patch
243228
- update
229+
---
230+
apiVersion: rbac.authorization.k8s.io/v1
231+
kind: ClusterRoleBinding
232+
metadata:
233+
name: {{ include "rocketmq-operator.fullname" . }}
234+
labels:
235+
{{- include "rocketmq-operator.labels" . | nindent 4 }}
236+
roleRef:
237+
apiGroup: rbac.authorization.k8s.io
238+
kind: ClusterRole
239+
name: '{{ include "rocketmq-operator.fullname" . }}'
240+
subjects:
241+
- kind: ServiceAccount
242+
name: '{{ include "rocketmq-operator.fullname" . }}'
243+
namespace: '{{ .Release.Namespace }}'

charts/rocketmq-operator/templates/role_binding.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

charts/rocketmq-operator/templates/service_account.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: {{ include "rocketmq-operator.fullname" . }}
5+
labels:
6+
{{- include "rocketmq-operator.labels" . | nindent 4 }}
7+
annotations:
8+
{{- toYaml .Values.rocketmqOperator.serviceAccount.annotations | nindent 4 }}
Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
# Default values for rocketmq-operator.
2-
# This is a YAML-formatted file.
3-
# Declare variables to be passed into your templates.
4-
5-
replicaCount: 1
6-
7-
image:
8-
registry: docker.io
9-
repository: apache/rocketmq-operator
10-
pullPolicy: IfNotPresent
11-
# Overrides the image tag whose default is the chart appVersion.
12-
tag: latest
13-
14-
nameOverride: ""
15-
fullnameOverride: ""
16-
17-
serviceAccount:
18-
# Specifies whether a service account should be created
19-
create: true
20-
# The name of the service account to use.
21-
# If not set and create is true, a name is generated using the fullname template
22-
name: ""
1+
kubernetesClusterDomain: cluster.local
2+
rocketmqOperator:
3+
manager:
4+
args:
5+
- --leader-elect
6+
containerSecurityContext:
7+
allowPrivilegeEscalation: false
8+
env:
9+
operatorName: rocketmq-operator
10+
image:
11+
repository: apache/rocketmq-operator
12+
tag: latest
13+
imagePullPolicy: IfNotPresent
14+
replicas: 1
15+
serviceAccount:
16+
annotations: {}

0 commit comments

Comments
 (0)