Skip to content

Commit

Permalink
implementation of MISE middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
SrinivasAtmakuri committed Sep 11, 2024
1 parent 635c5a3 commit 65cb0cb
Show file tree
Hide file tree
Showing 24 changed files with 1,006 additions and 61 deletions.
2 changes: 1 addition & 1 deletion pkg/deploy/assets/gateway-production.json

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions pkg/deploy/assets/rp-production-parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
"fpServicePrincipalId": {
"value": ""
},
"fpTenantId": {
"value": ""
},
"gatewayDomains": {
"value": ""
},
Expand All @@ -99,6 +102,12 @@
"mdsdEnvironment": {
"value": ""
},
"miseValidAppIDs": {
"value": ""
},
"miseValidAudiences": {
"value": ""
},
"nonZonalRegions": {
"value": [
"eastasia",
Expand Down
11 changes: 10 additions & 1 deletion pkg/deploy/assets/rp-production.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pkg/deploy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type Configuration struct {
ExtraServiceKeyvaultAccessPolicies []interface{} `json:"extraServiceKeyvaultAccessPolicies,omitempty" value:"required"`
FluentbitImage *string `json:"fluentbitImage,omitempty" value:"required"`
FPClientID *string `json:"fpClientId,omitempty" value:"required"`
FPTENANTID *string `json:"fpTenantId,omitempty" value:"required"`
FPServerCertCommonName *string `json:"fpServerCertCommonName,omitempty"`
FPServicePrincipalID *string `json:"fpServicePrincipalId,omitempty" value:"required"`
GatewayDomains []string `json:"gatewayDomains,omitempty"`
Expand All @@ -78,6 +79,8 @@ type Configuration struct {
KeyvaultPrefix *string `json:"keyvaultPrefix,omitempty" value:"required"`
MDMFrontendURL *string `json:"mdmFrontendUrl,omitempty" value:"required"`
MDSDEnvironment *string `json:"mdsdEnvironment,omitempty" value:"required"`
MISEVALIDAUDIENCES []string `json:"miseValidAudiences,omitempty"`
MISEVALIDAPPIDs []string `json:"miseValidAppIDs,omitempty"`
NonZonalRegions []string `json:"nonZonalRegions,omitempty"`
PortalAccessGroupIDs []string `json:"portalAccessGroupIds,omitempty" value:"required"`
PortalClientID *string `json:"portalClientId,omitempty" value:"required"`
Expand Down
9 changes: 9 additions & 0 deletions pkg/deploy/devconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func DevConfig(_env env.Core) (*Config, error) {
},
FluentbitImage: to.StringPtr(version.FluentbitImage(azureUniquePrefix + "aro." + _env.Environment().ContainerRegistryDNSSuffix)),
FPClientID: to.StringPtr(os.Getenv("AZURE_FP_CLIENT_ID")),
FPTENANTID: to.StringPtr(os.Getenv("AZURE_TENANT_ID")),
FPServicePrincipalID: to.StringPtr(os.Getenv("AZURE_FP_SERVICE_PRINCIPAL_ID")),
GatewayDomains: []string{
"eastus-shared.ppe.warm.ingest.monitor.core.windows.net",
Expand All @@ -173,6 +174,13 @@ func DevConfig(_env env.Core) (*Config, error) {
GlobalSubscriptionID: to.StringPtr(_env.SubscriptionID()),
MDMFrontendURL: to.StringPtr("https://global.ppe.microsoftmetrics.com/"),
MDSDEnvironment: to.StringPtr(version.DevGenevaLoggingEnvironment),
MISEVALIDAUDIENCES: []string{
"https://management.core.windows.net/",
_env.Environment().ResourceManagerEndpoint,
},
MISEVALIDAPPIDs: []string{
"2187cde1-7e28-4645-9104-19edfa500053",
},
PortalAccessGroupIDs: []string{
os.Getenv("AZURE_PORTAL_ACCESS_GROUP_IDS"),
},
Expand All @@ -189,6 +197,7 @@ func DevConfig(_env env.Core) (*Config, error) {
"DisableReadinessDelay",
"EnableOCMEndpoints",
"RequireOIDCStorageWebEndpoint",
"EnableMISE",
},
// TODO update this to support FF
RPImagePrefix: to.StringPtr(azureUniquePrefix + "aro.azurecr.io/aro"),
Expand Down
21 changes: 21 additions & 0 deletions pkg/deploy/generator/resources_rp.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ func (g *generator) rpVMSS() *arm.Resource {
"databaseAccountName",
"fluentbitImage",
"fpClientId",
"fpTenantId",
"fpServicePrincipalId",
"gatewayDomains",
"gatewayResourceGroupName",
Expand Down Expand Up @@ -408,6 +409,18 @@ func (g *generator) rpVMSS() *arm.Resource {
)
}

// convert array variables to string using ARM string() function to be passed via customScript later
for _, variable := range []string{
"miseValidAudiences",
"miseValidAppIDs",
} {
parts = append(parts,
fmt.Sprintf("'%s=$(base64 -d <<<'''", strings.ToUpper(variable)),
fmt.Sprintf("base64(string(parameters('%s')))", variable),
"''')\n'",
)
}

for _, variable := range []string{
"adminApiCaBundle",
"armApiCaBundle",
Expand All @@ -423,6 +436,14 @@ func (g *generator) rpVMSS() *arm.Resource {
"'MDMIMAGE=''"+version.MdmImage("")+"''\n'",
)

parts = append(parts,
"'OTELIMAGE=''"+version.OTelImage("")+"''\n'",
)

parts = append(parts,
"'MISEIMAGE=''"+version.MiseImage("")+"''\n'",
)

parts = append(parts,
"'LOCATION=$(base64 -d <<<'''",
"base64(resourceGroup().location)",
Expand Down
11 changes: 9 additions & 2 deletions pkg/deploy/generator/scripts/rpVMSS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ main() {
)

dnf_install_pkgs install_pkgs \
retry_wait_time \
"$pkg_retry_count"
retry_wait_time \
"$pkg_retry_count"

fips_configure

Expand All @@ -60,13 +60,17 @@ main() {
# shellcheck disable=SC2153 disable=SC2034
local -r mdmimage="${RPIMAGE%%/*}/${MDMIMAGE#*/}"
local -r rpimage="$RPIMAGE"
local -r miseimage="${RPIMAGE%%/*}/${MISEIMAGE#*/}"
local -r otelimage="$OTELIMAGE"
# shellcheck disable=SC2034
local -r fluentbit_image="$FLUENTBITIMAGE"
# shellcheck disable=SC2034
local -rA aro_images=(
["mdm"]="mdmimage"
["rp"]="rpimage"
["fluentbit"]="fluentbit_image"
["mise"]="miseimage"
["otel"]="otelimage"
)

pull_container_images aro_images
Expand Down Expand Up @@ -150,6 +154,7 @@ KEYVAULT_PREFIX='$KEYVAULTPREFIX'
MDM_ACCOUNT='$RPMDMACCOUNT'
MDM_NAMESPACE='${role_rp^^}'
MDSD_ENVIRONMENT='$MDSDENVIRONMENT'
MISE_ADDRESS='http://aro-mise:5000'
RP_FEATURES='$RPFEATURES'
RPIMAGE='$rpimage'
ARO_INSTALL_VIA_HIVE='$CLUSTERSINSTALLVIAHIVE'
Expand All @@ -174,7 +179,9 @@ OIDC_STORAGE_ACCOUNT_NAME='$OIDCSTORAGEACCOUNTNAME'

# shellcheck disable=SC2034
local -ra aro_services=(
"aro-mise"
"aro-monitor"
"aro-otel-collector"
"aro-portal"
"aro-rp"
"azsecd"
Expand Down
Loading

0 comments on commit 65cb0cb

Please sign in to comment.