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

Implementation of MISE middleware #4070

Open
wants to merge 4 commits into
base: master
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
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 Down Expand Up @@ -102,6 +105,12 @@
"mdsdEnvironment": {
"value": ""
},
"miseValidAppIDs": {
"value": ""
},
"miseValidAudiences": {
"value": ""
},
"msiRpEndpoint": {
"value": ""
},
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 @@ -64,6 +64,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 @@ -79,6 +80,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 @@ -150,6 +150,7 @@ func DevConfig(_env env.Core) (*Config, error) {
FluentbitImage: pointerutils.ToPtr(version.FluentbitImage(azureUniquePrefix + "aro." + _env.Environment().ContainerRegistryDNSSuffix)),
FPClientID: pointerutils.ToPtr(os.Getenv("AZURE_FP_CLIENT_ID")),
FPServicePrincipalID: pointerutils.ToPtr(os.Getenv("AZURE_FP_SERVICE_PRINCIPAL_ID")),
FPTenantID: pointerutils.ToPtr(os.Getenv("AZURE_TENANT_ID")),
GatewayDomains: []string{
"eastus-shared.ppe.warm.ingest.monitor.core.windows.net",
"gcs.ppe.monitoring.core.windows.net",
Expand All @@ -171,6 +172,13 @@ func DevConfig(_env env.Core) (*Config, error) {
MDMFrontendURL: pointerutils.ToPtr("https://global.ppe.microsoftmetrics.com/"),
MDSDEnvironment: pointerutils.ToPtr(version.DevGenevaLoggingEnvironment),
MsiRpEndpoint: pointerutils.ToPtr("https://iamaplaceholder.com"),
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 @@ -188,6 +196,7 @@ func DevConfig(_env env.Core) (*Config, error) {
"EnableOCMEndpoints",
"RequireOIDCStorageWebEndpoint",
"UseMockMsiRp",
"EnableMISE",
},
// TODO update this to support FF
RPImagePrefix: pointerutils.ToPtr(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 @@ -410,6 +411,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 @@ -425,6 +438,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
8 changes: 8 additions & 0 deletions pkg/deploy/generator/scripts/gatewayVMSS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ RPIMAGE='$rpimage'"
["gateway_config"]="aro_gateway_conf_file"
["fluentbit"]="fluentbit_conf_file"
["mdsd"]="mdsd_config_version"
["static_ip_address"]="static_ip_addresses"
)

# shellcheck disable=SC2034
# use default podman network with range 10.88.0.0/16
local -rA static_ip_addresses=(
["gateway"]="10.88.0.2"
["mdm"]="10.88.0.8"
)

configure_vmss_aro_services role_gateway \
Expand Down
56 changes: 40 additions & 16 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 @@ -56,22 +56,21 @@ 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

local -r aro_network="aro"
# shellcheck disable=SC2034
local -rA networks=(
["$aro_network"]="192.168.254.0/24"
)
# shellcheck disable=SC2034
local -ra enable_ports=(
# RP frontend
Expand All @@ -93,6 +92,18 @@ main() {
Systemd_Filter _COMM=aro
DB /var/lib/fluent/journaldb
[INPUT]
Name systemd
Tag journald
Systemd_Filter _SYSTEMD_UNIT=aro-mise.service
DB /var/lib/fluent/journaldb
[INPUT]
Name systemd
Tag journald
Systemd_Filter _SYSTEMD_UNIT=aro-otel-collector.service
DB /var/lib/fluent/journaldb
[FILTER]
Name modify
Match journald
Expand Down Expand Up @@ -121,6 +132,25 @@ main() {
Match *
Port 29230"

# values are references to variables, they should not be dereferenced here
# shellcheck disable=SC2034
local -rA aro_configs=(
["rp_config"]="aro_rp_conf_file"
["fluentbit"]="fluentbit_conf_file"
["mdsd"]="mdsd_config_version"
["static_ip_address"]="static_ip_addresses"
)

# shellcheck disable=SC2034
# use default podman network with range 10.88.0.0/16
local -rA static_ip_addresses=(
["rp"]="10.88.0.2"
["monitor"]="10.88.0.3"
["portal"]="10.88.0.4"
["mise"]="10.88.0.5"
["otel_collector"]="10.88.0.6"
["mdm"]="10.88.0.8"
)

# shellcheck disable=SC2034
local -r mdsd_config_version="$RPMDSDCONFIGVERSION"
Expand All @@ -144,6 +174,7 @@ KEYVAULT_PREFIX='$KEYVAULTPREFIX'
MDM_ACCOUNT='$RPMDMACCOUNT'
MDM_NAMESPACE='${role_rp^^}'
MDSD_ENVIRONMENT='$MDSDENVIRONMENT'
MISE_ADDRESS='http://${static_ip_addresses["mise"]}:5000'
RP_FEATURES='$RPFEATURES'
RPIMAGE='$rpimage'
ARO_INSTALL_VIA_HIVE='$CLUSTERSINSTALLVIAHIVE'
Expand All @@ -155,22 +186,15 @@ OTEL_AUDIT_QUEUE_SIZE='$OTELAUDITQUEUESIZE'
MSI_RP_ENDPOINT='$MSIRPENDPOINT'
"

# values are references to variables, they should not be dereferenced here
# shellcheck disable=SC2034
local -rA aro_configs=(
["rp_config"]="aro_rp_conf_file"
["fluentbit"]="fluentbit_conf_file"
["mdsd"]="mdsd_config_version"
["network"]="aro_network"
)

configure_vmss_aro_services role_rp \
aro_images \
aro_configs

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