Skip to content

Commit

Permalink
refactor!(crds): automatic CRD installation
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy17 committed Aug 19, 2024
1 parent 4a869ac commit fba144d
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 10 deletions.
2 changes: 1 addition & 1 deletion charts/greptimedb-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kubeVersion: ">=1.18.0-0"
description: The greptimedb-operator Helm chart for Kubernetes.
name: greptimedb-operator
appVersion: 0.1.0-alpha.28
version: 0.2.0
version: 0.2.1
type: application
home: https://github.com/GreptimeTeam/greptimedb-operator
sources:
Expand Down
10 changes: 8 additions & 2 deletions charts/greptimedb-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The greptimedb-operator Helm chart for Kubernetes.

![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0-alpha.28](https://img.shields.io/badge/AppVersion-0.1.0--alpha.28-informational?style=flat-square)
![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0-alpha.28](https://img.shields.io/badge/AppVersion-0.1.0--alpha.28-informational?style=flat-square)

## Source Code

Expand Down Expand Up @@ -44,7 +44,9 @@ helm upgrade \

Helm cannot upgrade custom resource definitions in the `<chart>/crds` folder [by design](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations).

You can upgrade the CRDs manually to **ensure the version of operator and CRDs are aligned**:
For deployment convenience, we choose to support **automatic CRD installation in the chart**. Yon can disable the CRD installation by using `--set crds.install=false` when installing the chart.

If you want upgrade CRDs manually, you can use the following steps(**ensure the version of operator and CRDs are aligned**):

- If your `helm-charts` repository is already up-to-date, you can upgrade the CRDs by the following command:

Expand Down Expand Up @@ -73,6 +75,10 @@ Kubernetes: `>=1.18.0-0`
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | The pod affinity |
| crds.additionalLabels | object | `{}` | Addtional labels to be added to all CRDs |
| crds.annotations | object | `{}` | Annotations to be added to all CRDs |
| crds.install | bool | `true` | Install and upgrade CRDs |
| crds.keep | bool | `true` | Keep CRDs on chart uninstall |
| fullnameOverride | string | `""` | Provide a name to substitute for the full names of resources |
| image.imagePullPolicy | string | `"IfNotPresent"` | The image pull policy for the controller |
| image.pullSecrets | list | `[]` | The image pull secrets |
Expand Down
4 changes: 3 additions & 1 deletion charts/greptimedb-operator/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ helm upgrade \

Helm cannot upgrade custom resource definitions in the `<chart>/crds` folder [by design](https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations).

You can upgrade the CRDs manually to **ensure the version of operator and CRDs are aligned**:
For deployment convenience, we choose to support **automatic CRD installation in the chart**. Yon can disable the CRD installation by using `--set crds.install=false` when installing the chart.

If you want upgrade CRDs manually, you can use the following steps(**ensure the version of operator and CRDs are aligned**):

- If your `helm-charts` repository is already up-to-date, you can upgrade the CRDs by the following command:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
---
{{- if .Values.crds.install }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
creationTimestamp: null
{{- if .Values.crds.keep }}
"helm.sh/resource-policy": keep
{{- end }}
{{- with .Values.crds.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- if .Values.crds.additionalLabels }}
{{- toYaml .Values.crds.additionalLabels | nindent 4 }}
{{- end }}
name: greptimedbclusters.greptime.io
spec:
group: greptime.io
Expand Down Expand Up @@ -13491,3 +13499,4 @@ spec:
storage: true
subresources:
status: {}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
---
{{- if .Values.crds.install }}
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.9.0
creationTimestamp: null
{{- if .Values.crds.keep }}
"helm.sh/resource-policy": keep
{{- end }}
{{- with .Values.crds.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- if .Values.crds.additionalLabels }}
{{- toYaml .Values.crds.additionalLabels | nindent 4 }}
{{- end }}
name: greptimedbstandalones.greptime.io
spec:
group: greptime.io
Expand Down Expand Up @@ -2832,3 +2840,4 @@ spec:
storage: true
subresources:
status: {}
{{- end }}
11 changes: 11 additions & 0 deletions charts/greptimedb-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name: ""

## Custom resource configuration
crds:
# -- Install and upgrade CRDs
install: true
# -- Keep CRDs on chart uninstall
keep: true
# -- Annotations to be added to all CRDs
annotations: {}
# -- Addtional labels to be added to all CRDs
additionalLabels: {}

# -- Number of replicas for the greptimedb operator
replicas: 1

Expand Down

0 comments on commit fba144d

Please sign in to comment.