Skip to content
Draft
3 changes: 3 additions & 0 deletions pkg/deploy/assets/gateway-production-parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"databaseAccountName": {
"value": ""
},
"environmentType": {
"value": ""
},
"fluentbitImage": {
"value": ""
},
Expand Down
5 changes: 4 additions & 1 deletion pkg/deploy/assets/gateway-production.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pkg/deploy/assets/rp-production-parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
"disableCosmosDBFirewall": {
"value": false
},
"environmentType": {
"value": ""
},
"fluentbitImage": {
"value": ""
},
Expand Down
5 changes: 4 additions & 1 deletion pkg/deploy/assets/rp-production.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pkg/deploy/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ type Configuration struct {
MsiRpEndpoint *string `json:"msiRpEndpoint,omitempty" value:"required"`
TokenContributorRoleID *string `json:"tokenContributorRoleID,omitempty" value:"required"`
TokenContributorRoleName *string `json:"tokenContributorRoleName,omitempty" value:"required"`
EnvironmentType *string `json:"environmentType,omitempty" value:"required"`

// Log levels for ARO services running on the VMSSes
RPLogLevel *string `json:"rpLogLevel,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions pkg/deploy/generator/resources_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ func (g *generator) gatewayVMSS() *arm.Resource {
"azureSecPackQualysUrl",
"azureSecPackVSATenantId",
"databaseAccountName",
"environmentType",
"fluentbitImage",
"gatewayDomains",
"gatewayFeatures",
Expand Down
1 change: 1 addition & 0 deletions pkg/deploy/generator/resources_rp.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ func (g *generator) rpVMSS() *arm.Resource {
"otelAuditQueueSize",
"tokenContributorRoleID",
"tokenContributorRoleName",
"environmentType",

// Log levels
"rpLogLevel",
Expand Down
8 changes: 7 additions & 1 deletion pkg/deploy/generator/scripts/gatewayVMSS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ main() {
Remove_wildcard _
Remove TIMESTAMP

[FILTER]
Name modify
Match journald
Add ENVIRONMENT_TYPE \${ENVIRONMENT_TYPE}

[OUTPUT]
Name forward
Match *
Expand All @@ -107,7 +112,8 @@ MDM_ACCOUNT='$RPMDMACCOUNT'
MDM_NAMESPACE='${role_gateway^}'
GATEWAY_DOMAINS='$GATEWAYDOMAINS'
GATEWAY_FEATURES='$GATEWAYFEATURES'
RPIMAGE='$rpimage'"
RPIMAGE='$rpimage'
ENVIRONMENTTYPE='$ENVIRONMENTTYPE'"

# shellcheck disable=SC2034
local -r mdsd_config_version="$GATEWAYMDSDCONFIGVERSION"
Expand Down
6 changes: 6 additions & 0 deletions pkg/deploy/generator/scripts/rpVMSS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ main() {
Remove_wildcard _
Remove TIMESTAMP

[FILTER]
Name modify
Match journald
Add ENVIRONMENT_TYPE \${ENVIRONMENT_TYPE}

[FILTER]
Name rewrite_tag
Match journald
Expand Down Expand Up @@ -188,6 +193,7 @@ OIDC_AFD_ENDPOINT='$LOCATION.oic.$RPPARENTDOMAINNAME'
OIDC_STORAGE_ACCOUNT_NAME='$OIDCSTORAGEACCOUNTNAME'
OTEL_AUDIT_QUEUE_SIZE='$OTELAUDITQUEUESIZE'
MSI_RP_ENDPOINT='$MSIRPENDPOINT'
ENVIRONMENT_TYPE='$ENVIRONMENTTYPE'
"

configure_vmss_aro_services role_rp \
Expand Down
30 changes: 25 additions & 5 deletions pkg/deploy/generator/scripts/util-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ configure_service_aro_gateway() {
local -r add_conf_file="PODMAN_NETWORK='podman'
IPADDRESS='$ipaddress'
ROLE='${role,,}'
ARO_LOG_LEVEL='$GATEWAYLOGLEVEL'"
ARO_LOG_LEVEL='$GATEWAYLOGLEVEL'
ENVIRONMENT_TYPE='$ENVIRONMENTTYPE'"

write_file aro_gateway_conf_filename conf_file true
write_file aro_gateway_conf_filename add_conf_file false
Expand Down Expand Up @@ -68,6 +69,7 @@ ExecStart=/usr/bin/podman run \
-e MDM_ACCOUNT \
-e MDM_NAMESPACE \
-e ARO_LOG_LEVEL \
-e ENVIRONMENT_TYPE \
-m 2g \
--network=${PODMAN_NETWORK} \
--ip ${IPADDRESS} \
Expand Down Expand Up @@ -108,6 +110,7 @@ configure_service_aro_rp() {
local -r aro_rp_conf_filename='/etc/sysconfig/aro-rp'
local -r add_conf_file="PODMAN_NETWORK='podman'
IPADDRESS='$ipaddress'
ENVIRONMENT_TYPE='$ENVIRONMENTTYPE'
ROLE='${role,,}'
ARO_LOG_LEVEL='$RPLOGLEVEL'"

Expand Down Expand Up @@ -159,6 +162,7 @@ ExecStart=/usr/bin/podman run \
-e OTEL_AUDIT_QUEUE_SIZE \
-e MISE_ADDRESS \
-e ARO_LOG_LEVEL \
-e ENVIRONMENT_TYPE \
-m 2g \
--network=${PODMAN_NETWORK} \
--ip ${IPADDRESS} \
Expand Down Expand Up @@ -207,6 +211,7 @@ CLUSTER_MDSD_NAMESPACE='$CLUSTERMDSDNAMESPACE'
CLUSTER_MDM_ACCOUNT='$CLUSTERMDMACCOUNT'
CLUSTER_MDM_NAMESPACE=BBM
DATABASE_ACCOUNT_NAME='$DATABASEACCOUNTNAME'
ENVIRONMENT_TYPE='$ENVIRONMENTTYPE'
KEYVAULT_PREFIX='$KEYVAULTPREFIX'
MDM_ACCOUNT='$RPMDMACCOUNT'
MDM_NAMESPACE=BBM
Expand Down Expand Up @@ -257,6 +262,7 @@ ExecStart=/usr/bin/podman run \
-e ARO_HIVE_DEFAULT_INSTALLER_PULLSPEC \
-e ARO_ADOPT_BY_HIVE \
-e ARO_LOG_LEVEL \
-e ENVIRONMENT_TYPE \
-m 2.5g \
-v /run/systemd/journal:/run/systemd/journal \
-v /var/etw:/var/etw:z \
Expand Down Expand Up @@ -293,6 +299,7 @@ KEYVAULT_PREFIX='$KEYVAULTPREFIX'
MDM_ACCOUNT='$RPMDMACCOUNT'
MDM_NAMESPACE=Portal
PORTAL_HOSTNAME='$LOCATION.admin.$RPPARENTDOMAINNAME'
ENVIRONMENT_TYPE='$ENVIRONMENTTYPE'
OTEL_AUDIT_QUEUE_SIZE='$OTELAUDITQUEUESIZE'
RPIMAGE='$image'
PODMAN_NETWORK='podman'
Expand Down Expand Up @@ -331,6 +338,7 @@ ExecStart=/usr/bin/podman run \
-e PORTAL_HOSTNAME \
-e OTEL_AUDIT_QUEUE_SIZE \
-e ARO_LOG_LEVEL \
-e ENIVRONMETN_TYPE \
-m 2g \
-p 444:8444 \
-p 2222:2222 \
Expand Down Expand Up @@ -397,6 +405,7 @@ ExecStart=/usr/bin/podman run \
-e CLUSTER_MDSD_NAMESPACE \
-e DATABASE_ACCOUNT_NAME \
-e DOMAIN_NAME \
-e ENVIRONMENT_TYPE \
-e GATEWAY_DOMAINS \
-e GATEWAY_RESOURCEGROUP \
-e KEYVAULT_PREFIX \
Expand Down Expand Up @@ -456,7 +465,8 @@ MISEVALIDAUDIENCES='$MISEVALIDAUDIENCES'
MISEVALIDAPPIDS='$MISEVALIDAPPIDS'
LOGININSTANCE='$LOGININSTANCE'
PODMAN_NETWORK='podman'
IPADDRESS='$ipaddress'"
IPADDRESS='$ipaddress'
ENVIRONMENT_TYPE='$ENVIRONMENTTYPE'"

write_file aro_mise_service_conf_filename aro_mise_service_conf_file true

Expand Down Expand Up @@ -550,6 +560,7 @@ ExecStart=/usr/bin/podman run \
--network=${PODMAN_NETWORK} \
--ip ${IPADDRESS} \
--rm \
-e ENVIRONMENT_TYPE \
${MISEIMAGE}
ExecStop=/usr/bin/podman stop %N
Restart=always
Expand Down Expand Up @@ -578,7 +589,8 @@ configure_service_aro_otel_collector() {
local -r aro_otel_collector_service_conf_file="GOMEMLIMIT=1000MiB
OTELIMAGE='$image'
PODMAN_NETWORK='podman'
IPADDRESS='$ipaddress'"
IPADDRESS='$ipaddress'
ENVIRONMENT_TYPE='$ENVIRONMENTTYPE'"

write_file aro_otel_collector_service_conf_filename aro_otel_collector_service_conf_file true

Expand Down Expand Up @@ -610,6 +622,9 @@ processors:
- key: \"host\"
action: insert
value: \"$(hostname)\"
- key: \"environmentType\"
action: insert
value: \"$ENVIRONMENTTYPE\"
extensions:
health_check:
endpoint: $ipaddress:13133
Expand Down Expand Up @@ -648,6 +663,7 @@ ExecStart=/usr/bin/podman run \
--network=${PODMAN_NETWORK} \
--ip ${IPADDRESS} \
-m 2g \
-e ENVIRONMENT_TYPE \
-v /app/otel/config.yaml:/etc/otelcol-contrib/config.yaml:z \
${OTELIMAGE}
ExecStop=/usr/bin/podman stop %N
Expand Down Expand Up @@ -698,10 +714,10 @@ export MONITORING_GCS_AUTH_ID='$mdsd_certificate_san'
export MONITORING_GCS_NAMESPACE='$RPMDSDNAMESPACE'
export MONITORING_CONFIG_VERSION='$monitor_config_version'
export MONITORING_USE_GENEVA_CONFIG_SERVICE=true

export MONITORING_TENANT='$LOCATION'
export MONITORING_ROLE='$role'
export MONITORING_ROLE_INSTANCE=\"$(hostname)\"
export MONITORING_ENVIRONMENT_TYPE='$ENVIRONMENTTYPE'

export MDSD_MSGPACK_SORT_COLUMNS=\"1\""

Expand Down Expand Up @@ -730,7 +746,8 @@ configure_service_fluentbit() {
# shellcheck disable=SC2034
local -r sysconfig_filename='/etc/sysconfig/fluentbit'
# shellcheck disable=SC2034
local -r sysconfig_file="FLUENTBITIMAGE=$image"
local -r sysconfig_file="FLUENTBITIMAGE='$image'
ENVIRONMENT_TYPE='$ENVIRONMENTTYPE'"

write_file sysconfig_filename sysconfig_file true

Expand All @@ -755,6 +772,7 @@ ExecStart=/usr/bin/podman run \
--hostname %H \
--name %N \
--rm \
-e ENVIRONMENT_TYPE \
--cap-drop net_raw \
-v /etc/fluentbit/fluentbit.conf:/etc/fluentbit/fluentbit.conf \
-v /var/lib/fluent:/var/lib/fluent:z \
Expand Down Expand Up @@ -956,6 +974,7 @@ MDM_INPUT=statsd_local,otlp_grpc
MDM_NAMESPACE='OTEL'
MDM_ACCOUNT='AzureRedHatOpenShiftRP'
PODMAN_NETWORK='podman'
ENVIRONMENT_TYPE='$ENVIRONMENTTYPE'
IPADDRESS='$ipaddress'"

write_file sysconfig_mdm_filename sysconfig_mdm_file true
Expand All @@ -981,6 +1000,7 @@ ExecStart=/usr/bin/podman run \
--cap-drop net_raw \
--network=${PODMAN_NETWORK} \
--ip ${IPADDRESS} \
-e ENVIRONMENT_TYPE \
-m 2g \
-v /etc/mdm.pem:/etc/mdm.pem \
-v /var/etw:/var/etw:z \
Expand Down
1 change: 1 addition & 0 deletions pkg/deploy/generator/templates_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func (g *generator) gatewayTemplate() *arm.Template {
"azureSecPackQualysUrl",
"azureSecPackVSATenantId",
"databaseAccountName",
"environmentType",
"fluentbitImage",
"gatewayDomains",
"gatewayFeatures",
Expand Down
1 change: 1 addition & 0 deletions pkg/deploy/generator/templates_rp.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func (g *generator) rpTemplate() *arm.Template {
"clusterMdsdConfigVersion",
"clusterMdsdNamespace",
"cosmosDB",
"environmentType",
"disableCosmosDBFirewall",
"fluentbitImage",
"fpClientId",
Expand Down
6 changes: 6 additions & 0 deletions pkg/env/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package env
import (
"context"
"crypto/fips140"
"os"
"strings"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -51,6 +52,7 @@ type Core interface {
Service() string
Logger() *logrus.Entry
LoggerForComponent(string) *logrus.Entry
EnvironmentType() string
}

type core struct {
Expand Down Expand Up @@ -88,6 +90,10 @@ func (c *core) LoggerForComponent(component string) *logrus.Entry {
return c.serviceLog.WithField("component", component)
}

func (c *core) EnvironmentType() string {
return os.Getenv("ENVIRONMENT_TYPE")
}

func (c *core) NewLiveConfigManager(ctx context.Context) (liveconfig.Manager, error) {
credential, err := c.NewMSITokenCredential()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ type Interface interface {
AROOperatorImage() string
LiveConfig() liveconfig.Manager
ClusterCertificates() azcertificates.Client
EnvironmentType() string
}

func NewEnv(ctx context.Context, log *logrus.Entry, component ServiceName) (Interface, error) {
Expand Down
7 changes: 7 additions & 0 deletions pkg/env/prod.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ type prod struct {

log *logrus.Entry

environmentType string

features map[Feature]bool
}

Expand Down Expand Up @@ -125,6 +127,7 @@ func newProd(ctx context.Context, log *logrus.Entry, service ServiceName) (*prod
clusterGenevaLoggingConfigVersion: os.Getenv("CLUSTER_MDSD_CONFIG_VERSION"),
clusterGenevaLoggingEnvironment: os.Getenv("MDSD_ENVIRONMENT"),
clusterGenevaLoggingNamespace: os.Getenv("CLUSTER_MDSD_NAMESPACE"),
environmentType: os.Getenv("ENVIRONMENT_TYPE"),

log: log,

Expand Down Expand Up @@ -406,6 +409,10 @@ func (p *prod) Domain() string {
return os.Getenv("DOMAIN_NAME")
}

func (p *prod) EnvironmentType() string {
return p.environmentType
}

func (p *prod) FeatureIsSet(f Feature) bool {
return p.features[f]
}
Expand Down
12 changes: 7 additions & 5 deletions pkg/metrics/statsd/statsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ func New(ctx context.Context, env env.Core, account, namespace string, mdmSocket
mdmSocketEnv: mdmSocketEnv,

extraDimensions: map[string]string{
"hostname": env.Hostname(),
"location": env.Location(),
"service": env.Service(),
"version": version.GitCommit,
"hostname": env.Hostname(),
"location": env.Location(),
"service": env.Service(),
"version": version.GitCommit,
"environmentType": env.EnvironmentType(),
},

ch: make(chan *metric, 1024),
Expand Down Expand Up @@ -83,7 +84,8 @@ func NewMetricsForCluster(ctx context.Context, env env.Core, account, namespace
mdmSocketEnv: mdmSocketEnv,

extraDimensions: map[string]string{
"location": env.Location(),
"location": env.Location(),
"environmentType": env.EnvironmentType(),
},

ch: make(chan *metric, 1024),
Expand Down
14 changes: 14 additions & 0 deletions pkg/util/mocks/env/core.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions pkg/util/mocks/env/env.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading