diff --git a/Makefile b/Makefile index 3673a4100..9be01f0da 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,11 @@ COMMIT = $(shell git rev-parse --short=7 HEAD)$(shell [[ $$(git status --porcela ARO_HCP_BASE_IMAGE ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io ARO_HCP_FRONTEND_IMAGE ?= $(ARO_HCP_BASE_IMAGE)/arohcpfrontend:$(COMMIT) +# for deploying frontend into private aks cluster via invoke command +# these values must be set +RESOURCE_GROUP ?= +CLUSTER_NAME ?= + all: test lint # There is currently no convenient way to run tests against a whole Go workspace @@ -20,9 +25,19 @@ frontend-build-container: docker build --platform="linux/amd64" -f "frontend/Dockerfile" -t ${ARO_HCP_FRONTEND_IMAGE} . frontend-deploy: - oc process -f ./deploy/aro-hcp-frontend.yml -p ARO_HCP_FRONTEND_IMAGE=${ARO_HCP_FRONTEND_IMAGE} | oc apply -f - + oc process -f ./deploy/aro-hcp-frontend.yml -p ARO_HCP_FRONTEND_IMAGE=${ARO_HCP_FRONTEND_IMAGE} --local | oc apply -f - frontend-undeploy: - oc process -f ./deploy/aro-hcp-frontend.yml -p ARO_HCP_FRONTEND_IMAGE=${ARO_HCP_FRONTEND_IMAGE} | oc delete -f - + oc process -f ./deploy/aro-hcp-frontend.yml -p ARO_HCP_FRONTEND_IMAGE=${ARO_HCP_FRONTEND_IMAGE} --local | oc delete -f - + +frontend-deploy-private: + @test "${RESOURCE_GROUP}" != "" && test "${CLUSTER_NAME}" != "" || (echo "RESOURCE_GROUP and CLUSTER_NAME must be defined" && exit 1) + oc process -f ./deploy/aro-hcp-frontend.yml -p ARO_HCP_FRONTEND_IMAGE=${ARO_HCP_FRONTEND_IMAGE} --local > /tmp/deploy.yml + az aks command invoke --resource-group ${RESOURCE_GROUP} --name ${CLUSTER_NAME} --command "kubectl create -f deploy.yml" --file /tmp/deploy.yml + +frontend-undeploy-private: + @test "${RESOURCE_GROUP}" != "" && test "${CLUSTER_NAME}" != "" || (echo "RESOURCE_GROUP and CLUSTER_NAME must be defined" && exit 1) + oc process -f ./deploy/aro-hcp-frontend.yml -p ARO_HCP_FRONTEND_IMAGE=${ARO_HCP_FRONTEND_IMAGE} --local > /tmp/deploy.yml + az aks command invoke --resource-group ${RESOURCE_GROUP} --name ${CLUSTER_NAME} --command "kubectl delete -f deploy.yml" --file /tmp/deploy.yml .PHONY: frontend-build frontend-build-container frontend-deploy frontend-undeploy test lint clean diff --git a/deploy/aro-hcp-frontend.yml b/deploy/aro-hcp-frontend.yml index 060bea390..ff694df54 100644 --- a/deploy/aro-hcp-frontend.yml +++ b/deploy/aro-hcp-frontend.yml @@ -14,6 +14,10 @@ parameters: required: true objects: +- apiVersion: v1 + kind: Namespace + metadata: + name: ${NAMESPACE} - apiVersion: apps/v1 kind: Deployment metadata: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 5cbafa346..32e2d87c9 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -14,6 +14,10 @@ RUN cd frontend && make frontend FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9-1161 +ENV USER_UID=1001 \ + USER_NAME=frontend + COPY --from=builder /app/frontend/aro-hcp-frontend /usr/local/bin/ ENTRYPOINT ["aro-hcp-frontend"] +USER ${USER_UID} EXPOSE 8443/tcp