use of io.strimzi.systemtest.enums.DefaultNetworkPolicy in project strimzi by strimzi.
the class NetworkPolicyTemplates method applyDefaultNetworkPolicy.
public static NetworkPolicy applyDefaultNetworkPolicy(ExtensionContext extensionContext, String namespace, DefaultNetworkPolicy policy) {
NetworkPolicy networkPolicy = new NetworkPolicyBuilder().withApiVersion("networking.k8s.io/v1").withKind(Constants.NETWORK_POLICY).withNewMetadata().withName("global-network-policy").withNamespace(namespace).endMetadata().withNewSpec().withNewPodSelector().endPodSelector().withPolicyTypes("Ingress").endSpec().build();
if (policy.equals(DefaultNetworkPolicy.DEFAULT_TO_ALLOW)) {
networkPolicy = new NetworkPolicyBuilder(networkPolicy).editSpec().addNewIngress().endIngress().endSpec().build();
}
LOGGER.debug("Creating NetworkPolicy: {}", networkPolicy.toString());
return networkPolicy;
}
use of io.strimzi.systemtest.enums.DefaultNetworkPolicy in project strimzi-kafka-operator by strimzi.
the class NetworkPolicyTemplates method applyDefaultNetworkPolicy.
public static NetworkPolicy applyDefaultNetworkPolicy(ExtensionContext extensionContext, String namespace, DefaultNetworkPolicy policy) {
NetworkPolicy networkPolicy = new NetworkPolicyBuilder().withApiVersion("networking.k8s.io/v1").withKind(Constants.NETWORK_POLICY).withNewMetadata().withName("global-network-policy").withNamespace(namespace).endMetadata().withNewSpec().withNewPodSelector().endPodSelector().withPolicyTypes("Ingress").endSpec().build();
if (policy.equals(DefaultNetworkPolicy.DEFAULT_TO_ALLOW)) {
networkPolicy = new NetworkPolicyBuilder(networkPolicy).editSpec().addNewIngress().endIngress().endSpec().build();
}
LOGGER.debug("Creating NetworkPolicy: {}", networkPolicy.toString());
return networkPolicy;
}
Aggregations