Skip to content

Commit cb80d48

Browse files
committed
templatize only Makefile include not makefile itself
Signed-off-by: Gerd Oberlechner <[email protected]>
1 parent 3830101 commit cb80d48

File tree

14 files changed

+97
-106
lines changed

14 files changed

+97
-106
lines changed

backend/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Makefile
1+
config.mk
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
SHELL = /bin/bash
2+
DEPLOY_ENV ?= personal-dev
3+
4+
$(shell ../templatize.sh $(DEPLOY_ENV) config.tmpl.mk config.mk)
5+
6+
include config.mk
27

38
COMMIT = $(shell git rev-parse --short=7 HEAD)
4-
ARO_HCP_BASE_IMAGE ?= {{ .acrName }}.azurecr.io
9+
ARO_HCP_BASE_IMAGE ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io
510
ARO_HCP_BACKEND_IMAGE ?= $(ARO_HCP_BASE_IMAGE)/arohcpbackend:$(COMMIT)
611

712
backend:
813
go build -o aro-hcp-backend .
914

1015
run:
11-
./aro-hcp-backend --location {{ .region }} \
16+
./aro-hcp-backend --location ${LOCATION} \
1217
--clusters-service-url http://localhost:8000
1318

1419
clean:
@@ -24,20 +29,20 @@ push: image
2429

2530
deploy:
2631
BACKEND_MI_CLIENT_ID=$(shell az identity show \
27-
-g {{ .serviceClusterRG }} \
32+
-g ${RESOURCEGROUP} \
2833
-n backend \
2934
--query clientId);\
30-
ISTO_VERSION=$(shell az aks show -n {{ .aksName }} -g {{ .serviceClusterRG }} --query serviceMeshProfile.istio.revisions[-1] -o tsv) && \
35+
ISTO_VERSION=$(shell az aks show -n ${AKS_NAME} -g ${RESOURCEGROUP} --query serviceMeshProfile.istio.revisions[-1] -o tsv) && \
3136
kubectl create namespace aro-hcp --dry-run=client -o json | kubectl apply -f - && \
3237
kubectl label namespace aro-hcp "istio.io/rev=$${ISTO_VERSION}" --overwrite=true && \
3338
helm upgrade --install aro-hcp-backend-dev \
3439
deploy/helm/backend/ \
35-
--set configMap.databaseName={{ .frontendCosmosDBName }} \
36-
--set configMap.databaseUrl="https://{{ .frontendCosmosDBName }}.documents.azure.com:443/" \
40+
--set configMap.databaseName=${DB_NAME} \
41+
--set configMap.databaseUrl="https://${DB_NAME}.documents.azure.com:443/" \
3742
--set configMap.backendMiClientId="$${BACKEND_MI_CLIENT_ID}" \
3843
--set serviceAccount.workloadIdentityClientId="$${BACKEND_MI_CLIENT_ID}" \
3944
--set configMap.currentVersion=${ARO_HCP_BACKEND_IMAGE} \
40-
--set configMap.location={{ .region }} \
45+
--set configMap.location=${LOCATION} \
4146
--set deployment.imageName=${ARO_HCP_BACKEND_IMAGE} \
4247
--namespace aro-hcp
4348

backend/README.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

backend/config.tmpl.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ARO_HCP_IMAGE_ACR ?= {{ .acrName }}
2+
LOCATION ?= {{ .region }}
3+
RESOURCEGROUP ?= {{ .serviceClusterRG }}
4+
AKS_NAME ?= {{ .aksName }}
5+
DB_NAME ?= {{ .frontendCosmosDBName }}

backend/generate-makefile.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

cluster-service/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
deploy/tmp-provisioning-shard.yml
2-
Makefile
2+
config.mk

