Skip to content

Commit

Permalink
chore: generate zfs-operator by disabling helm labels
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinandan Purkait <[email protected]>
  • Loading branch information
Abhinandan-Purkait committed Jul 30, 2024
1 parent 2d377db commit 9ffc657
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 53 deletions.
2 changes: 1 addition & 1 deletion buildscripts/check-diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

git --no-pager diff --exit-code pkg/generated pkg/apis/ deploy/yamls
git --no-pager diff --exit-code pkg/generated pkg/apis deploy/yamls
6 changes: 5 additions & 1 deletion buildscripts/generate-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ for FILE in "$DEPLOY_YAML_DIR"/zfs.openebs.io_*; do
done

# Generate the zfs-operator.yaml using the helm chart.
helm template "$RELEASE_NAME" "$HELM_CHART_DIR" -n "$RELEASE_NAMESPACE" --set analytics.installerType="zfs-operator" > "$DEPLOY_YAML_DIR"/../zfs-operator.yaml
helm template "$RELEASE_NAME" "$HELM_CHART_DIR" -n "$RELEASE_NAMESPACE" \
--set analytics.installerType="zfs-operator" \
--set crds.zfsLocalPv.keep=false \
--set crds.csi.volumeSnapshots.keep=false \
--set enableHelmMetaLabels=false > "$DEPLOY_YAML_DIR"/../zfs-operator.yaml
7 changes: 6 additions & 1 deletion deploy/helm/charts/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ Create the name of the service account to use
Define meta labels for openebs zfs-localpv components
*/}}
{{- define "zfslocalpv.common.metaLabels" -}}
{{- if or (not (hasKey .Values "enableHelmMetaLabels")) .Values.enableHelmMetaLabels -}}
chart: {{ template "zfslocalpv.chart" . }}
heritage: {{ .Release.Service }}
{{ end -}}
openebs.io/version: {{ .Chart.AppVersion | quote }}
role: {{ .Values.role | quote }}
{{- end -}}
Expand All @@ -69,7 +71,9 @@ Create match labels for openebs zfs-localpv controller
*/}}
{{- define "zfslocalpv.zfsController.matchLabels" -}}
app: {{ .Values.zfsController.componentName | quote }}
{{ if or (not (hasKey .Values "enableHelmMetaLabels")) .Values.enableHelmMetaLabels -}}
release: {{ .Release.Name }}
{{ end -}}
component: {{ .Values.zfsController.componentName | quote }}
{{- end -}}

Expand All @@ -94,9 +98,10 @@ Create labels for openebs zfs-localpv controller
Create match labels for openebs zfs-localpv node daemon
*/}}
{{- define "zfslocalpv.zfsNode.matchLabels" -}}
name: {{ .Values.zfsNode.componentName | quote }}
name: {{ .Values.zfsNode.componentName | quote }}{{ if or (not (hasKey .Values "enableHelmMetaLabels")) .Values.enableHelmMetaLabels }}
release: {{ .Release.Name }}
{{- end -}}
{{- end -}}

