Skip to content

Commit 4df3df8

Browse files
authored
Merge pull request #205 from Madhu-1/add-helm-chart
add helm charts to the repo
2 parents 9b47759 + fb8a0d6 commit 4df3df8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+15752
-0
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
run: make build-installer
3131
- name: run build multifile installer
3232
run: make build-multifile-installer
33+
- name: Generate operator helm charts
34+
run: make build-helm-installer
3335
- name: Check for uncommitted changes
3436
run: make check-all-committed
3537
- name: Show the uncommitted "git diff"

.github/workflows/test-chart.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Test Charts
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
test-operator:
8+
name: operator chart
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Clone the code
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version-file: go.mod
18+
19+
- name: set up tmate session for debugging
20+
if: ${{ failure() || runner.debug || contains(github.event.pull_request.labels.*.name, 'debug-ci') }}
21+
uses: mxschmitt/action-tmate@v3
22+
with:
23+
limit-access-to-actor: false
24+
detached: true
25+
26+
- name: Setup Minikube
27+
run: |
28+
test/scripts/github-action-helper.sh install_minikube_with_none_driver
29+
- name: print k8s cluster status
30+
run: |
31+
kubectl get nodes
32+
- name: use local disk
33+
run: test/scripts/github-action-helper.sh use_local_disk
34+
35+
- name: create ceph cluster
36+
run: test/scripts/github-action-helper.sh deploy_rook
37+
38+
- name: Prepare ceph-csi-operator
39+
run: |
40+
make docker-build
41+
42+
- name: Install Helm
43+
run: |
44+
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
45+
46+
- name: Verify Helm installation
47+
run: helm version
48+
49+
- name: Lint Helm Chart
50+
run: |
51+
helm lint ./deploy/charts/ceph-csi-operator
52+
53+
- name: Install Helm chart for project
54+
run: |
55+
helm install my-release ./deploy/charts/ceph-csi-operator --create-namespace --namespace ceph-csi-operator-system
56+
57+
- name: Check Helm release status
58+
run: |
59+
helm status my-release --namespace ceph-csi-operator-system
60+
61+
- name: Check operator is running
62+
run: |
63+
for i in {1..180}; do kubectl get pods -l app.kubernetes.io/name=ceph-csi-operator -n ceph-csi-operator-system -o jsonpath='{.items[0].status.phase}' | grep -q "Running" && exit 0 || sleep 1; done; echo "Pod not running after 3 minutes"; exit 1

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ build-installer: manifests generate kustomize ## Generate a consolidated YAML wi
196196
$(KUSTOMIZE) build build > deploy/all-in-one/install.yaml
197197
rm -rf build
198198

199+
.PHONY: build-helm-installer
200+
build-helm-installer: manifests generate kustomize helmify ## Generate helm charts for the operator.
201+
mkdir -p build deploy
202+
cd build && echo "$$BUILD_INSTALLER_OVERLAY" > kustomization.yaml
203+
cd build && $(KUSTOMIZE) edit add resource ../config/default/
204+
$(KUSTOMIZE) build build | $(HELMIFY) deploy/charts/ceph-csi-operator
205+
rm -rf build
206+
199207
.PHONY: build-multifile-installer
200208
build-multifile-installer: build-csi-rbac manifests generate kustomize
201209
mkdir -p build deploy/multifile
@@ -251,12 +259,19 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize-$(KUSTOMIZE_VERSION)
251259
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen-$(CONTROLLER_TOOLS_VERSION)
252260
ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
253261
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
262+
HELMIFY ?= $(LOCALBIN)/helmify-$(HELMIFY_VERSION)
254263

255264
## Tool Versions
256265
KUSTOMIZE_VERSION ?= v5.3.0
257266
CONTROLLER_TOOLS_VERSION ?= v0.14.0
258267
ENVTEST_VERSION ?= release-0.17
259268
GOLANGCI_LINT_VERSION ?= v1.63.4
269+
HELMIFY_VERSION ?= v0.4.18
270+
271+
.PHONY: helmify
272+
helmify: $(HELMIFY) ## Download helmify locally if necessary.
273+
$(HELMIFY): $(LOCALBIN)
274+
$(call go-install-tool,$(HELMIFY),github.com/arttor/helmify/cmd/helmify,$(HELMIFY_VERSION))
260275