cluster-service/Makefile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
SHELL = /bin/bash
2+
DEPLOY_ENV ?= personal-dev
3+
4+
$(shell ../templatize.sh $(DEPLOY_ENV) config.tmpl.mk config.mk)
5+
6+
include config.mk
7+
8+
TENANT_ID=$(shell az account show --query tenantId --output tsv)
9+
ZONE_RESOURCE_ID ?= $(shell az network dns zone show -n ${DNS_ZONE_NAME} -g ${REGIONAL_RESOURCEGROUP} --query id -o tsv)
10+
11+
deploy:
12+
sed -e "s#ZONE_RESOURCE_ID#${ZONE_RESOURCE_ID}#g" -e "s/REGION/${REGION}/g" -e "s/CONSUMER_NAME/${CONSUMER_NAME}/g" deploy/mvp-provisioning-shards.yml > deploy/tmp-provisioning-shard.yml
13+
14+
ISTO_VERSION=$(shell az aks show -n ${AKS_NAME} -g ${RESOURCEGROUP} --query serviceMeshProfile.istio.revisions[-1] -o tsv) && \
15+
oc process --local -f deploy/openshift-templates/arohcp-namespace-template.yml \
16+
-p ISTIO_VERSION=$${ISTO_VERSION} | oc apply -f -
17+
kubectl apply -f deploy/istio.yml
18+
19+
oc process --local -f deploy/openshift-templates/arohcp-db-template.yml | oc apply -f -
20+
oc process --local -f deploy/openshift-templates/arohcp-secrets-template.yml \
21+
-p PROVISION_SHARDS_CONFIG="$$( base64 -i deploy/tmp-provisioning-shard.yml)" | oc apply -f -
22+
23+
AZURE_CS_MI_CLIENT_ID=$(shell az identity show -g ${RESOURCEGROUP} -n clusters-service --query clientId -o tsv) && \
24+
CS_SERVICE_PRINCIPAL_CREDS_BASE64='$(shell az keyvault secret show --vault-name "${SERVICE_KV}" --name "aro-hcp-dev-sp-cs" | jq .value -r | base64 | tr -d '\n')' && \
25+
OIDC_BLOB_SERVICE_ENDPOINT=$(shell az storage account show -n ${OIDC_STORAGE_ACCOUNT} -g ${RESOURCEGROUP} --query primaryEndpoints.blob -o tsv) && \
26+
OIDC_WEB_SERVICE_ENDPOINT=$(shell az storage account show -n ${OIDC_STORAGE_ACCOUNT} -g ${RESOURCEGROUP} --query primaryEndpoints.web -o tsv) && \
27+
oc process --local -f deploy/openshift-templates/arohcp-service-template.yml \
28+
-p AZURE_CS_MI_CLIENT_ID=$${AZURE_CS_MI_CLIENT_ID} \
29+
-p TENANT_ID=${TENANT_ID} \
30+
-p REGION=${REGION} \
31+
-p SERVICE_KEYVAULT_NAME=${SERVICE_KV} \
32+
-p CS_SERVICE_PRINCIPAL_CREDS_BASE64=$${CS_SERVICE_PRINCIPAL_CREDS_BASE64} \
33+
-p IMAGE_REGISTRY=${ACR_NAME}.azurecr.io \
34+
-p IMAGE_REPOSITORY=${IMAGE_REPO} \
35+
-p AZURE_FIRST_PARTY_APPLICATION_CLIENT_ID=${FPA_CLIENT_ID} \
36+
-p FPA_CERT_NAME=${FPA_CERT_NAME} \
37+
-p IMAGE_TAG=${IMAGE_TAG} | oc apply -f -
38+
39+
deploy-pr-env-deps:
40+
oc process --local -f deploy/integration/cluster-service-namespace.yaml \
41+
-p CLIENT_ID=${AZURE_CS_MI_CLIENT_ID} | oc apply -f -
42+
43+
# for local development
44+
provision-shard:
45+
sed -e "s#ZONE_RESOURCE_ID#${ZONE_RESOURCE_ID}#g" -e "s/REGION/${REGION}/g" -e "s/CONSUMER_NAME/${CONSUMER_NAME}/g" deploy/dev-provisioning-shards.yml
46+
47+
.PHONY: deploy deploy-integ provision-shard

cluster-service/Makefile.tmpl.mk

Lines changed: 0 additions & 44 deletions
This file was deleted.

cluster-service/config.tmpl.mk

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
REGION ?= {{ .region }}
2+
CONSUMER_NAME ?= {{ .maestroConsumerName }}
3+
RESOURCEGROUP ?= {{ .serviceClusterRG }}
4+
REGIONAL_RESOURCEGROUP ?= {{ .regionRG }}
5+
AKS_NAME ?= {{ .aksName }}
6+
SERVICE_KV ?= {{ .serviceKeyVaultName }}
7+
OIDC_STORAGE_ACCOUNT ?= {{ .oidcStorageAccountName }}
8+
IMAGE_REPO ?= {{ .clusterServiceImageRepo }}
9+
IMAGE_TAG ?= {{ .clusterServiceImageTag }}
10+
ACR_NAME ?= {{ .acrName }}
11+
FPA_CLIENT_ID ?= {{ .firstPartyAppClientId }}
12+
DNS_ZONE_NAME ?= {{ .regionalDNSSubdomain }}.{{ .baseDnsZoneName }}
13+
FPA_CERT_NAME ?= firstPartyCert

frontend/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Makefile
1+
config.mk

0 commit comments

Comments
 (0)