@@ -10,18 +10,19 @@ import (
10
10
"gopkg.in/gcfg.v1"
11
11
"gopkg.in/ini.v1"
12
12
13
+ "github.com/openshift/library-go/pkg/operator/configobserver/featuregates"
13
14
awsconfig "k8s.io/cloud-provider-aws/pkg/providers/v1/config"
14
15
)
15
16
16
17
// CloudConfigTransformer is used to inject OpenShift configuration defaults into the Cloud Provider config
17
18
// for the AWS Cloud Provider.
18
- func CloudConfigTransformer (source string , infra * configv1.Infrastructure , network * configv1.Network ) (string , error ) {
19
+ func CloudConfigTransformer (source string , infra * configv1.Infrastructure , network * configv1.Network , features featuregates. FeatureGate ) (string , error ) {
19
20
cfg , err := readAWSConfig (source )
20
21
if err != nil {
21
22
return "" , fmt .Errorf ("failed to read the cloud.conf: %w" , err )
22
23
}
23
24
24
- setOpenShiftDefaults (cfg )
25
+ setOpenShiftDefaults (cfg , features )
25
26
26
27
return marshalAWSConfig (cfg )
27
28
}
@@ -76,11 +77,19 @@ func marshalAWSConfig(cfg *awsconfig.CloudConfig) (string, error) {
76
77
return buf .String (), nil
77
78
}
78
79
79
- func setOpenShiftDefaults (cfg * awsconfig.CloudConfig ) {
80
+ func setOpenShiftDefaults (cfg * awsconfig.CloudConfig , features featuregates. FeatureGate ) {
80
81
if cfg .Global .ClusterServiceLoadBalancerHealthProbeMode == "" {
81
82
// OpenShift uses Shared mode by default.
82
83
// This attaches the health check for Cluster scope services to the "kube-proxy"
83
84
// health check endpoint served by OVN.
84
85
cfg .Global .ClusterServiceLoadBalancerHealthProbeMode = "Shared"
85
86
}
87
+ if features .Enabled ("AWSServiceLBNetworkSecurityGroup" ) {
88
+ if cfg .Global .NLBSecurityGroupMode != awsconfig .NLBSecurityGroupModeManaged {
89
+ // OpenShift enforces security group by default when deploying
90
+ // service type loadbalancer NLB.
91
+ cfg .Global .NLBSecurityGroupMode = awsconfig .NLBSecurityGroupModeManaged
92
+ }
93
+ }
94
+
86
95
}
0 commit comments