Skip to content

Commit

Permalink
Don't install kubedb-catalog crds by default
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Jan 27, 2024
1 parent 1c9c709 commit 2c89d4e
Show file tree
Hide file tree
Showing 29 changed files with 50 additions and 1 deletion.
1 change: 1 addition & 0 deletions apis/installer/v1alpha1/kubedb_catalog_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type KubedbCatalogSpec struct {
Proxies RegistryProxies `json:"proxies"`
FeatureGates map[string]bool `json:"featureGates"`
Psp PSP `json:"psp"`
InstallCRDs bool `json:"installCRDs"`
SkipDeprecated bool `json:"skipDeprecated"`
}

Expand Down
4 changes: 4 additions & 0 deletions catalog/kubedb/fmt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,10 @@ func main() {

{
// move new_templates to templates
err = os.Rename(filepath.Join(dir, "charts", "kubedb-catalog", "templates", "crds.yaml"), filepath.Join(dir, "charts", "kubedb-catalog", "new_templates", "crds.yaml"))
if err != nil {
panic(err)
}
err = os.Rename(filepath.Join(dir, "charts", "kubedb-catalog", "templates", "_helpers.tpl"), filepath.Join(dir, "charts", "kubedb-catalog", "new_templates", "_helpers.tpl"))
if err != nil {
panic(err)
Expand Down
1 change: 1 addition & 0 deletions charts/kubedb-catalog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ The following table lists the configurable parameters of the `kubedb-catalog` ch
| psp.redis.privileged | | <code>false</code> |
| psp.kafka.allowPrivilegeEscalation | | <code>false</code> |
| psp.kafka.privileged | | <code>false</code> |
| installCRDs | Set true to install CRDs | <code>false</code> |
| skipDeprecated | Set true to avoid deploying deprecated versions | <code>true</code> |


Expand Down
1 change: 1 addition & 0 deletions charts/kubedb-catalog/ci/ci-values.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# https://github.com/helm/charts/blob/master/test/README.md#providing-custom-test-values
installCRDs: true
skipDeprecated: false
33 changes: 33 additions & 0 deletions charts/kubedb-catalog/templates/crds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{ $featureGates := .Values.featureGates }}
{{- if .Values.global }}
{{ $featureGates = mergeOverwrite dict .Values.featureGates .Values.global.featureGates }}
{{- end }}

{{- if .Values.installCRDs }}

{{ $overrides := printf `
metadata:
annotations:
"helm.sh/hook": pre-install,pre-upgrade,pre-rollback
` | fromYaml }}
{{- range $db, $enabled := $featureGates }}
{{- if $enabled }}
{{- $path := printf "files/crds/catalog.kubedb.com_%sversions.yaml" ($db | lower) }}
{{- $crd := $.Files.Get $path | fromYaml }}
{{- $crd = mergeOverwrite $crd $overrides }}
{{- $crd | toYaml }}
---
{{ if eq $db "Kafka" }}
{{ $path := "files/crds/catalog.kubedb.com_kafkaconnectorversions.yaml" }}
{{- $crd := $.Files.Get $path | fromYaml }}
{{- $crd = mergeOverwrite $crd $overrides }}
{{- $crd | toYaml }}
---
{{ end }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/kubedb-catalog/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ properties:
type: object
fullnameOverride:
type: string
installCRDs:
type: boolean
nameOverride:
type: string
proxies:
Expand Down Expand Up @@ -136,6 +138,7 @@ properties:
type: boolean
required:
- featureGates
- installCRDs
- psp
- skipDeprecated
type: object
3 changes: 3 additions & 0 deletions charts/kubedb-catalog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,8 @@ psp:
allowPrivilegeEscalation: false
privileged: false

# Set true to install CRDs
installCRDs: false

# Set true to avoid deploying deprecated versions
skipDeprecated: true
3 changes: 3 additions & 0 deletions charts/kubedb/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,8 @@ properties:
type: object
fullnameOverride:
type: string
installCRDs:
type: boolean
nameOverride:
type: string
proxies:
Expand Down Expand Up @@ -1666,6 +1668,7 @@ properties:
required:
- enabled
- featureGates
- installCRDs
- psp
- skipDeprecated
type: object
Expand Down
2 changes: 1 addition & 1 deletion hack/scripts/import-crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ if [ "$update_kubedb_crds" = true ] && [ -d ${crd_dir} ]; then

crd-importer \
--input=${crd_dir} \
--out=./charts/kubedb-catalog/crds \
--out=./charts/kubedb-catalog/files/crds \
--group=catalog.kubedb.com

crd-importer \
Expand Down

0 comments on commit 2c89d4e

Please sign in to comment.