This is an automated email from the ASF dual-hosted git repository. caigy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/rocketmq-operator.git
The following commit(s) were added to refs/heads/master by this push: new 0ccad32 [ISSUE #196] enhance chart generate by helmify (#212) 0ccad32 is described below commit 0ccad322b782617b26b5167a8ed3d750c1a8eec2 Author: yangw <wuyang...@gmail.com> AuthorDate: Sun Feb 4 16:36:11 2024 +0800 [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 --- Makefile | 10 ++-- charts/rocketmq-operator/Chart.yaml | 3 - charts/rocketmq-operator/templates/NOTES.txt | 4 -- charts/rocketmq-operator/templates/deployment.yaml | 56 +++++++++++++++++++ charts/rocketmq-operator/templates/operator.yaml | 65 ---------------------- .../{role.yaml => rocketmq-operator-rbac.yaml} | 36 ++++++------ .../rocketmq-operator/templates/role_binding.yaml | 29 ---------- .../templates/service_account.yaml | 19 ------- .../templates/serviceaccount.yaml | 8 +++ charts/rocketmq-operator/values.yaml | 38 ++++++------- 10 files changed, 102 insertions(+), 166 deletions(-) diff --git a/Makefile b/Makefile index 8bcfc9a..00277b4 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,8 @@ IMG ?= controller:latest # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.22 +OPERATOR_CHART_DIR ?= charts/rocketmq-operator + # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) GOBIN=$(shell go env GOPATH)/bin @@ -80,12 +82,8 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust $(CONTROLLER_GEN) rbac:roleName=rocketmq-operator crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:dir=deploy output:crd:artifacts:config=deploy/crds head -n 14 deploy/role_binding.yaml > deploy/role.yaml.bak cat deploy/role.yaml >> deploy/role.yaml.bak - rm deploy/role.yaml && mv deploy/role.yaml.bak deploy/role.yaml && \ - cp deploy/role.yaml charts/rocketmq-operator/templates/role.yaml && \ - cp deploy/operator.yaml charts/rocketmq-operator/templates/operator.yaml && \ - cp deploy/role_binding.yaml charts/rocketmq-operator/templates/role_binding.yaml && \ - cp deploy/service_account.yaml charts/rocketmq-operator/templates/service_account.yaml && \ - cp deploy/crds/* charts/rocketmq-operator/crds/ + rm deploy/role.yaml && mv deploy/role.yaml.bak deploy/role.yaml + mkdir -p $(OPERATOR_CHART_DIR)/crds/ && cp deploy/crds/* $(OPERATOR_CHART_DIR)/crds/ .PHONY: generate generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. diff --git a/charts/rocketmq-operator/Chart.yaml b/charts/rocketmq-operator/Chart.yaml index 09af01c..4b82a30 100644 --- a/charts/rocketmq-operator/Chart.yaml +++ b/charts/rocketmq-operator/Chart.yaml @@ -1,7 +1,6 @@ apiVersion: v2 name: rocketmq-operator description: A Helm chart for Kubernetes - # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives @@ -11,12 +10,10 @@ description: A Helm chart for Kubernetes # a dependency of application charts to inject those utilities and functions into the rendering # pipeline. Library charts do not define any templates and therefore cannot be deployed. type: application - # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) version: 0.1.0 - # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. diff --git a/charts/rocketmq-operator/templates/NOTES.txt b/charts/rocketmq-operator/templates/NOTES.txt deleted file mode 100644 index a134945..0000000 --- a/charts/rocketmq-operator/templates/NOTES.txt +++ /dev/null @@ -1,4 +0,0 @@ -Your release is named {{ .Release.Name }}. To check the status of the release, run: - - $ kubectl -n {{ .Release.Namespace }} get pods -l "name=rocketmq-operator" - diff --git a/charts/rocketmq-operator/templates/deployment.yaml b/charts/rocketmq-operator/templates/deployment.yaml new file mode 100644 index 0000000..c33b1c3 --- /dev/null +++ b/charts/rocketmq-operator/templates/deployment.yaml @@ -0,0 +1,56 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "rocketmq-operator.fullname" . }} + labels: + {{- include "rocketmq-operator.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.rocketmqOperator.replicas }} + selector: + matchLabels: + name: rocketmq-operator + {{- include "rocketmq-operator.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + name: rocketmq-operator + {{- include "rocketmq-operator.selectorLabels" . | nindent 8 }} + spec: + containers: + - args: {{- toYaml .Values.rocketmqOperator.manager.args | nindent 8 }} + command: + - /manager + env: + - name: WATCH_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: {{ quote .Values.rocketmqOperator.manager.env.operatorName }} + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ quote .Values.kubernetesClusterDomain }} + image: {{ .Values.rocketmqOperator.manager.image.repository }}:{{ .Values.rocketmqOperator.manager.image.tag + | default .Chart.AppVersion }} + imagePullPolicy: {{ .Values.rocketmqOperator.manager.imagePullPolicy }} + livenessProbe: + httpGet: + path: /healthz + port: 8081 + initialDelaySeconds: 15 + periodSeconds: 20 + name: manager + readinessProbe: + httpGet: + path: /readyz + port: 8081 + initialDelaySeconds: 5 + periodSeconds: 10 + resources: {} + securityContext: {{- toYaml .Values.rocketmqOperator.manager.containerSecurityContext + | nindent 10 }} + serviceAccountName: {{ include "rocketmq-operator.fullname" . }} + terminationGracePeriodSeconds: 10 \ No newline at end of file diff --git a/charts/rocketmq-operator/templates/operator.yaml b/charts/rocketmq-operator/templates/operator.yaml deleted file mode 100644 index 42da5bb..0000000 --- a/charts/rocketmq-operator/templates/operator.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: rocketmq-operator -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - name: rocketmq-operator - template: - metadata: - labels: - name: rocketmq-operator - spec: - serviceAccountName: rocketmq-operator - terminationGracePeriodSeconds: 10 - containers: - - name: manager - # Replace this with the built image name - image: {{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }} - command: - - /manager - args: - - --leader-elect - imagePullPolicy: {{ .Values.image.pullPolicy }} - securityContext: - allowPrivilegeEscalation: false - livenessProbe: - httpGet: - path: /healthz - port: 8081 - initialDelaySeconds: 15 - periodSeconds: 20 - readinessProbe: - httpGet: - path: /readyz - port: 8081 - initialDelaySeconds: 5 - periodSeconds: 10 - env: - - name: WATCH_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: OPERATOR_NAME - value: "rocketmq-operator" diff --git a/charts/rocketmq-operator/templates/role.yaml b/charts/rocketmq-operator/templates/rocketmq-operator-rbac.yaml similarity index 77% rename from charts/rocketmq-operator/templates/role.yaml rename to charts/rocketmq-operator/templates/rocketmq-operator-rbac.yaml index f9531a7..f828ace 100644 --- a/charts/rocketmq-operator/templates/role.yaml +++ b/charts/rocketmq-operator/templates/rocketmq-operator-rbac.yaml @@ -1,24 +1,9 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - ---- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - creationTimestamp: null - name: rocketmq-operator + name: {{ include "rocketmq-operator.fullname" . }} + labels: + {{- include "rocketmq-operator.labels" . | nindent 4 }} rules: - apiGroups: - "" @@ -241,3 +226,18 @@ rules: - get - patch - update +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "rocketmq-operator.fullname" . }} + labels: + {{- include "rocketmq-operator.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: '{{ include "rocketmq-operator.fullname" . }}' +subjects: +- kind: ServiceAccount + name: '{{ include "rocketmq-operator.fullname" . }}' + namespace: '{{ .Release.Namespace }}' \ No newline at end of file diff --git a/charts/rocketmq-operator/templates/role_binding.yaml b/charts/rocketmq-operator/templates/role_binding.yaml deleted file mode 100644 index fc8ce95..0000000 --- a/charts/rocketmq-operator/templates/role_binding.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: {{ include "rocketmq-operator.fullname" . }} - labels: - {{- include "rocketmq-operator.labels" . | nindent 4 }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: {{ template "rocketmq-operator.fullname" . }} -subjects: - - name: {{ template "rocketmq-operator.serviceAccountName" . }} - namespace: {{ .Release.Namespace | quote }} - kind: ServiceAccount \ No newline at end of file diff --git a/charts/rocketmq-operator/templates/service_account.yaml b/charts/rocketmq-operator/templates/service_account.yaml deleted file mode 100644 index 8f1a58f..0000000 --- a/charts/rocketmq-operator/templates/service_account.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ template "rocketmq-operator.serviceAccountName" . }} diff --git a/charts/rocketmq-operator/templates/serviceaccount.yaml b/charts/rocketmq-operator/templates/serviceaccount.yaml new file mode 100644 index 0000000..6527f6a --- /dev/null +++ b/charts/rocketmq-operator/templates/serviceaccount.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "rocketmq-operator.fullname" . }} + labels: + {{- include "rocketmq-operator.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.rocketmqOperator.serviceAccount.annotations | nindent 4 }} \ No newline at end of file diff --git a/charts/rocketmq-operator/values.yaml b/charts/rocketmq-operator/values.yaml index 282ec24..0ed3555 100644 --- a/charts/rocketmq-operator/values.yaml +++ b/charts/rocketmq-operator/values.yaml @@ -1,22 +1,16 @@ -# Default values for rocketmq-operator. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - registry: docker.io - repository: apache/rocketmq-operator - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: latest - -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: true - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" \ No newline at end of file +kubernetesClusterDomain: cluster.local +rocketmqOperator: + manager: + args: + - --leader-elect + containerSecurityContext: + allowPrivilegeEscalation: false + env: + operatorName: rocketmq-operator + image: + repository: apache/rocketmq-operator + tag: latest + imagePullPolicy: IfNotPresent + replicas: 1 + serviceAccount: + annotations: {}