@Test public void testNetworkPolicyWithConnectorOperator() { KafkaConnectS2I resource = new KafkaConnectS2IBuilder(this.resource) .build(); KafkaConnectS2ICluster kc = KafkaConnectS2ICluster.fromCrd(resource, VERSIONS); NetworkPolicy np = kc.generateNetworkPolicy(true, true); assertThat(np.getMetadata().getName(), is(kc.getName())); assertThat(np.getSpec().getPodSelector().getMatchLabels(), is(kc.getSelectorLabels().toMap())); assertThat(np.getSpec().getIngress().size(), is(2)); assertThat(np.getSpec().getIngress().get(0).getPorts().size(), is(1)); assertThat(np.getSpec().getIngress().get(0).getPorts().get(0).getPort().getIntVal(), is(KafkaConnectCluster.REST_API_PORT)); assertThat(np.getSpec().getIngress().get(0).getFrom().size(), is(2)); assertThat(np.getSpec().getIngress().get(0).getFrom().get(0).getPodSelector().getMatchLabels(), is(kc.getSelectorLabels().toMap())); assertThat(np.getSpec().getIngress().get(0).getFrom().get(0).getNamespaceSelector(), is(nullValue())); assertThat(np.getSpec().getIngress().get(0).getFrom().get(1).getPodSelector().getMatchLabels(), is(singletonMap(Labels.STRIMZI_KIND_LABEL, "cluster-operator"))); assertThat(np.getSpec().getIngress().get(0).getFrom().get(1).getNamespaceSelector().getMatchLabels(), is(nullValue())); assertThat(np.getSpec().getIngress().get(1).getPorts().size(), is(1)); assertThat(np.getSpec().getIngress().get(1).getPorts().get(0).getPort().getIntVal(), is(KafkaConnectCluster.METRICS_PORT)); }
public static KafkaConnectS2ICluster fromCrd(KafkaConnectS2I kafkaConnectS2I, KafkaVersion.Lookup versions) { KafkaConnectS2ISpec spec = kafkaConnectS2I.getSpec(); KafkaConnectS2ICluster cluster = fromSpec(spec, versions, new KafkaConnectS2ICluster(kafkaConnectS2I)); cluster.setOwnerReference(kafkaConnectS2I); cluster.setInsecureSourceRepository(spec.isInsecureSourceRepository()); cluster.setBuildResourceRequirements(spec.getBuildResources()); return cluster; }
KafkaConnectS2ICluster extends KafkaConnectCluster { public static KafkaConnectS2ICluster fromCrd(KafkaConnectS2I kafkaConnectS2I, KafkaVersion.Lookup versions) { KafkaConnectS2ISpec spec = kafkaConnectS2I.getSpec(); KafkaConnectS2ICluster cluster = fromSpec(spec, versions, new KafkaConnectS2ICluster(kafkaConnectS2I)); cluster.setOwnerReference(kafkaConnectS2I); cluster.setInsecureSourceRepository(spec.isInsecureSourceRepository()); cluster.setBuildResourceRequirements(spec.getBuildResources()); return cluster; } }
KafkaConnectS2ICluster extends KafkaConnectCluster { public static KafkaConnectS2ICluster fromCrd(KafkaConnectS2I kafkaConnectS2I, KafkaVersion.Lookup versions) { KafkaConnectS2ISpec spec = kafkaConnectS2I.getSpec(); KafkaConnectS2ICluster cluster = fromSpec(spec, versions, new KafkaConnectS2ICluster(kafkaConnectS2I)); cluster.setOwnerReference(kafkaConnectS2I); cluster.setInsecureSourceRepository(spec.isInsecureSourceRepository()); cluster.setBuildResourceRequirements(spec.getBuildResources()); return cluster; } private  KafkaConnectS2ICluster(HasMetadata resource); }
KafkaConnectS2ICluster extends KafkaConnectCluster { public static KafkaConnectS2ICluster fromCrd(KafkaConnectS2I kafkaConnectS2I, KafkaVersion.Lookup versions) { KafkaConnectS2ISpec spec = kafkaConnectS2I.getSpec(); KafkaConnectS2ICluster cluster = fromSpec(spec, versions, new KafkaConnectS2ICluster(kafkaConnectS2I)); cluster.setOwnerReference(kafkaConnectS2I); cluster.setInsecureSourceRepository(spec.isInsecureSourceRepository()); cluster.setBuildResourceRequirements(spec.getBuildResources()); return cluster; } private  KafkaConnectS2ICluster(HasMetadata resource); static KafkaConnectS2ICluster fromCrd(KafkaConnectS2I kafkaConnectS2I, KafkaVersion.Lookup versions); DeploymentConfig generateDeploymentConfig(Map<String, String> annotations, boolean isOpenShift, ImagePullPolicy imagePullPolicy,
                                                     List<LocalObjectReference> imagePullSecrets); ImageStream generateSourceImageStream(); ImageStream generateTargetImageStream(); BuildConfig generateBuildConfig(); boolean isInsecureSourceRepository(); void setInsecureSourceRepository(boolean insecureSourceRepository); void setBuildResourceRequirements(ResourceRequirements buildRequirements); }
KafkaConnectS2ICluster extends KafkaConnectCluster { public static KafkaConnectS2ICluster fromCrd(KafkaConnectS2I kafkaConnectS2I, KafkaVersion.Lookup versions) { KafkaConnectS2ISpec spec = kafkaConnectS2I.getSpec(); KafkaConnectS2ICluster cluster = fromSpec(spec, versions, new KafkaConnectS2ICluster(kafkaConnectS2I)); cluster.setOwnerReference(kafkaConnectS2I); cluster.setInsecureSourceRepository(spec.isInsecureSourceRepository()); cluster.setBuildResourceRequirements(spec.getBuildResources()); return cluster; } private  KafkaConnectS2ICluster(HasMetadata resource); static KafkaConnectS2ICluster fromCrd(KafkaConnectS2I kafkaConnectS2I, KafkaVersion.Lookup versions); DeploymentConfig generateDeploymentConfig(Map<String, String> annotations, boolean isOpenShift, ImagePullPolicy imagePullPolicy,
                                                     List<LocalObjectReference> imagePullSecrets); ImageStream generateSourceImageStream(); ImageStream generateTargetImageStream(); BuildConfig generateBuildConfig(); boolean isInsecureSourceRepository(); void setInsecureSourceRepository(boolean insecureSourceRepository); void setBuildResourceRequirements(ResourceRequirements buildRequirements);  }