261276
.PHONY: kustomize
262277
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
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: ceph-csi-operator
3+
description: A Helm chart to distribute the project ceph-csi-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.2.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.2.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 "ceph-csi-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 "ceph-csi-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 "ceph-csi-operator.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "ceph-csi-operator.labels" -}}
37+
helm.sh/chart: {{ include "ceph-csi-operator.chart" . }}
38+
{{ include "ceph-csi-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 "ceph-csi-operator.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "ceph-csi-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 "ceph-csi-operator.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "ceph-csi-operator.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: cephconnections.csi.ceph.io
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.14.0
7+
labels:
8+
{{- include "ceph-csi-operator.labels" . | nindent 4 }}
9+
spec:
10+
group: csi.ceph.io
11+
names:
12+
kind: CephConnection
13+
listKind: CephConnectionList
14+
plural: cephconnections
15+
singular: cephconnection
16+
scope: Namespaced
17+
versions:
18+
- name: v1alpha1
19+
schema:
20+
openAPIV3Schema:
21+
description: CephConnection is the Schema for the cephconnections API
22+
properties:
23+
apiVersion:
24+
description: |-
25+
APIVersion defines the versioned schema of this representation of an object.
26+
Servers should convert recognized schemas to the latest internal value, and
27+
may reject unrecognized values.
28+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
29+
type: string
30+
kind:
31+
description: |-
32+
Kind is a string value representing the REST resource this object represents.
33+
Servers may infer this from the endpoint the client submits requests to.
34+
Cannot be updated.
35+
In CamelCase.
36+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
37+
type: string
38+
metadata:
39+
type: object
40+
spec:
41+
description: CephConnectionSpec defines the desired state of CephConnection
42+
properties:
43+
monitors:
44+
items:
45+
type: string
46+
minItems: 1
47+
type: array
48+
rbdMirrorDaemonCount:
49+
minimum: 1
50+
type: integer
51+
readAffinity:
52+
description: ReadAffinitySpec capture Ceph CSI read affinity settings
53+
properties:
54+
crushLocationLabels:
55+
items:
56+
type: string
57+
minItems: 1
58+
type: array
59+
type: object
60+
required:
61+
- monitors
62+
type: object
63+
status:
64+
description: CephConnectionStatus defines the observed state of CephConnection
65+
type: object
66+
type: object
67+
served: true
68+
storage: true
69+
subresources:
70+
status: {}
71+
status:
72+
acceptedNames:
73+
kind: ""
74+
plural: ""
75+
conditions: []
76+
storedVersions: []
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: {{ include "ceph-csi-operator.fullname" . }}-cephconnection-viewer-role
5+
labels:
6+
{{- include "ceph-csi-operator.labels" . | nindent 4 }}
7+
rules:
8+
- apiGroups:
9+
- csi.ceph.io
10+
resources:
11+
- cephconnections
12+
verbs:
13+
- get
14+
- list
15+
- watch
16+
- apiGroups:
17+
- csi.ceph.io
18+
resources:
19+
- cephconnections/status
20+
verbs:
21+
- get
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: {{ include "ceph-csi-operator.fullname" . }}-cephconnections-editor-role
5+
labels:
6+
{{- include "ceph-csi-operator.labels" . | nindent 4 }}
7+
rules:
8+
- apiGroups:
9+
- csi.ceph.io
10+
resources:
11+
- cephconnections
12+
verbs:
13+
- create
14+
- delete
15+
- get
16+
- list
17+
- patch
18+
- update
19+
- watch
20+
- apiGroups:
21+
- csi.ceph.io
22+
resources:
23+
- cephconnections/status
24+
verbs:
25+
- get

0 commit comments

Comments
 (0)