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

ARO-10633 | Add ARM Helper Indentity supporting properties #695

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion cluster-service/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ CONSUMER_NAME ?= $(shell az aks list --query "[?tags.clusterType == 'mgmt-cluste
KEYVAULT_NAME ?= $(shell az keyvault list --query "[?tags.aroHCPPurpose=='service'].name" -g ${SVC_KV_RESOURCEGROUP} --output tsv)
ahitacat marked this conversation as resolved.
Show resolved Hide resolved
FPA_CERT_NAME ?= firstPartyCert
AZURE_FIRST_PARTY_APPLICATION_CLIENT_ID ?= "57e54810-3138-4f38-bd3b-29cb33f4c358"
AZURE_ARM_HELPER_IDENTITY_CLIENT_ID ?= "2c6ca254-36bd-43c8-a7a8-fe880bc2c489"
Comment on lines 10 to +11
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While not the end of the world, we should probably replace both of these hard-coded values with lookups instead similar to other places in our Makefiles, it seems the convention is:

SOME_CLIENT_ID ?= $(shell az identity show \
			-g ${RESOURCEGROUP} \
			-n SOME_CLIENT_NAME \
			--query clientId)

This will improve our security posture and make our automation resilient to turnover of these IDs in the event they are rotated for whatever reason.

AZURE_ARM_HELPER_IDENTITY_CERT_NAME ?= armHelperCert

deploy:
ZONE_RESOURCE_ID=$(shell az network dns zone list -g ${REGIONAL_RESOURCEGROUP} --query "[?zoneType=='Public'].id" -o tsv) && \
Expand Down Expand Up @@ -37,14 +39,17 @@ deploy:
-p IMAGE_REPOSITORY=app-sre/uhc-clusters-service \
-p AZURE_FIRST_PARTY_APPLICATION_CLIENT_ID=$${AZURE_FIRST_PARTY_APPLICATION_CLIENT_ID} \
-p FPA_CERT_NAME=${FPA_CERT_NAME} \
-p IMAGE_TAG=cf23767 | oc apply -f -
-p AZURE_ARM_HELPER_IDENTITY_CLIENT_ID=${AZURE_ARM_HELPER_IDENTITY_CLIENT_ID} \
-p AZURE_ARM_HELPER_IDENTITY_CERT_NAME=${AZURE_ARM_HELPER_IDENTITY_CERT_NAME} \
-p IMAGE_TAG=910676a | oc apply -f -

deploy-integ:
AZURE_CS_MI_CLIENT_ID=$(shell az identity show \
-g ${RESOURCEGROUP} \
-n clusters-service \
--query clientId) && \
oc process --local -f deploy/integration/cluster-service-namespace.yaml \
-p AZURE_ARM_HELPER_IDENTITY_CLIENT_ID=$${AZURE_ARM_HELPER_CLIENT_ID} \
-p CLIENT_ID=$${AZURE_CS_MI_CLIENT_ID} | oc apply -f -

# for local development
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ parameters:
value: ""
- name: FPA_CERT_NAME
description: The name of the secret that contains the first party application certificate bundle.
- name: AZURE_ARM_HELPER_IDENTITY_CLIENT_ID
description: The client id of the service principal that represents the ARM Helper Identity.
value: "57e54810-3138-4f38-bd3b-29cb33f4c358"
- name: AZURE_ARM_HELPER_IDENTITY_CERT_NAME
description: The name of the secret that contains the ARM Helper Indentity certificate bundle.
value: ""

objects:

Expand All @@ -256,6 +262,26 @@ objects:
usePodIdentity: "false"
provider: azure

- apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: arm-identity
namespace: ${NAMESPACE}
spec:
parameters:
clientID: ${AZURE_CS_MI_CLIENT_ID}
cloudName: AzurePublicCloud
keyvaultName: ${SERVICE_KEYVAULT_NAME}
objects: |-
array:
- |
objectName: ${AZURE_ARM_HELPER_IDENTITY_CERT_NAME}
objectType: secret
objectAlias: armHelperIndentityCertificateBundle
tenantId: ${TENANT_ID}
usePodIdentity: "false"
provider: azure

- apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -456,6 +482,12 @@ objects:
- name: azure-credentials
secret:
secretName: azure-credentials
- name: arm-identity
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: arm-identity
- name: keyvault
csi:
driver: secrets-store.csi.k8s.io
Expand Down Expand Up @@ -523,6 +555,9 @@ objects:
readOnly: true
- name: azure-runtime-config
mountPath: /configs/azure-runtime-config
- name: arm-identity
mountPath: "/secrets/arm-identity"
readOnly: true
env:
- name: NAMESPACE
valueFrom:
Expand Down Expand Up @@ -574,6 +609,8 @@ objects:
- --azure-first-party-application-client-id=${AZURE_FIRST_PARTY_APPLICATION_CLIENT_ID}
- --azure-first-party-application-certificate-bundle-path=/secrets/keyvault/firstPartyApplicationCertificateBundle
- --azure-runtime-config-path=/configs/azure-runtime-config/config.json
- --azure-arm-helper-identity-certificate-bundle-path=/secrets/arm-identity/armHelperIndentityCertificateBundle
- --azure-arm-helper-identity-client-id=${AZURE_ARM_HELPER_IDENTITY_CLIENT_ID}
livenessProbe:
httpGet:
path: /api/clusters_mgmt/v1
Expand Down