Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile Scripting Upgrades #77

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading