Skip to content

Commit

Permalink
template ev2 gap
Browse files Browse the repository at this point in the history
Signed-off-by: Gerd Oberlechner <[email protected]>
  • Loading branch information
geoberle committed Nov 14, 2024
1 parent 3bf5906 commit a6a0fdd
Show file tree
Hide file tree
Showing 39 changed files with 1,845 additions and 446 deletions.
53 changes: 31 additions & 22 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
defaults:
region: {{ .ctx.region }}
# Subscriptions
serviceClusterSubscription: hcp-{{ .ctx.region }}
managementClusterSubscription: hcp-{{ .ctx.region }}
# Resourcegroups
globalRG: global
regionRG: hcp-underlay-{{ .ctx.region }}-{{ .ctx.regionStamp }}
serviceClusterRG: hcp-underlay-{{ .ctx.region }}-{{ .ctx.regionStamp }}-svc
managementClusterRG: hcp-underlay-{{ .ctx.region }}-{{ .ctx.regionStamp }}-mgmt-{{ .ctx.cxStamp }}
imageSyncRG: hcp-underlay-{{ .ctx.region }}-{{ .ctx.regionStamp }}-imagesync
regionRG: hcp-underlay-{{ .ctx.regionShort }}
serviceClusterRG: hcp-underlay-{{ .ctx.regionShort }}-svc
managementClusterRG: hcp-underlay-{{ .ctx.regionShort }}-mgmt-{{ .ctx.stamp }}
imageSyncRG: hcp-underlay-{{ .ctx.regionShort }}-imagesync

# General AKS config
kubernetesVersion: 1.30.5
Expand All @@ -19,30 +22,30 @@ defaults:
serviceComponentAcrResourceGroups: global

# SVC cluster specifics
svcEtcdKVName: {{ azureKeyVaultName "aro-hcp-etcd" 5 .ctx.region .ctx.regionStamp }}
svcEtcdKVName: arohcp-etcd-{{ .ctx.regionShort }}
svcEtcdKVSoftDelete: true

# MGMT cluster specifics
mgmtEtcdKVName: {{ azureKeyVaultName "aro-hcp-etcd" 5 .ctx.region .ctx.regionStamp .ctx.cxStamp }}
mgmtEtcdKVName: arohcp-etcd-{{ .ctx.regionShort }}-{{ .ctx.stamp }}
mgmtEtcdKVSoftDelete: true

# Frontend
frontendCosmosDBDeploy: true
frontendCosmosDBDisableLocalAuth: true
frontendCosmosDBName: {{ azureCosmosDBName "aro-hcp-rp" 5 .ctx.region .ctx.regionStamp }}
frontendCosmosDBName: arohcp-rp-{{ .ctx.regionShort }}

# Maestro
maestroKeyVaultName: {{ azureKeyVaultName "maestro" 5 .ctx.region .ctx.regionStamp }}
maestroEventgridName: {{ azureEventGridName "maestro" 5 .ctx.region .ctx.regionStamp }}
maestroKeyVaultName: arohcp-maestro-{{ .ctx.regionShort }}
maestroEventgridName: arohcp-maestro-{{ .ctx.regionShort }}
maestroEventGridMaxClientSessionsPerAuthName: '4'
maestroCertDomain: 'selfsigned.maestro.keyvault.azure.com'
maestroPostgresName: {{ azurePostgresName "maestro" 5 .ctx.region .ctx.regionStamp }}
maestroPostgresName: arohcp-maestro-{{ .ctx.regionShort }}
maestroPostgresServerVersion: '15'
maestroPostgresServerStorageSizeGB: '32'
maestroPostgresDeploy: true
maestroPostgresPrivate: false
maestroRestrictIstioIngress: true
maestroConsumerName: hcp-underlay-{{ .ctx.region }}-{{ .ctx.regionStamp }}-mgmt-{{ .ctx.cxStamp }}
maestroConsumerName: hcp-underlay-{{ .ctx.regionShort }}-mgmt-{{ .ctx.stamp }}

# Hypershift
hypershiftNamespace: hypershift
Expand All @@ -51,7 +54,7 @@ defaults:
externalDNSServiceAccountName: external-dns

# Cluster Service
clusterServicePostgresName: {{ azurePostgresName "cs" 5 .ctx.region .ctx.regionStamp }}
clusterServicePostgresName: arohcp-cs-{{ .ctx.regionShort }}
clusterServicePostgresDeploy: true
clusterServicePostgresPrivate: false
clusterServiceAcrRG: global
Expand All @@ -66,20 +69,20 @@ defaults:
ocMirrorImageTag: 7abc8af

# Service KeyVault
serviceKeyVaultName: {{ azureKeyVaultName "aro-hcp-svc" 5 .ctx.region .ctx.regionStamp }}
serviceKeyVaultRG: hcp-underlay-{{ .ctx.region }}-svc-{{ .ctx.regionStamp }}
serviceKeyVaultName: arohcp-svc-{{ .ctx.regionShort }}
serviceKeyVaultRG: hcp-underlay-{{ .ctx.regionShort }}
serviceKeyVaultRegion: {{ .ctx.region }}
serviceKeyVaultSoftDelete: true
serviceKeyVaultPrivate: true

# Management Cluster KV
cxKeyVaultName: {{ azureKeyVaultName "aro-hcp-cx" 5 .ctx.region .ctx.regionStamp .ctx.cxStamp }}
cxKeyVaultName: arohcp-cx-{{ .ctx.regionShort }}-{{ .ctx.stamp }}
cxKeyVaultSoftDelete: true
cxKeyVaultPrivate: true
msiKeyVaultName: {{ azureKeyVaultName "aro-hcp-msi" 5 .ctx.region .ctx.regionStamp .ctx.cxStamp }}
msiKeyVaultName: arohcp-msi-{{ .ctx.regionShort }}-{{ .ctx.stamp }}
msiKeyVaultSoftDelete: true
msiKeyVaultPrivate: true
mgmtKeyVaultName: {{ azureKeyVaultName "aro-hcp-mgmt" 5 .ctx.region .ctx.regionStamp .ctx.cxStamp }}
mgmtKeyVaultName: arohcp-mgmt-{{ .ctx.regionShort }}-{{ .ctx.stamp }}
mgmtKeyVaultSoftDelete: true
mgmtKeyVaultPrivate: true

