From 5b4f17f4df17ba4376c50447744e0eae903dccef Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Mon, 13 May 2024 09:27:57 +0100 Subject: [PATCH] Move IAM CRDs back up one level and add README Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- chart/openfaas/crds/README.md | 37 +++++++++++++++++++ .../iam.openfaas.com_jwtissuers.yaml} | 4 -- .../iam.openfaas.com_policies.yaml} | 4 -- .../iam.openfaas.com_roles.yaml} | 4 -- 4 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 chart/openfaas/crds/README.md rename chart/openfaas/{templates/iam.openfaas.com_jwtissuers-crd.yaml => crds/iam.openfaas.com_jwtissuers.yaml} (98%) rename chart/openfaas/{templates/iam.openfaas.com_policies-crd.yaml => crds/iam.openfaas.com_policies.yaml} (98%) rename chart/openfaas/{templates/iam.openfaas.com_roles-crd.yaml => crds/iam.openfaas.com_roles.yaml} (98%) diff --git a/chart/openfaas/crds/README.md b/chart/openfaas/crds/README.md new file mode 100644 index 000000000..b77e613f3 --- /dev/null +++ b/chart/openfaas/crds/README.md @@ -0,0 +1,37 @@ +# CRDs + +CRDs are installed by Helm in two ways, there is also a static copy of the CRDs that can be applied via `kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/artifacts/crds/crds.yaml`. + +## 1. The `crds` folder + +CRDs in the ./crds folder are installed once by Helm before installing the chart. This is required for the IAM CRDs because IAM CRs are created by the chart during the installation. If these CRDs change, you will have to apply them manually. + +To suppress installation of type 1 CRDs, add `--skip-crds` to the helm command. + +To update these CRDs, clone the faas-netes repository, and apply the files within the ./chart/openfaas/crds folder. + +```sh +git clone https://github.com/openfaas/faas-netes --depth=1 +cd faas-netes +kubectl apply -f ./chart/openfaas/crds/ +``` + +## 2. CRDs in templates + +CRDs in the ./templates folder are installed initially, then upgraded on each update of the chart. This has the advantage of updating CRDs like the Function CRD when the chart is updated, without having to run manual actions. + +To suppress installation of type 2 CRDs, add `--set skipCRDs=true` to the helm command. + +To update CRDs in the templates folder, run a normal helm install/upgrade. + +To install only the CRDs in the templates folder, on their own for a split installation, run: + +```sh +git clone https://github.com/openfaas/faas-netes --depth=1 +cd faas-netes +helm template ./chart/openfaas --set skipCRDs=false \ + --show-only templates/*-crd.yaml > templates-crds.yaml +``` + +You can then apply `templates-crds.yaml` as required. + diff --git a/chart/openfaas/templates/iam.openfaas.com_jwtissuers-crd.yaml b/chart/openfaas/crds/iam.openfaas.com_jwtissuers.yaml similarity index 98% rename from chart/openfaas/templates/iam.openfaas.com_jwtissuers-crd.yaml rename to chart/openfaas/crds/iam.openfaas.com_jwtissuers.yaml index 79115d60d..a70b365b7 100644 --- a/chart/openfaas/templates/iam.openfaas.com_jwtissuers-crd.yaml +++ b/chart/openfaas/crds/iam.openfaas.com_jwtissuers.yaml @@ -1,5 +1,3 @@ -{{- if .Values.createCRDs }} - apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -77,5 +75,3 @@ spec: served: true storage: true subresources: {} - -{{- end }} \ No newline at end of file diff --git a/chart/openfaas/templates/iam.openfaas.com_policies-crd.yaml b/chart/openfaas/crds/iam.openfaas.com_policies.yaml similarity index 98% rename from chart/openfaas/templates/iam.openfaas.com_policies-crd.yaml rename to chart/openfaas/crds/iam.openfaas.com_policies.yaml index 31a81659f..aa4e9a282 100644 --- a/chart/openfaas/templates/iam.openfaas.com_policies-crd.yaml +++ b/chart/openfaas/crds/iam.openfaas.com_policies.yaml @@ -1,5 +1,3 @@ -{{- if .Values.createCRDs }} - apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -93,5 +91,3 @@ spec: served: true storage: true subresources: {} - -{{- end }} \ No newline at end of file diff --git a/chart/openfaas/templates/iam.openfaas.com_roles-crd.yaml b/chart/openfaas/crds/iam.openfaas.com_roles.yaml similarity index 98% rename from chart/openfaas/templates/iam.openfaas.com_roles-crd.yaml rename to chart/openfaas/crds/iam.openfaas.com_roles.yaml index 9f4e0bcff..cf5ce584e 100644 --- a/chart/openfaas/templates/iam.openfaas.com_roles-crd.yaml +++ b/chart/openfaas/crds/iam.openfaas.com_roles.yaml @@ -1,5 +1,3 @@ -{{- if .Values.createCRDs }} - apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: @@ -84,5 +82,3 @@ spec: served: true storage: true subresources: {} - -{{- end }} \ No newline at end of file