Skip to content

Commit

Permalink
Move CRDs into templates
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed May 10, 2024
1 parent 55c615e commit c53c341
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 5 deletions.
8 changes: 4 additions & 4 deletions chart/openfaas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,24 @@ kubectl apply -f ./faas-netes/namespaces.yml
kubectl apply -f ./faas-netes/artifacts/crds/
```

Now, your application team can install OpenFaaS with a Role instead of a ClusterRole. They will also need to pass the `--skip-crds` flag to the helm command.
Now, your application team can install OpenFaaS with a Role instead of a ClusterRole, along with the `skipCRDs` flag.

*values-role.yaml*

```yaml
clusterRole: false
skipCRDs: true
```
Next, your application team can update and upgrade OpenFaaS using the chart by adding `--skip-crds` to the `helm` command, along with `-f values-role.yaml`, for example:
Next, your application team can update and upgrade OpenFaaS using the chart by adding `-f values-role.yaml` to the `helm upgrade` command.

```bash
helm repo update \
&& helm upgrade openfaas \
--install openfaas/openfaas \
--namespace openfaas \
-f values-pro.yaml \
-f values-role.yaml \
--skip-crds
-f values-role.yaml
```

## Test changes for the helm chart
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if .Values.createCRDs }}

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -75,3 +77,5 @@ spec:
served: true
storage: true
subresources: {}

{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if .Values.createCRDs }}

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -96,3 +98,6 @@ spec:
served: true
storage: true
subresources: {}


{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if .Values.createCRDs }}

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -92,3 +94,6 @@ spec:
served: true
storage: true
subresources: {}


{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if .Values.createCRDs }}

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -124,3 +126,6 @@ spec:
served: true
storage: true
subresources: {}


{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if .Values.createCRDs }}

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -196,3 +198,6 @@ spec:
storage: true
subresources:
status: {}


{{- end }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if .Values.createCRDs }}

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down Expand Up @@ -1432,3 +1434,5 @@ spec:
type: string
served: true
storage: true

{{- end }}
7 changes: 6 additions & 1 deletion hack/update-crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ fi
paths=./pkg/apis/... \
output:dir=./artifacts/crds

echo "Run \"cp ./artifacts/crds/* ./chart/openfaas/crds/\" to sync with the chart"

@for f in ./artifacts/crds/*.yaml; do \
echo "Annotating helm.sh/resource-policy: keep to: $$f"; \
kubectl annotate --overwrite -f $$f --local=true -o yaml helm.sh/resource-policy: keep
done

0 comments on commit c53c341

Please sign in to comment.