in pkg/environment/environment.go [255:321]
func ValidateEnv(env EnvVariables) error {
if env.EnableDeployAppGateway {
// we should not allow applicationGatewayID in create case
if len(env.AppGwResourceID) != 0 {
return controllererrors.NewError(
controllererrors.ErrorNotAllowedApplicationGatewayID,
"Please provide provide APPGW_NAME (helm var name: .appgw.name) instead of APPGW_RESOURCE_ID (helm var name: .appgw.applicationGatewayID). "+
"You can also provided APPGW_SUBSCRIPTION_ID and APPGW_RESOURCE_GROUP",
)
}
// if deploy is true, we need applicationGatewayName
if len(env.AppGwName) == 0 {
return controllererrors.NewError(
controllererrors.ErrorMissingApplicationGatewayName,
"Missing required Environment variables: AGIC requires APPGW_NAME (helm var name: appgw.name) to deploy Application Gateway",
)
}
// we need one of subnetID and subnetPrefix. We generate a subnetName if it is not provided.
if len(env.AppGwSubnetID) == 0 && len(env.AppGwSubnetPrefix) == 0 {
// when create is true, then either we should have env.AppGwSubnetID or env.AppGwSubnetPrefix
return controllererrors.NewError(
controllererrors.ErrorMissingSubnetInfo,
"Missing required Environment variables: "+
"AGIC requires APPGW_SUBNET_PREFIX (helm var name: appgw.subnetPrefix) or APPGW_SUBNET_ID (helm var name: appgw.subnetID) of an existing subnet. "+
"If subnetPrefix is specified, AGIC will look up a subnet with matching address prefix in the AKS cluster vnet. "+
"If a subnet is not found, then a new subnet will be created. This will be used to deploy the Application Gateway",
)
}
} else {
// if deploy is false, we need one of appgw name or resource id
if len(env.AppGwName) == 0 && len(env.AppGwResourceID) == 0 {
return controllererrors.NewError(
controllererrors.ErrorMissingApplicationGatewayNameOrApplicationGatewayID,
"Missing required Environment variables: "+
"Provide atleast provide APPGW_NAME (helm var name: .appgw.name) or APPGW_RESOURCE_ID (helm var name: .appgw.applicationGatewayID). "+
"If providing APPGW_NAME, You can also provided APPGW_SUBSCRIPTION_ID (helm var name: .appgw.subscriptionId) and APPGW_RESOURCE_GROUP (helm var name: .appgw.resourceGroup)",
)
}
}
if env.WatchNamespace == "" {
klog.V(1).Infof("%s is not set. Watching all available namespaces.", WatchNamespaceVarName)
}
if env.ReconcilePeriodSeconds != "" {
reconcilePeriodSeconds, err := strconv.Atoi(env.ReconcilePeriodSeconds)
if err != nil {
return controllererrors.NewErrorWithInnerError(
controllererrors.ErrorInvalidReconcilePeriod,
err,
"Please make sure that RECONCILE_PERIOD_SECONDS (helm var name: .reconcilePeriodSeconds) is an integer. Range: (30 - 300)",
)
}
if reconcilePeriodSeconds < 30 || reconcilePeriodSeconds > 300 {
return controllererrors.NewError(
controllererrors.ErrorInvalidReconcilePeriod,
"Please make sure that RECONCILE_PERIOD_SECONDS (helm var name: .reconcilePeriodSeconds) is an integer. Range: (30 - 300)",
)
}
}
return nil
}