diff --git a/Makefile b/Makefile index 3be5a5cbc..97177565e 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ SHELL = /bin/bash TAG ?= $(shell git describe --exact-match 2>/dev/null) COMMIT = $(shell git rev-parse --short=7 HEAD)$(shell [[ $$(git status --porcelain) = "" ]] || echo -dirty) # There is currently no ACR for ARO HCP components. Variable will be defined later -ARO_HCP_BASE_IMAGE = ${ARO_HCP_IMAGE_ACR}.azurecr.io +ARO_HCP_BASE_IMAGE ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io ifeq ($(TAG),) VERSION = $(COMMIT) @@ -34,3 +34,9 @@ frontend-multistage: clean: rm aro-hcp-frontend + +deploy-frontend: + oc process -f ./deploy/aro-hcp-frontend.yml -p ARO_HCP_FRONTEND_IMAGE=${ARO_HCP_FRONTEND_IMAGE} | oc replace -f - + +undeploy-frontend: + oc process -f ./deploy/aro-hcp-frontend.yml -p ARO_HCP_FRONTEND_IMAGE=${ARO_HCP_FRONTEND_IMAGE} | oc delete -f - diff --git a/deploy/aro-hcp-frontend.yml b/deploy/aro-hcp-frontend.yml new file mode 100644 index 000000000..2cacea8bb --- /dev/null +++ b/deploy/aro-hcp-frontend.yml @@ -0,0 +1,63 @@ +apiVersion: template.openshift.io/v1 +kind: Template +metadata: + name: frontend-template + +parameters: +- name: NAMESPACE + required: true + value: aro-hcp +- name: REPLICAS + required: true + value: "1" +- name: ARO_HCP_FRONTEND_IMAGE + required: true + +objects: +- apiVersion: apps/v1 + kind: Deployment + metadata: + labels: + app: aro-hcp-frontend + name: aro-hcp-frontend + namespace: ${NAMESPACE} + spec: + progressDeadlineSeconds: 600 + replicas: ${{REPLICAS}} + revisionHistoryLimit: 10 + selector: + matchLabels: + app: aro-hcp-frontend + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + labels: + app: aro-hcp-frontend + spec: + containers: + - name: aro-hcp-frontend + image: ${ARO_HCP_FRONTEND_IMAGE} + imagePullPolicy: IfNotPresent + ports: + - containerPort: 8443 + protocol: TCP + resources: + limits: + memory: 1Gi + requests: + cpu: 100m + memory: 500Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + restartPolicy: Always + terminationGracePeriodSeconds: 30 diff --git a/frontend/README.md b/frontend/README.md index 4b5f8e536..840c3e16d 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -8,6 +8,16 @@ make frontend To create a cluster, follow the instructions in [development-setup.md][../dev-infrastructure/docs/development-setup.md] +## Deploy/Undeploy frontend in a cluster + +```bash +# Deploy +make deploy-frontend + +# Undeploy +make undeploy-frontend +``` + ## Available endpoints List the Operations for the Provider @@ -38,4 +48,4 @@ curl -X PUT "https://localhost:8443/subscriptions/YOUR_SUBSCRIPTION_ID/resourceG Delete a HcpOpenShiftClusterResource ```bash curl -X DELETE "https://localhost:8443/subscriptions/YOUR_SUBSCRIPTION_ID/resourceGroups/YOUR_RESOURCE_GROUP_NAME/providers/Microsoft.RedHatOpenshift/hcpOpenShiftClusters/YOUR_CLUSTER_NAME?api-version=2024-06-10-preview" -``` \ No newline at end of file +```