Skip to content

Commit

Permalink
Makefile Scripting Upgrades (#77)
Browse files Browse the repository at this point in the history
* Separate operator namespace

* Build with docker not minikube
  • Loading branch information
TimPansino authored Jul 25, 2024
1 parent 0d781a0 commit f3ac661
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,53 @@ cert-manager:

# Install official k8s-agents-operator repo
.PHONY: operator
operator: cert-manager
operator: cert-manager license_key_secret
helm uninstall k8s-agents-operator --ignore-not-found
helm repo add k8s-agents-operator https://newrelic.github.io/k8s-agents-operator
helm upgrade --install k8s-agents-operator k8s-agents-operator/k8s-agents-operator \
--namespace=default \
--create-namespace \
--namespace=k8s-agents-operator \
--set=licenseKey=${NEW_RELIC_LICENSE_KEY} \
--set=controllerManager.manager.image.tag=edge
sleep 1
kubectl wait --for=condition=Ready -n default --all pods
kubectl wait --for=condition=Ready -n k8s-agents-operator --all pods

# Build and install local copy of k8s-agents-operator

.PHONY: operator-local
operator-local:
minikube image build ${LOCAL_OPERATOR_REPO_PATH}/ -t e2e/k8s-agents-operator:e2e
operator-local: license_key_secret
eval $$(minikube docker-env --shell=bash) && \
docker build ${LOCAL_OPERATOR_REPO_PATH}/ -t e2e/k8s-agents-operator:e2e
helm uninstall k8s-agents-operator --ignore-not-found
sleep 1
helm upgrade --install k8s-agents-operator ${LOCAL_OPERATOR_REPO_PATH}/charts/k8s-agents-operator/ --namespace=default \
helm upgrade --install k8s-agents-operator ${LOCAL_OPERATOR_REPO_PATH}/charts/k8s-agents-operator/ \
--create-namespace \
--namespace=k8s-agents-operator \
--set=licenseKey=${NEW_RELIC_LICENSE_KEY} \
--set=controllerManager.manager.image.pullPolicy=Never \
--set=controllerManager.manager.image.repository=e2e/k8s-agents-operator \
--set=controllerManager.manager.image.tag=e2e
sleep 1
kubectl wait --for=condition=Ready -n default --all pods
kubectl wait --for=condition=Ready -n k8s-agents-operator --all pods

# Set license key in default namespace
.PHONY: license_key_secret
license_key_secret:
kubectl delete secret newrelic-key-secret --ignore-not-found
kubectl create secret generic newrelic-key-secret \
--from-literal="new_relic_license_key=${NEW_RELIC_LICENSE_KEY}" \
-n default

# Build local initcontainer image
.PHONY: build-initcontainer
build-initcontainer: check-language-arg
minikube image build -t e2e/newrelic-${INITCONTAINER_LANGUAGE}-init:e2e ${REPO_ROOT}/src/${INITCONTAINER_LANGUAGE}/
eval $$(minikube docker-env --shell=bash) && \
docker build -t e2e/newrelic-${INITCONTAINER_LANGUAGE}-init:e2e ${REPO_ROOT}/src/${INITCONTAINER_LANGUAGE}/

# Build local test app image
.PHONY: build-testapp
build-testapp: check-language-arg
minikube image build -t e2e/test-app-${INITCONTAINER_LANGUAGE}:e2e ${REPO_ROOT}/tests/${INITCONTAINER_LANGUAGE}/
eval $$(minikube docker-env --shell=bash) && \
docker build -t e2e/test-app-${INITCONTAINER_LANGUAGE}:e2e ${REPO_ROOT}/tests/${INITCONTAINER_LANGUAGE}/

# Deploy and open test app in browser
.PHONY: test
Expand All @@ -89,7 +102,7 @@ logs-testapp:
# View test app container logs
.PHONY: logs-testapp
logs-operator:
kubectl logs $$(kubectl get pods -n default | grep k8s-agents-operator | cut -d" " -f1)
kubectl logs -n k8s-agents-operator $$(kubectl get pods -n k8s-agents-operator | grep k8s-agents-operator | cut -d" " -f1)

.PHONY: check-language-arg
check-language-arg:
Expand Down

0 comments on commit f3ac661

Please sign in to comment.