@@ -398,13 +398,37 @@ type WebSphereLibertyApplicationNetworkPolicy struct {
398398	// +operator-sdk:csv:customresourcedefinitions:order=52,type=spec,displayName="Disable",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch" 
399399	Disable  * bool  `json:"disable,omitempty"` 
400400
401- 	// Specify the labels of namespaces that incoming traffic is allowed from. 
402- 	// +operator-sdk:csv:customresourcedefinitions:order=53,type=spec,displayName="Namespace Labels",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text" 
401+ 	// Disable the creation of the network policy ingress. Defaults to false. 
402+ 	// +operator-sdk:csv:customresourcedefinitions:order=53,type=spec,displayName="Disable Ingress",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch" 
403+ 	DisableIngress  * bool  `json:"disableIngress,omitempty"` 
404+ 
405+ 	// Disable the creation of the network policy egress. Defaults to false. 
406+ 	// +operator-sdk:csv:customresourcedefinitions:order=54,type=spec,displayName="Disable Egress",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch" 
407+ 	DisableEgress  * bool  `json:"disableEgress,omitempty"` 
408+ 
409+ 	// Bypasses deny all egress rules to allow API server and DNS access. Defaults to false. 
410+ 	// +operator-sdk:csv:customresourcedefinitions:order=55,type=spec,displayName="Bypass Deny All Egress",xDescriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch" 
411+ 	BypassDenyAllEgress  * bool  `json:"bypassDenyAllEgress,omitempty"` 
412+ 
413+ 	// Deprecated. .spec.networkPolicy.fromNamespaceLabels should be used instead. If both are specified, .spec.networkPolicy.fromNamespaceLabels will override this. 
414+ 	// +operator-sdk:csv:customresourcedefinitions:order=56,type=spec,displayName="Namespace Labels",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text" 
403415	NamespaceLabels  * map [string ]string  `json:"namespaceLabels,omitempty"` 
404416
417+ 	// Specify the labels of namespaces that incoming traffic is allowed from. 
418+ 	// +operator-sdk:csv:customresourcedefinitions:order=57,type=spec,displayName="From Namespace Labels",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text" 
419+ 	FromNamespaceLabels  * map [string ]string  `json:"fromNamespaceLabels,omitempty"` 
420+ 
405421	// Specify the labels of pod(s) that incoming traffic is allowed from. 
406- 	// +operator-sdk:csv:customresourcedefinitions:order=54 ,type=spec,displayName="From Labels",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text" 
422+ 	// +operator-sdk:csv:customresourcedefinitions:order=58 ,type=spec,displayName="From Labels",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text" 
407423	FromLabels  * map [string ]string  `json:"fromLabels,omitempty"` 
424+ 
425+ 	// Specify the labels of namespaces that outgoing traffic is allowed to. 
426+ 	// +operator-sdk:csv:customresourcedefinitions:order=59,type=spec,displayName="To Namespace Labels",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text" 
427+ 	ToNamespaceLabels  * map [string ]string  `json:"toNamespaceLabels,omitempty"` 
428+ 
429+ 	// Specify the labels of pod(s) that outgoing traffic is allowed to. 
430+ 	// +operator-sdk:csv:customresourcedefinitions:order=60,type=spec,displayName="To Labels",xDescriptors="urn:alm:descriptor:com.tectonic.ui:text" 
431+ 	ToLabels  * map [string ]string  `json:"toLabels,omitempty"` 
408432}
409433
410434// Defines the desired state and cycle of applications. 
@@ -1177,8 +1201,28 @@ func (s *WebSphereLibertyApplicationService) GetBindable() *bool {
11771201	return  s .Bindable 
11781202}
11791203
1180- // GetNamespaceLabels returns the namespace selector labels that should be used for the ingress rule 
1181- func  (np  * WebSphereLibertyApplicationNetworkPolicy ) GetNamespaceLabels () map [string ]string  {
1204+ // GetToNamespaceLabels returns the namespace selector labels that should be used for the egress rule 
1205+ func  (np  * WebSphereLibertyApplicationNetworkPolicy ) GetToNamespaceLabels () map [string ]string  {
1206+ 	if  np .ToNamespaceLabels  !=  nil  {
1207+ 		return  * np .ToNamespaceLabels 
1208+ 	}
1209+ 	return  nil 
1210+ }
1211+ 
1212+ // GetToLabels returns the pod selector labels that should be used for the egress rule 
1213+ func  (np  * WebSphereLibertyApplicationNetworkPolicy ) GetToLabels () map [string ]string  {
1214+ 	if  np .ToLabels  !=  nil  {
1215+ 		return  * np .ToLabels 
1216+ 	}
1217+ 	return  nil 
1218+ }
1219+ 
1220+ // GetFromNamespaceLabels returns the namespace selector labels that should be used for the ingress rule 
1221+ func  (np  * WebSphereLibertyApplicationNetworkPolicy ) GetFromNamespaceLabels () map [string ]string  {
1222+ 	if  np .FromNamespaceLabels  !=  nil  {
1223+ 		return  * np .FromNamespaceLabels 
1224+ 	}
1225+ 	// fallback to deprecated flag np.NamespaceLabels for when we only supported one type of network policy (ingress) 
11821226	if  np .NamespaceLabels  !=  nil  {
11831227		return  * np .NamespaceLabels 
11841228	}
@@ -1198,6 +1242,20 @@ func (np *WebSphereLibertyApplicationNetworkPolicy) IsDisabled() bool {
11981242	return  np .Disable  !=  nil  &&  * np .Disable 
11991243}
12001244
1245+ // IsIngressDisabled returns whether the network policy ingress should be created or not 
1246+ func  (np  * WebSphereLibertyApplicationNetworkPolicy ) IsIngressDisabled () bool  {
1247+ 	return  np .DisableIngress  !=  nil  &&  * np .DisableIngress 
1248+ }
1249+ 
1250+ // IsEgressDisabled returns whether the network policy egress should be created or not 
1251+ func  (np  * WebSphereLibertyApplicationNetworkPolicy ) IsEgressDisabled () bool  {
1252+ 	return  np .DisableEgress  !=  nil  &&  * np .DisableEgress 
1253+ }
1254+ 
1255+ func  (np  * WebSphereLibertyApplicationNetworkPolicy ) IsBypassingDenyAllEgress () bool  {
1256+ 	return  np .BypassDenyAllEgress  !=  nil  &&  * np .BypassDenyAllEgress 
1257+ }
1258+ 
12011259// GetLabels returns labels to be added on ServiceMonitor 
12021260func  (m  * WebSphereLibertyApplicationMonitoring ) GetLabels () map [string ]string  {
12031261	return  m .Labels 
0 commit comments