Skip to content

Commit b9f7725

Browse files
Add Hive ACR deployment functions to deploy-shared-env.sh
- Add deploy_hive_acr_dev() to create per-region ACR (arodevhive{location}) - Add deploy_hive_artifact_cache_credentials() for credential set - Add deploy_hive_artifact_cache_rules() for cache rules - Add deploy_hive_aks_acr_pull_role() for AKS pull access - Update default ACR registry to arodevhiveeastus.azurecr.io Addresses PR feedback to integrate templates into existing deployment procedures
1 parent b2b1c9a commit b9f7725

File tree

2 files changed

+78
-3
lines changed

2 files changed

+78
-3
lines changed

hack/devtools/deploy-shared-env.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,79 @@ deploy_aks_dev() {
8383
"sshRSAPublicKey=$(<secrets/proxy_id_rsa.pub)" >/dev/null
8484
}
8585

86+
deploy_hive_acr_dev() {
87+
echo "########## Deploying Hive ACR in RG $RESOURCEGROUP ##########"
88+
local acr_name="arolocaldev${LOCATION}"
89+
az deployment group create \
90+
-g "$RESOURCEGROUP" \
91+
-n hive-acr \
92+
--template-file pkg/deploy/assets/ci-development.json \
93+
--parameters "acrName=$acr_name" >/dev/null
94+
echo "########## Created ACR: $acr_name ##########"
95+
}
96+
97+
deploy_hive_artifact_cache_credentials() {
98+
echo "########## Deploying Hive artifact cache credentials in RG $RESOURCEGROUP ##########"
99+
local acr_name="arolocaldev${LOCATION}"
100+
101+
if [ -z "$HIVE_PULL_USERNAME" ] || [ -z "$HIVE_PULL_PASSWORD" ]; then
102+
echo "ERROR: HIVE_PULL_USERNAME and HIVE_PULL_PASSWORD must be set"
103+
echo "Contact Kipp/Adam for Hive pull secret credentials"
104+
return 1
105+
fi
106+
107+
az deployment group create \
108+
-g "$RESOURCEGROUP" \
109+
-n hive-artifact-cache-credentials \
110+
--template-file pkg/deploy/assets/artifact-cache-credential-set.bicep \
111+
--parameters \
112+
"acrName=$acr_name" \
113+
"username=$HIVE_PULL_USERNAME" \
114+
"password=$HIVE_PULL_PASSWORD" >/dev/null
115+
echo "########## Credential set created for $acr_name ##########"
116+
}
117+
118+
deploy_hive_artifact_cache_rules() {
119+
echo "########## Deploying Hive artifact cache rules in RG $RESOURCEGROUP ##########"
120+
local acr_name="arolocaldev${LOCATION}"
121+
122+
local credential_set_id=$(az acr credential-set show \
123+
--registry "$acr_name" \
124+
--name hive-pull-credentials \
125+
--query id -o tsv 2>/dev/null)
126+
127+
if [ -z "$credential_set_id" ]; then
128+
echo "ERROR: Credential set not found for $acr_name"
129+
echo "Run deploy_hive_artifact_cache_credentials first"
130+
return 1
131+
fi
132+
133+
az deployment group create \
134+
-g "$RESOURCEGROUP" \
135+
-n hive-artifact-cache-rules \
136+
--template-file pkg/deploy/assets/artifact-cache-rules.bicep \
137+
--parameters \
138+
"acrName=$acr_name" \
139+
"credentialSetResourceId=$credential_set_id" >/dev/null
140+
echo "########## Artifact cache rules created for $acr_name ##########"
141+
}
142+
143+
deploy_hive_aks_acr_pull_role() {
144+
echo "########## Granting AKS cluster ACR pull access for Hive in RG $RESOURCEGROUP ##########"
145+
local aks_cluster="${AKS_CLUSTER_NAME:-aro-aks-cluster-001}"
146+
local acr_name="arolocaldev${LOCATION}"
147+
148+
az deployment group create \
149+
-g "$RESOURCEGROUP" \
150+
-n hive-aks-acr-pull-role \
151+
--template-file pkg/deploy/assets/aks-acr-pull-role.json \
152+
--parameters \
153+
"aksClusterName=$aks_cluster" \
154+
"acrName=$acr_name" \
155+
"acrResourceGroup=$RESOURCEGROUP" >/dev/null
156+
echo "########## AKS cluster $aks_cluster granted pull access to $acr_name ##########"
157+
}
158+
86159
deploy_vpn_for_dedicated_rp() {
87160
echo "########## Deploying Dev VPN in RG $RESOURCEGROUP ##########"
88161
az deployment group create \

hack/hive/hive-generate-config.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ main() {
1818

1919
# Hive images are now pulled from ACR using artifact cache rules
2020
# The new Hive repository: quay.io/redhat-services-prod/crt-redhat-acm-tenant/hive-operator/hive
21-
# is mirrored to ACR via artifact cache rules set up on arolocaldevsvc (dev) and arosvcdev (e2e)
22-
# For dev environments, use arolocaldevsvc; for E2E, use arosvcdev
21+
# is mirrored to ACR via artifact cache rules
22+
# For shared dev environments: arolocaldev<location>.azurecr.io (e.g., arolocaldeveastus.azurecr.io)
23+
# For E2E environment: arosvcdev.azurecr.io
24+
# Override with HIVE_ACR_REGISTRY if needed
2325
# shellcheck disable=SC2034
24-
local -r acr_registry="${HIVE_ACR_REGISTRY:-arolocaldevsvc.azurecr.io}"
26+
local -r acr_registry="${HIVE_ACR_REGISTRY:-arolocaldeveastus.azurecr.io}"
2527
local -r hive_image="${acr_registry}/redhat-services-prod/crt-redhat-acm-tenant/hive-operator/hive:${hive_image_commit_hash}"
2628

2729

0 commit comments

Comments
 (0)