Expand All @@ -90,6 +93,9 @@ clouds:
# this configuration serves as a template for for all RH DEV subscription deployments
# the following vars need approprivate overrides:
defaults:
# Subscription
serviceClusterSubscription: ARO Hosted Control Planes (EA Subscription 1)
managementClusterSubscription: ARO Hosted Control Planes (EA Subscription 1)
# DNS
baseDnsZoneName: 'hcp.osadev.cloud'
# MGMTM AKS nodepools - big enough for 2 HCPs
Expand Down Expand Up @@ -136,11 +142,11 @@ clouds:
# Shared Image Sync
imageSyncRG: hcp-underlay-westus3-imagesync-dev
# OIDC
oidcStorageAccountName: {{ azureStorageAccountName "arohcpoidc" 5 .ctx.region .ctx.regionStamp }}
oidcStorageAccountName: arohcpoidc{{ .ctx.regionShort }}
# Metrics
monitoringWorkspaceName: 'aro-hcp-monitor-{{ uniqueString 5 .ctx.region .ctx.regionStamp}}'
grafanaName: 'aro-hcp-grafana-{{ uniqueString 5 .ctx.region .ctx.regionStamp}}'
monitoringMsiName: 'aro-hcp-metrics-msi-{{ uniqueString 5 .ctx.region .ctx.regionStamp }}'
monitoringWorkspaceName: 'arohcp-{{ .ctx.regionShort }}'
grafanaName: 'arohcp-{{ .ctx.regionShort }}'
monitoringMsiName: 'aro-hcp-metrics-msi-{{ .ctx.regionShort }}'
grafanaAdminGroupPrincipalId: 6b6d3adf-8476-4727-9812-20ffdef2b85c
# DEVOPS MSI
aroDevopsMsiId: '/subscriptions/1d3378d3-5a3f-4712-85a1-2485495dfc4b/resourceGroups/global/providers/Microsoft.ManagedIdentity/userAssignedIdentities/aro-hcp-devops'
Expand All @@ -153,6 +159,9 @@ clouds:
mgmtUserAgentPoolMaxCount: 12
# DNS
regionalDNSSubdomain: '{{ .ctx.region }}'
regions:
westus2:
mgmtUserAgentPoolMinCount: 5
cs-pr:
# this is the cluster service PR check and full cycle test environment
defaults:
Expand All @@ -169,7 +178,7 @@ clouds:
# Cluster Service
clusterServicePostgresDeploy: false
# DNS
regionalDNSSubdomain: '{{ .ctx.region }}-{{ uniqueString 5 .ctx.region .ctx.regionStamp }}'
regionalDNSSubdomain: '{{ .ctx.regionShort }}'
# Hypershift
# uncomment the following line if you want to install the hypershift operator
# with CRD support for managedIdentities
Expand Down
12 changes: 2 additions & 10 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,9 @@ github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7Oputl
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
github.com/Masterminds/vcs v1.13.3 h1:IIA2aBdXvfbIM+yl/eTnL4hb1XwdpvuQLglAix1gweE=
Expand Down Expand Up @@ -745,6 +741,8 @@ github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14j
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c=
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
Expand Down Expand Up @@ -929,8 +927,6 @@ github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef/go.mod h1:lADxMC39cJ
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4=
github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
Expand Down Expand Up @@ -1285,8 +1281,6 @@ github.com/shibumi/go-pathspec v1.3.0 h1:QUyMZhFo0Md5B8zV8x2tesohbb5kfbpTi9rBnKh
github.com/shibumi/go-pathspec v1.3.0/go.mod h1:Xutfslp817l2I1cZvgcfeMQJG5QnU2lh5tVaaMCl3jE=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c/go.mod h1:owqhoLW1qZoYLZzLnBw+QkPP9WZnjlSWihhxAJC1+/M=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sigstore/protobuf-specs v0.3.0 h1:E49qS++llp4psM+3NNVEb+C4AD422bT9VkOQIPrNLpA=
Expand Down Expand Up @@ -1314,8 +1308,6 @@ github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w=
github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
Expand Down
4 changes: 4 additions & 0 deletions maestro/server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ DEPLOY_ENV ?= personal-dev
$(shell ../../templatize.sh $(DEPLOY_ENV) config.tmpl.mk config.mk)
include config.mk

hi:
@echo "Hello, World!"
kubectl get ns

deploy:
kubectl create namespace maestro --dry-run=client -o json | kubectl apply -f -
ISTO_VERSION=$(shell az aks show -n ${AKS_NAME} -g ${SVC_RG} --query serviceMeshProfile.istio.revisions[-1] -o tsv) && \
Expand Down
30 changes: 30 additions & 0 deletions maestro/server/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
serviceGroup: Microsoft.Azure.ARO.Test
rolloutName: Maestro Server Rollout
steps:
- name: deploy
subscription: {{ .serviceClusterSubscription }}
resourceGroup: {{ .serviceClusterRG }}
aksCluster: {{ .aksName }}
action:
type: Shell
command: ["/bin/bash", "-c", "make deploy"]
# we could infer the pwd from the location of this file and could avoid make -C
env:
- name: EVENTGRID_NAME
configRef: maestroEventgridName
- name: REGION_RG
configRef: regionRG
- name: SVC_RG
configRef: serviceClusterRG
- name: AKS_NAME
configRef: aksName
- name: IMAGE_BASE
configRef: maestroImageBase
- name: IMAGE_TAG
configRef: maestroImageTag
- name: USE_AZURE_DB
configRef: maestroPostgresDeploy
- name: ISTIO_RESTRICT_INGRESS
configRef: maestroRestrictIstioIngress
- name: KEYVAULT_NAME
configRef: maestroKeyVaultName
41 changes: 35 additions & 6 deletions templatize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,39 @@ while getopts "c:r:x:e:" opt; do
esac
done

