Skip to content

Commit

Permalink
Create a general generate_helm make target
Browse files Browse the repository at this point in the history
Signed-off-by: Keith Mattix II <[email protected]>
  • Loading branch information
keithmattix committed Oct 27, 2021
1 parent c189dce commit 08618a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 25 deletions.
26 changes: 4 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
DOCKER_REPO=nicholasjackson/smi-controller-example
DOCKER_VERSION=0.1.0
SHELL := /bin/bash
UNAME := $(shell uname)

build_docker_setup:
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
Expand All @@ -24,33 +25,14 @@ build_docker_push: build_docker_setup
--push
docker buildx rm multi || true

generate_helm_darwin: manifests
# First generate the Helm specific kustomize config that creates the RBAC and CRDs
kustomize build ./config/helm -o ./helm/smi-controller/templates

# Replace port with helm syntax, kustomize rejects Helm syntax not in quotes and this field is an integer
sed -i '' -e 's/port: 443/port: {{ .Values.webhook.port }}/' ./helm/smi-controller/templates/apiextensions.k8s.io_v1_customresourcedefinition_*.yaml

# Delete extra files
rm ./helm/smi-controller/templates/v1_service_smi-controller-controller-manager-metrics-service.yaml
rm ./helm/smi-controller/templates/v1_serviceaccount_smi-controller-controller-manager.yaml

# Now package the Helm chart into a tarball
helm package ./helm/smi-controller

# Move it to the ./docs folder used to serve Github Pages
mv smi-controller-${DOCKER_VERSION}.tgz ./docs/

# Generate the index
cd ./docs && helm repo index .


generate_helm: manifests
# First generate the Helm specific kustomize config that creates the RBAC and CRDs
kustomize build ./config/helm -o ./helm/smi-controller/templates

# Pick the correct sed -i argument based on OS (Darwin uses BSD sed, not GNU sed)
# Replace port with helm syntax, kustomize rejects Helm syntax not in quotes and this field is an integer
sed -i 's/port: 443/port: {{ .Values.webhook.port }}/' ./helm/smi-controller/templates/apiextensions.k8s.io_v1_customresourcedefinition_*.yaml
sedi=(-i) && [ "$(UNAME)" == "Darwin" ] && sedi=(-i '') ; \
sed "$${sedi[@]}" -e 's/port: 443/port: {{ .Values.webhook.port }}/' ./helm/smi-controller/templates/apiextensions.k8s.io_v1_customresourcedefinition_*.yaml

# Delete extra files
rm ./helm/smi-controller/templates/v1_service_smi-controller-controller-manager-metrics-service.yaml
Expand Down
6 changes: 3 additions & 3 deletions docs/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ entries:
smi-controller:
- apiVersion: v2
appVersion: 1.16.0
created: "2021-10-26T13:01:07.587164-05:00"
created: "2021-10-27T10:01:52.386136-05:00"
description: A Helm chart for installing the SMI Controller for Kubernetes
digest: 336c910965afcde54caeba9c66400999dff8578beef826e236dc17d24b69d011
digest: 05acf92c7bef959c26c2f7e8e71645e4fea9c9ca18d1af138bbfae54ecbfef4a
name: smi-controller
type: application
urls:
- smi-controller-0.1.0.tgz
version: 0.1.0
generated: "2021-10-26T13:01:07.585061-05:00"
generated: "2021-10-27T10:01:52.385317-05:00"
Binary file modified docs/smi-controller-0.1.0.tgz
Binary file not shown.

0 comments on commit 08618a0

Please sign in to comment.