From bfeeff513b8a9db9a8f7b9216a931be5f3c8974a Mon Sep 17 00:00:00 2001 From: "Giau. Tran Minh" Date: Mon, 21 Aug 2023 18:15:16 +0700 Subject: [PATCH] helm: generate chart from k8s manifest --- Makefile | 14 +++++++++++++- config/helm/kustomization.yaml | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 config/helm/kustomization.yaml diff --git a/Makefile b/Makefile index 2cc3339f..9cc853ab 100644 --- a/Makefile +++ b/Makefile @@ -181,10 +181,12 @@ $(LOCALBIN): KUSTOMIZE ?= $(LOCALBIN)/kustomize CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen ENVTEST ?= $(LOCALBIN)/setup-envtest +HELMIFY ?= $(LOCALBIN)/helmify ## Tool Versions KUSTOMIZE_VERSION ?= v5.1.1 CONTROLLER_TOOLS_VERSION ?= v0.13.0 +HELMIFY_VERSION ?= v0.4.5 KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" .PHONY: kustomize @@ -268,5 +270,15 @@ license: ## Add license headers to all files. @echo "Adding license headers to all files..." go run -mod=mod github.com/google/addlicense@latest -ignore "**/*.sql" -ignore "charts/**/*" -l apache -c "The Atlas Operator Authors." . +.PHONY: helmify +helmify: $(HELMIFY) ## Download helmify locally if necessary. If wrong version is installed, it will be overwritten. +$(HELMIFY): $(LOCALBIN) + test -s $(LOCALBIN)/helmify && $(LOCALBIN)/helmify --version | grep -q $(HELMIFY_VERSION) || \ + GOBIN=$(LOCALBIN) go install -ldflags "-X main.version=$(HELMIFY_VERSION)" github.com/arttor/helmify/cmd/helmify@$(HELMIFY_VERSION) + +.PHONY: helm +helm: manifests kustomize license helmify + $(KUSTOMIZE) build config/helm | $(HELMIFY) -crd-dir charts/atlas-operator + .PHONY: cli-gen -cli-gen: generate manifests chart-manifests license +cli-gen: generate manifests helm license diff --git a/config/helm/kustomization.yaml b/config/helm/kustomization.yaml new file mode 100644 index 00000000..bb074052 --- /dev/null +++ b/config/helm/kustomization.yaml @@ -0,0 +1,21 @@ +# Copyright 2023 The Atlas Operator Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- ../default +images: +- name: controller + newName: arigaio/atlas-operator