{{/*
Create component labels openebs zfs-localpv node daemon
Expand Down
2 changes: 1 addition & 1 deletion deploy/helm/charts/templates/zfs-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ spec:
fieldRef:
fieldPath: metadata.namespace
- name: OPENEBS_IO_INSTALLER_TYPE
value: "{{ .Values.analytics.installerType }}"
value: "{{ if (not (hasKey .Values.analytics "installerType")) }}zfs-localpv-helm{{ else }}{{ .Values.analytics.installerType }}{{ end }}"
- name: OPENEBS_IO_ENABLE_ANALYTICS
value: "{{ .Values.analytics.enabled }}"
args :
Expand Down
4 changes: 4 additions & 0 deletions deploy/helm/charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@ crds:
volumeSnapshots:
# Install Volume Snapshot CRDs
enabled: true

# Allows adding helm specific labels to the components.
# Only useful for generating independent templates from helm.
enableHelmMetaLabels: true
49 changes: 0 additions & 49 deletions deploy/zfs-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ metadata:
name: openebs-zfs-controller-sa
namespace: kube-system
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
app: "openebs-zfs-controller"
release: openebs
component: "openebs-zfs-controller"
openebs.io/component-name: "openebs-zfs-controller"
---
Expand All @@ -40,12 +37,9 @@ metadata:
name: openebs-zfs-node-sa
namespace: kube-system
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
name: "openebs-zfs-node"
release: openebs
openebs.io/component-name: "openebs-zfs-node"
---
# Source: zfs-localpv/templates/configmap.yaml
Expand All @@ -55,12 +49,9 @@ metadata:
name: openebs-zfspv-bin
namespace: kube-system # should be the same namespace where it is getting mounted
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
name: "openebs-zfs-node"
release: openebs
openebs.io/component-name: "openebs-zfs-node"
data:
zfs: |
Expand All @@ -80,7 +71,6 @@ metadata:
annotations:
api-approved.kubernetes.io: https://github.com/kubernetes-csi/external-snapshotter/pull/814
controller-gen.kubebuilder.io/version: v0.11.3
helm.sh/resource-policy: keep

creationTimestamp: null
name: volumesnapshotclasses.snapshot.storage.k8s.io
Expand Down Expand Up @@ -231,7 +221,6 @@ metadata:
annotations:
api-approved.kubernetes.io: https://github.com/kubernetes-csi/external-snapshotter/pull/814
controller-gen.kubebuilder.io/version: v0.11.3
helm.sh/resource-policy: keep

creationTimestamp: null
name: volumesnapshotcontents.snapshot.storage.k8s.io
Expand Down Expand Up @@ -720,7 +709,6 @@ metadata:
annotations:
api-approved.kubernetes.io: https://github.com/kubernetes-csi/external-snapshotter/pull/814
controller-gen.kubebuilder.io/version: v0.11.3
helm.sh/resource-policy: keep

creationTimestamp: null
name: volumesnapshots.snapshot.storage.k8s.io
Expand Down Expand Up @@ -1110,7 +1098,6 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.0
helm.sh/resource-policy: keep

creationTimestamp: null
name: zfsbackups.zfs.openebs.io
Expand Down Expand Up @@ -1217,7 +1204,6 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.0
helm.sh/resource-policy: keep

creationTimestamp: null
name: zfsnodes.zfs.openebs.io
Expand Down Expand Up @@ -1304,7 +1290,6 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.0
helm.sh/resource-policy: keep

creationTimestamp: null
name: zfsrestores.zfs.openebs.io
Expand Down Expand Up @@ -1533,7 +1518,6 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.0
helm.sh/resource-policy: keep

creationTimestamp: null
name: zfssnapshots.zfs.openebs.io
Expand Down Expand Up @@ -1907,7 +1891,6 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.0
helm.sh/resource-policy: keep

creationTimestamp: null
name: zfsvolumes.zfs.openebs.io
Expand Down Expand Up @@ -2347,12 +2330,9 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: openebs-zfs-provisioner-role
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
app: "openebs-zfs-controller"
release: openebs
component: "openebs-zfs-controller"
openebs.io/component-name: "openebs-zfs-controller"
rules:
Expand Down Expand Up @@ -2402,12 +2382,9 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: openebs-zfs-snapshotter-role
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
app: "openebs-zfs-controller"
release: openebs
component: "openebs-zfs-controller"
openebs.io/component-name: "openebs-zfs-controller"
rules:
Expand Down Expand Up @@ -2451,12 +2428,9 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: openebs-zfs-driver-registrar-role
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
name: "openebs-zfs-node"
release: openebs
openebs.io/component-name: "openebs-zfs-node"
rules:
- apiGroups: [""]
Expand All @@ -2475,12 +2449,9 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: openebs-zfs-provisioner-binding
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
app: "openebs-zfs-controller"
release: openebs
component: "openebs-zfs-controller"
openebs.io/component-name: "openebs-zfs-controller"
subjects:
Expand All @@ -2498,12 +2469,9 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: openebs-zfs-snapshotter-binding
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
app: "openebs-zfs-controller"
release: openebs
component: "openebs-zfs-controller"
openebs.io/component-name: "openebs-zfs-controller"
subjects:
Expand All @@ -2521,12 +2489,9 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: openebs-zfs-driver-registrar-binding
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
name: "openebs-zfs-node"
release: openebs
openebs.io/component-name: "openebs-zfs-node"
subjects:
- kind: ServiceAccount
Expand All @@ -2544,31 +2509,24 @@ metadata:
name: openebs-zfs-localpv-node
namespace: kube-system
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
name: "openebs-zfs-node"
release: openebs
openebs.io/component-name: "openebs-zfs-node"
spec:
selector:
matchLabels:
name: "openebs-zfs-node"
release: openebs
updateStrategy:
rollingUpdate:
maxUnavailable: 100%
type: RollingUpdate
template:
metadata:
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
name: "openebs-zfs-node"
release: openebs
openebs.io/component-name: "openebs-zfs-node"
spec:
priorityClassName: openebs-zfs-csi-node-critical
Expand Down Expand Up @@ -2683,30 +2641,23 @@ metadata:
name: openebs-zfs-localpv-controller
namespace: kube-system
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
app: "openebs-zfs-controller"
release: openebs
component: "openebs-zfs-controller"
openebs.io/component-name: "openebs-zfs-controller"
spec:
selector:
matchLabels:
app: "openebs-zfs-controller"
release: openebs
component: "openebs-zfs-controller"
replicas: 1
template:
metadata:
labels:
chart: zfs-localpv-2.7.0-develop
heritage: Helm
openebs.io/version: "2.7.0-develop"
role: "openebs-zfs"
app: "openebs-zfs-controller"
release: openebs
component: "openebs-zfs-controller"
openebs.io/component-name: "openebs-zfs-controller"

Expand Down

0 comments on commit 9ffc657

Please sign in to comment.