Skip to content

Commit

Permalink
Environment variable HELM_CHART_KUBECONFIG can now be used to point t…
Browse files Browse the repository at this point in the history
…o a custom

kubeconfig.

Signed-off-by: Marcio Silva <[email protected]>
  • Loading branch information
Marcio Silva authored and mpeters committed Jan 22, 2024
1 parent bb4d5c8 commit 8a6d100
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ HELM_CHART_DEBUG_FILE ?= /tmp/keylime.helm.debug
HELM_CHART_KEYLIME_DIR := $(BUILD_DIR)/helm/keylime
HELM_CHART_KEYLIME_FILES := $(shell find $(HELM_CHART_KEYLIME_DIR) -type f)
HELM_CHART_REPO ?= ghcr.io/keylime/helm-charts
HELM_CHART_KUBECONFIG ?= ~/.kube/config

##@ General

Expand Down Expand Up @@ -102,23 +103,23 @@ helm-keylime-undeploy: ## Undeploy the keylime helm chart
helm-keylime-deploy: ## Deploy the keylime helm chart
{ \
touch $(HELM_CHART_CUSTOM_VALUES);\
cat $(HACK_DIR)/k8s-poc/admin/kt | sed -e "s/#export/export/g" -e "s/REPLACE_KEYLIME_NAMESPACE/$(HELM_CHART_NAMESPACE)/g" > $(MKFILE_DIR)/kt;\
cat $(HACK_DIR)/k8s-poc/admin/kt | sed -e "s/#export/export/g" -e "s^REPLACE_HELM_CHART_KUBECONFIG^$(HELM_CHART_KUBECONFIG)^g" -e "s/REPLACE_KEYLIME_NAMESPACE/$(HELM_CHART_NAMESPACE)/g" > $(MKFILE_DIR)/kt;\
chmod +x $(MKFILE_DIR)/kt;\
helm install $(HELM_CHART_RELEASE_NAME) $(BUILD_ARTIFACTS_DIR)/keylime-$(HELM_CHART_KEYLIME_VERSION).tgz --namespace $(HELM_CHART_NAMESPACE) --create-namespace -f $(HELM_CHART_CUSTOM_VALUES);\
helm install $(HELM_CHART_RELEASE_NAME) $(BUILD_ARTIFACTS_DIR)/keylime-$(HELM_CHART_KEYLIME_VERSION).tgz --namespace $(HELM_CHART_NAMESPACE) --create-namespace --kubeconfig $(HELM_CHART_KUBECONFIG) -f $(HELM_CHART_CUSTOM_VALUES);\
}

.PHONY: helm-keylime-update
helm-keylime-update: ## Update the deployed keylime helm chart
{ \
touch $(HELM_CHART_CUSTOM_VALUES);\
helm upgrade $(HELM_CHART_RELEASE_NAME) $(BUILD_ARTIFACTS_DIR)/keylime-$(HELM_CHART_KEYLIME_VERSION).tgz --namespace $(HELM_CHART_NAMESPACE) --create-namespace -f $(HELM_CHART_CUSTOM_VALUES);\
helm upgrade $(HELM_CHART_RELEASE_NAME) $(BUILD_ARTIFACTS_DIR)/keylime-$(HELM_CHART_KEYLIME_VERSION).tgz --namespace $(HELM_CHART_NAMESPACE) --create-namespace --kubeconfig $(HELM_CHART_KUBECONFIG) -f $(HELM_CHART_CUSTOM_VALUES);\
}

.PHONY: helm-keylime-debug
helm-keylime-debug: ## Attempt to debug the keylime helm chart, without deploying it
{ \
touch $(HELM_CHART_CUSTOM_VALUES);\
helm install $(HELM_CHART_RELEASE_NAME) $(BUILD_ARTIFACTS_DIR)/keylime-$(HELM_CHART_KEYLIME_VERSION).tgz --namespace $(HELM_CHART_NAMESPACE) --create-namespace --debug --dry-run -f $(HELM_CHART_CUSTOM_VALUES)>$(HELM_CHART_DEBUG_FILE);\
helm install $(HELM_CHART_RELEASE_NAME) $(BUILD_ARTIFACTS_DIR)/keylime-$(HELM_CHART_KEYLIME_VERSION).tgz --namespace $(HELM_CHART_NAMESPACE) --create-namespace --debug --dry-run --kubeconfig $(HELM_CHART_KUBECONFIG) -f $(HELM_CHART_CUSTOM_VALUES)>$(HELM_CHART_DEBUG_FILE);\
}

.PHONY: helm-keylime-push
Expand All @@ -129,7 +130,7 @@ helm-keylime-push: helm ## Builds AND pushes the keylime helm chart
helm-keylime-test: ## Basic testing for the keylime helm chart
{ \
touch $(HELM_CHART_CUSTOM_VALUES);\
cat $(HACK_DIR)/k8s-poc/admin/kt | sed -e "s/#export/export/g" -e "s/REPLACE_KEYLIME_NAMESPACE/$(HELM_CHART_NAMESPACE)/g" > $(MKFILE_DIR)/kt;\
cat $(HACK_DIR)/k8s-poc/admin/kt | sed -e "s/#export/export/g" -e "s^REPLACE_HELM_CHART_KUBECONFIG^$(HELM_CHART_KUBECONFIG)^g" -e "s/REPLACE_KEYLIME_NAMESPACE/$(HELM_CHART_NAMESPACE)/g" > $(MKFILE_DIR)/kt;\
chmod +x $(MKFILE_DIR)/kt;\
touch /tmp/empty;\
./kt -c reglist && ./kt -c deleteall && ./kt -c addall -f /tmp/empty;\
Expand Down
1 change: 1 addition & 0 deletions hack/k8s-poc/admin/kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fi

export KEYLIME_NAMESPACE=keylime
#export KEYLIME_NAMESPACE=REPLACE_KEYLIME_NAMESPACE
#export KUBECONFIG=REPLACE_HELM_CHART_KUBECONFIG

KEYLIME_TENANT_POD=$(kubectl get pods --namespace ${KEYLIME_NAMESPACE} | grep tenant | awk '{ print $1 }')
if [[ -z $KEYLIME_TENANT_POD ]]
Expand Down

0 comments on commit 8a6d100

Please sign in to comment.