# short names from EV2 prod ServiceConfig
case ${REGION} in
eastus)
REGION_SHORT="bl"
;;
westus)
REGION_SHORT="by"
;;
centralus)
REGION_SHORT="dm"
;;
northcentralus)
REGION_SHORT="ch"
;;
southcentralus)
REGION_SHORT="sn"
;;
westus2)
REGION_SHORT="mwh"
;;
westus3)
REGION_SHORT="usw3"
;;
*)
echo "unsupported region: ${REGION}"
exit 1
esac

if [ "$DEPLOY_ENV" == "personal-dev" ]; then
REGION_STAMP=${USER}
REGION_STAMP="${REGION_SHORT}${USER:0:4}"
else
REGION_STAMP=${DEPLOY_ENV}
CLEAN_DEPLOY_ENV=$(echo "${DEPLOY_ENV}" | tr -cd '[:alnum:]')
REGION_STAMP="${CLEAN_DEPLOY_ENV}"
fi

TEMPLATIZE=${PROJECT_ROOT_DIR}/tooling/templatize/templatize
Expand All @@ -79,8 +108,8 @@ if [ -n "$INPUT" ] && [ -n "$OUTPUT" ]; then
--cloud=${CLOUD} \
--deploy-env=${DEPLOY_ENV} \
--region=${REGION} \
--region-stamp=${REGION_STAMP} \
--cx-stamp=${CXSTAMP} \
--region-short=${REGION_STAMP} \
--stamp=${CXSTAMP} \
--input=${INPUT} \
--output=${OUTPUT} \
${EXTRA_ARGS}
Expand All @@ -90,7 +119,7 @@ else
--cloud=${CLOUD} \
--deploy-env=${DEPLOY_ENV} \
--region=${REGION} \
--region-stamp=${REGION_STAMP} \
--cx-stamp=${CXSTAMP} \
--region-short=${REGION_STAMP} \
--stamp=${CXSTAMP} \
${EXTRA_ARGS}
fi
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"

"github.com/Azure/ARO-HCP/tooling/templatize/internal/config"
options "github.com/Azure/ARO-HCP/tooling/templatize/cmd"
"github.com/Azure/ARO-HCP/tooling/templatize/pkg/config"
)

func TestExecuteTemplate(t *testing.T) {
for _, testCase := range []struct {
name string
config config.Variables
input string
name string
vars config.Variables
input string

expected string
expectedError bool
}{
{
name: "happy case generates a file",
config: config.Variables{
vars: config.Variables{
"region_maestro_keyvault": "kv",
"region_eventgrid_namespace": "ns",
},
Expand All @@ -36,7 +37,7 @@ param maestroEventGridMaxClientSessionsPerAuthName = 4`,
},
{
name: "referencing unset variable errors",
config: config.Variables{
vars: config.Variables{
"region_maestro_keyvault": "kv",
},
input: `param maestroKeyVaultName = '{{ .region_maestro_keyvault }}'
Expand All @@ -49,10 +50,10 @@ param maestroEventGridMaxClientSessionsPerAuthName = 4`,
output := &bytes.Buffer{}
opts := GenerationOptions{
completedGenerationOptions: &completedGenerationOptions{
Config: testCase.config,
Input: fstest.MapFS{"test": &fstest.MapFile{Data: []byte(testCase.input)}},
InputFile: "test",
Output: &nopCloser{Writer: output},
InputFS: fstest.MapFS{"test": &fstest.MapFile{Data: []byte(testCase.input)}},
InputFile: "test",
OutputFile: &nopCloser{Writer: output},
RolloutOptions: options.NewRolloutOptions(testCase.vars),
},
}
err := opts.ExecuteTemplate()
Expand Down
Loading

0 comments on commit a6a0fdd

Please sign in to comment.