CruiseControl extends AbstractModel { public Service generateService() { if (!isDeployed()) { return null; } List<ServicePort> ports = Collections.singletonList(createServicePort(REST_API_PORT_NAME, REST_API_PORT, REST_API_PORT, "TCP")); return createService("ClusterIP", ports, templateServiceAnnotations); } protected  CruiseControl(HasMetadata resource); static String metricAndLogConfigsName(String cluster); static CruiseControl fromCrd(Kafka kafkaAssembly, KafkaVersion.Lookup versions); static CruiseControl updateConfiguration(CruiseControlSpec spec, CruiseControl cruiseControl); static void checkGoals(CruiseControlConfiguration configuration); static CruiseControl updateTemplate(CruiseControlSpec spec, CruiseControl cruiseControl); static String cruiseControlName(String cluster); static String cruiseControlServiceName(String cluster); Service generateService(); Deployment generateDeployment(boolean isOpenShift, Map<String, String> annotations, ImagePullPolicy imagePullPolicy, List<LocalObjectReference> imagePullSecrets); PodDisruptionBudget generatePodDisruptionBudget(); static String cruiseControlServiceAccountName(String cluster); static String secretName(String kafkaCluster); Secret generateSecret(ClusterCa clusterCa, boolean isMaintenanceTimeWindowsSatisfied); static String policyName(String cluster); NetworkPolicy generateNetworkPolicy(boolean namespaceAndPodSelectorNetworkPolicySupported); static final String CRUISE_CONTROL_METRIC_REPORTER; static final String ANNO_STRIMZI_IO_LOGGING; static final String ENV_VAR_CRUISE_CONTROL_METRICS_ENABLED; static final boolean DEFAULT_CRUISE_CONTROL_METRICS_ENABLED; static final Probe DEFAULT_HEALTHCHECK_OPTIONS; static final String REST_API_PORT_NAME; static final int REST_API_PORT; static final String MIN_INSYNC_REPLICAS; }
@Test public void testGenerateService() { Service svc = cc.generateService(); assertThat(svc.getSpec().getType(), is("ClusterIP")); assertThat(svc.getMetadata().getLabels(), is(expectedLabels(cc.getServiceName()))); assertThat(svc.getSpec().getSelector(), is(expectedSelectorLabels())); assertThat(svc.getSpec().getPorts().size(), is(1)); assertThat(svc.getSpec().getPorts().get(0).getName(), is(CruiseControl.REST_API_PORT_NAME)); assertThat(svc.getSpec().getPorts().get(0).getPort(), is(Integer.valueOf(CruiseControl.REST_API_PORT))); assertThat(svc.getSpec().getPorts().get(0).getProtocol(), is("TCP")); TestUtils.checkOwnerReference(cc.createOwnerReference(), svc); }