Skip to content

Commit 752a939

Browse files
committed
Report new auto-allow-webhook-traffic configuration to Otterize cloud
1 parent 4698d93 commit 752a939

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/shared/operator_cloud_client/status_report.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ func getAllowExternalTrafficConfig() graphqlclient.AllowExternalTrafficPolicy {
9494
}
9595
}
9696

97+
func getAutomateAllowWebhookTrafficConfig() graphqlclient.AutomateThirdPartyNetworkPolicy {
98+
switch enforcement.GetConfig().AutomateAllowWebhookTraffic {
99+
case automate_third_party_network_policy.Always:
100+
return graphqlclient.AutomateThirdPartyNetworkPolicyAlways
101+
case automate_third_party_network_policy.Off:
102+
return graphqlclient.AutomateThirdPartyNetworkPolicyOff
103+
case automate_third_party_network_policy.IfBlockedByOtterize:
104+
return graphqlclient.AutomateThirdPartyNetworkPolicyIfBlockedByOtterize
105+
default:
106+
return ""
107+
}
108+
}
109+
97110
func uploadConfiguration(ctx context.Context, client CloudClient, mgr manager.Manager) {
98111
ingressConfigIdentities := operatorconfig.GetIngressControllerServiceIdentities()
99112
externallyManagedPolicyWorkloadIdentities := operatorconfig.GetExternallyManagedPoliciesServiceIdentities()
@@ -143,6 +156,7 @@ func uploadConfiguration(ctx context.Context, client CloudClient, mgr manager.Ma
143156
AllowExternalTrafficPolicy: getAllowExternalTrafficConfig(), // The server expect for AllowExternalTrafficPolicy because of backwards compatibility
144157
AutomateThirdPartyNetworkPolicies: getAutomateThirdPartyNetworkPoliciesConfig(),
145158
PrometheusServerConfigs: getPrometheusServiceIdentities(),
159+
AutomateAllowWebhookTraffic: getAutomateAllowWebhookTrafficConfig(),
146160
}
147161

148162
configInput.IngressControllerConfig = lo.Map(ingressConfigIdentities, func(identity serviceidentity.ServiceIdentity, _ int) graphqlclient.IngressControllerConfigInput {
@@ -165,7 +179,6 @@ func uploadConfiguration(ctx context.Context, client CloudClient, mgr manager.Ma
165179
configInput.AutomatedThirdPartyPolicyTypes = []graphqlclient.AutomatedThirdPartyPolicyTypes{
166180
graphqlclient.AutomatedThirdPartyPolicyTypesExternalTraffic,
167181
graphqlclient.AutomatedThirdPartyPolicyTypesMetricsTraffic,
168-
graphqlclient.AutomatedThirdPartyPolicyTypesWebhookTraffic,
169182
}
170183

171184
client.ReportIntentsOperatorConfiguration(timeoutCtx, configInput)

0 commit comments

Comments
 (0)