-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v0.13.1' into main
- Loading branch information
Showing
10 changed files
with
75 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ RUN make compile-generic | |
FROM gcr.io/distroless/static:nonroot | ||
LABEL maintainer="[email protected]" \ | ||
NAME="k8s-service-discovery" \ | ||
VERSION="0.13.0" | ||
VERSION="0.13.1" | ||
|
||
WORKDIR / | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ kind: Dogu | |
metadata: | ||
name: NAME | ||
labels: | ||
dogu: NAME | ||
app: ces | ||
spec: | ||
name: NAMESPACE/NAME | ||
version: VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
apiVersion: v2 | ||
name: replaceme | ||
version: 0.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,11 @@ endif | |
|
||
BINARY_YQ = $(UTILITY_BIN_PATH)/yq | ||
BINARY_HELM = $(UTILITY_BIN_PATH)/helm | ||
BINARY_HELM_VERSION?=v3.12.0-dev.1.0.20230817154107-a749b663101d | ||
BINARY_HELM_ADDITIONAL_PUSH_ARGS?=--plain-http | ||
BINARY_HELM_ADDITIONAL_PACK_ARGS?= | ||
BINARY_HELM_ADDITIONAL_UNINST_ARGS?= | ||
BINARY_HELM_ADDITIONAL_UPGR_ARGS?= | ||
|
||
# The productive tag of the image | ||
IMAGE ?= | ||
|
@@ -22,6 +27,8 @@ K8S_RESOURCE_TEMP_FOLDER ?= $(TARGET_DIR)/make/k8s | |
K8S_RESOURCE_TEMP_YAML ?= $(K8S_RESOURCE_TEMP_FOLDER)/$(ARTIFACT_ID)_$(VERSION).yaml | ||
K8S_HELM_TARGET ?= $(K8S_RESOURCE_TEMP_FOLDER)/helm | ||
K8S_HELM_RESSOURCES ?= k8s/helm | ||
K8S_HELM_RELEASE_TGZ=${K8S_HELM_TARGET}/${ARTIFACT_ID}-${VERSION}.tgz | ||
K8S_HELM_TARGET_DEP_DIR=charts | ||
|
||
##@ K8s - Variables | ||
|
||
|
@@ -79,9 +86,9 @@ k8s-apply: k8s-generate $(K8S_POST_GENERATE_TARGETS) ## Applies all generated K8 | |
@kubectl apply -f $(K8S_RESOURCE_TEMP_YAML) --namespace=${NAMESPACE} | ||
|
||
##@ K8s - Helm general | ||
|
||
${K8S_HELM_RESSOURCES}/Chart.yaml: ${BINARY_HELM} ## Creates the Chart.yaml-template if missing | ||
@echo "Create Chart.yaml..." | ||
.PHONY: k8s-helm-init-chart | ||
k8s-helm-init-chart: ${BINARY_HELM} ## Creates a Chart.yaml-template with zero values | ||
@echo "Initialize ${K8S_HELM_RESSOURCES}/Chart.yaml..." | ||
@mkdir -p ${K8S_HELM_RESSOURCES}/tmp/ | ||
@${BINARY_HELM} create ${K8S_HELM_RESSOURCES}/tmp/${ARTIFACT_ID} | ||
@cp ${K8S_HELM_RESSOURCES}/tmp/${ARTIFACT_ID}/Chart.yaml ${K8S_HELM_RESSOURCES}/ | ||
|
@@ -90,17 +97,19 @@ ${K8S_HELM_RESSOURCES}/Chart.yaml: ${BINARY_HELM} ## Creates the Chart.yaml-temp | |
@sed -i 's/version: .*/version: 0.0.0-replaceme/' ${K8S_HELM_RESSOURCES}/Chart.yaml | ||
|
||
.PHONY: k8s-helm-delete | ||
k8s-helm-delete: ${BINARY_HELM} ## Uninstalls the current helm chart. | ||
k8s-helm-delete: ${BINARY_HELM} check-k8s-namespace-env-var ## Uninstalls the current helm chart. | ||
@echo "Uninstall helm chart" | ||
@${BINARY_HELM} uninstall ${ARTIFACT_ID} | ||
@${BINARY_HELM} uninstall ${ARTIFACT_ID} --namespace=${NAMESPACE} ${BINARY_HELM_ADDITIONAL_UNINST_ARGS} || true | ||
|
||
.PHONY: k8s-helm-generate-chart | ||
k8s-helm-generate-chart: ${K8S_HELM_RESSOURCES}/Chart.yaml $(K8S_RESOURCE_TEMP_FOLDER) ## Generates the final helm chart. | ||
k8s-helm-generate-chart: ${K8S_HELM_TARGET}/Chart.yaml k8s-helm-create-temp-dependencies ## Generates the final helm chart. | ||
|
||
${K8S_HELM_TARGET}/Chart.yaml: $(K8S_RESOURCE_TEMP_FOLDER) | ||
@echo "Generate helm chart..." | ||
@rm -drf ${K8S_HELM_TARGET} # delete folder, so Chart.yaml is newly created from template | ||
@rm -drf ${K8S_HELM_TARGET} # delete folder, so the chart is newly created. | ||
@mkdir -p ${K8S_HELM_TARGET}/templates | ||
@cp $(K8S_RESOURCE_TEMP_YAML) ${K8S_HELM_TARGET}/templates | ||
@cp ${K8S_HELM_RESSOURCES}/Chart.yaml ${K8S_HELM_TARGET} | ||
@cp -r ${K8S_HELM_RESSOURCES}/** ${K8S_HELM_TARGET} | ||
@sed -i 's/appVersion: "0.0.0-replaceme"/appVersion: "${VERSION}"/' ${K8S_HELM_TARGET}/Chart.yaml | ||
@sed -i 's/version: 0.0.0-replaceme/version: ${VERSION}/' ${K8S_HELM_TARGET}/Chart.yaml | ||
|
||
|
@@ -110,23 +119,48 @@ k8s-helm-generate-chart: ${K8S_HELM_RESSOURCES}/Chart.yaml $(K8S_RESOURCE_TEMP_F | |
k8s-helm-generate: k8s-generate k8s-helm-generate-chart ## Generates the final helm chart with dev-urls. | ||
|
||
.PHONY: k8s-helm-apply | ||
k8s-helm-apply: ${BINARY_HELM} image-import k8s-helm-generate $(K8S_POST_GENERATE_TARGETS) ## Generates and installs the helm chart. | ||
k8s-helm-apply: ${BINARY_HELM} check-k8s-namespace-env-var image-import k8s-helm-generate $(K8S_POST_GENERATE_TARGETS) ## Generates and installs the helm chart. | ||
@echo "Apply generated helm chart" | ||
@${BINARY_HELM} upgrade -i ${ARTIFACT_ID} ${K8S_HELM_TARGET} | ||
@${BINARY_HELM} upgrade -i ${ARTIFACT_ID} ${K8S_HELM_TARGET} ${BINARY_HELM_ADDITIONAL_UPGR_ARGS} --namespace ${NAMESPACE} | ||
|
||
.PHONY: k8s-helm-reinstall | ||
k8s-helm-reinstall: k8s-helm-delete k8s-helm-apply ## Uninstalls the current helm chart and reinstalls it. | ||
|
||
##@ K8s - Helm release targets | ||
|
||
.PHONY: k8s-helm-generate-release | ||
k8s-helm-generate-release: $(K8S_PRE_GENERATE_TARGETS) k8s-helm-generate-chart ## Generates the final helm chart with release urls. | ||
k8s-helm-generate-release: ${K8S_HELM_TARGET}/templates/$(ARTIFACT_ID)_$(VERSION).yaml ## Generates the final helm chart with release urls. | ||
|
||
${K8S_HELM_TARGET}/templates/$(ARTIFACT_ID)_$(VERSION).yaml: $(K8S_PRE_GENERATE_TARGETS) ${K8S_HELM_TARGET}/Chart.yaml | ||
@sed -i "s/'{{ .Namespace }}'/'{{ .Release.Namespace }}'/" ${K8S_HELM_TARGET}/templates/$(ARTIFACT_ID)_$(VERSION).yaml | ||
|
||
.PHONY: k8s-helm-package-release | ||
k8s-helm-package-release: ${BINARY_HELM} k8s-helm-generate-release $(K8S_POST_GENERATE_TARGETS) ## Generates and packages the helm chart with release urls. | ||
k8s-helm-package-release: ${BINARY_HELM} k8s-helm-delete-existing-tgz ${K8S_HELM_RELEASE_TGZ} ## Generates and packages the helm chart with release urls. | ||
|
||
.PHONY: k8s-helm-delete-existing-tgz | ||
k8s-helm-delete-existing-tgz: ## Remove an existing Helm package. | ||
# remove | ||
@rm -f ${K8S_HELM_RELEASE_TGZ}* | ||
|
||
${K8S_HELM_RELEASE_TGZ}: ${BINARY_HELM} ${K8S_HELM_TARGET}/templates/$(ARTIFACT_ID)_$(VERSION).yaml k8s-helm-generate-chart $(K8S_POST_GENERATE_TARGETS) ## Generates and packages the helm chart with release urls. | ||
@echo "Package generated helm chart" | ||
@${BINARY_HELM} package ${K8S_HELM_TARGET} -d ${K8S_HELM_TARGET} | ||
@${BINARY_HELM} package ${K8S_HELM_TARGET} -d ${K8S_HELM_TARGET} ${BINARY_HELM_ADDITIONAL_PACK_ARGS} | ||
|
||
.PHONY: k8s-helm-create-temp-dependencies | ||
k8s-helm-create-temp-dependencies: ${K8S_HELM_TARGET}/Chart.yaml | ||
# we use helm dependencies internally but never use them as "official" dependency because the namespace may differ | ||
# instead we create empty dependencies to satisfy the helm package call and delete the whole directory from the chart.tgz later-on. | ||
@echo "Create helm temp dependencies (if they exist)" | ||
@for dep in `yq -e '.dependencies[].name // ""' ${K8S_HELM_TARGET}/Chart.yaml`; do \ | ||
mkdir -p ${K8S_HELM_TARGET}/${K8S_HELM_TARGET_DEP_DIR}/$${dep} ; \ | ||
sed "s|replaceme|$${dep}|g" $(BUILD_DIR)/make/k8s-helm-temp-chart.yaml > ${K8S_HELM_TARGET}/${K8S_HELM_TARGET_DEP_DIR}/$${dep}/Chart.yaml ; \ | ||
done | ||
|
||
.PHONY: chart-import | ||
chart-import: check-all-vars check-k8s-artifact-id k8s-helm-generate-chart k8s-helm-package-release image-import ## Imports the currently available image into the cluster-local registry. | ||
@echo "Import ${K8S_HELM_RELEASE_TGZ} into K8s cluster ${K3CES_REGISTRY_URL_PREFIX}..." | ||
@${BINARY_HELM} push ${K8S_HELM_RELEASE_TGZ} oci://${K3CES_REGISTRY_URL_PREFIX}/k8s ${BINARY_HELM_ADDITIONAL_PUSH_ARGS} | ||
@echo "Done." | ||
|
||
##@ K8s - Docker | ||
|
||
|
@@ -172,4 +206,4 @@ ${BINARY_YQ}: $(UTILITY_BIN_PATH) ## Download yq locally if necessary. | |
$(call go-get-tool,$(BINARY_YQ),github.com/mikefarah/yq/[email protected]) | ||
|
||
${BINARY_HELM}: $(UTILITY_BIN_PATH) ## Download helm locally if necessary. | ||
$(call go-get-tool,$(BINARY_HELM),helm.sh/helm/v3/cmd/helm@latest) | ||
$(call go-get-tool,$(BINARY_HELM),helm.sh/helm/v3/cmd/helm@${BINARY_HELM_VERSION}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters