use of io.strimzi.api.kafka.model.template.IpFamily in project strimzi by strimzi.
the class AbstractModel method createHeadlessService.
/**
* Creates a headless service
*
* Uses Alpha annotation service.alpha.kubernetes.io/tolerate-unready-endpoints for older versions of Kubernetes still supported by Strimzi,
* replaced by the publishNotReadyAddresses field in the spec, annotation is ignored in later versions of Kubernetes
*/
protected Service createHeadlessService(List<ServicePort> ports) {
Map<String, String> annotations = Collections.singletonMap("service.alpha.kubernetes.io/tolerate-unready-endpoints", "true");
Service service = new ServiceBuilder().withNewMetadata().withName(headlessServiceName).withLabels(getLabelsWithStrimziName(name, templateHeadlessServiceLabels).toMap()).withNamespace(namespace).withAnnotations(Util.mergeLabelsOrAnnotations(annotations, templateHeadlessServiceAnnotations)).withOwnerReferences(createOwnerReference()).endMetadata().withNewSpec().withType("ClusterIP").withClusterIP("None").withSelector(getSelectorLabels().toMap()).withPorts(ports).withPublishNotReadyAddresses(true).endSpec().build();
if (templateHeadlessServiceIpFamilyPolicy != null) {
service.getSpec().setIpFamilyPolicy(templateHeadlessServiceIpFamilyPolicy.toValue());
}
if (templateHeadlessServiceIpFamilies != null && !templateHeadlessServiceIpFamilies.isEmpty()) {
service.getSpec().setIpFamilies(templateHeadlessServiceIpFamilies.stream().map(IpFamily::toValue).collect(Collectors.toList()));
}
LOGGER.traceCr(reconciliation, "Created headless service {}", service);
return service;
}
use of io.strimzi.api.kafka.model.template.IpFamily in project strimzi-kafka-operator by strimzi.
the class AbstractModel method createHeadlessService.
/**
* Creates a headless service
*
* Uses Alpha annotation service.alpha.kubernetes.io/tolerate-unready-endpoints for older versions of Kubernetes still supported by Strimzi,
* replaced by the publishNotReadyAddresses field in the spec, annotation is ignored in later versions of Kubernetes
*/
protected Service createHeadlessService(List<ServicePort> ports) {
Map<String, String> annotations = Collections.singletonMap("service.alpha.kubernetes.io/tolerate-unready-endpoints", "true");
Service service = new ServiceBuilder().withNewMetadata().withName(headlessServiceName).withLabels(getLabelsWithStrimziName(name, templateHeadlessServiceLabels).toMap()).withNamespace(namespace).withAnnotations(Util.mergeLabelsOrAnnotations(annotations, templateHeadlessServiceAnnotations)).withOwnerReferences(createOwnerReference()).endMetadata().withNewSpec().withType("ClusterIP").withClusterIP("None").withSelector(getSelectorLabels().toMap()).withPorts(ports).withPublishNotReadyAddresses(true).endSpec().build();
if (templateHeadlessServiceIpFamilyPolicy != null) {
service.getSpec().setIpFamilyPolicy(templateHeadlessServiceIpFamilyPolicy.toValue());
}
if (templateHeadlessServiceIpFamilies != null && !templateHeadlessServiceIpFamilies.isEmpty()) {
service.getSpec().setIpFamilies(templateHeadlessServiceIpFamilies.stream().map(IpFamily::toValue).collect(Collectors.toList()));
}
LOGGER.traceCr(reconciliation, "Created headless service {}", service);
return service;
}
use of io.strimzi.api.kafka.model.template.IpFamily in project strimzi by strimzi.
the class AbstractModel method createService.
protected Service createService(String name, String type, List<ServicePort> ports, Labels labels, Labels selector, Map<String, String> annotations, IpFamilyPolicy ipFamilyPolicy, List<IpFamily> ipFamilies) {
Service service = new ServiceBuilder().withNewMetadata().withName(name).withLabels(labels.toMap()).withNamespace(namespace).withAnnotations(annotations).withOwnerReferences(createOwnerReference()).endMetadata().withNewSpec().withType(type).withSelector(selector.toMap()).withPorts(ports).endSpec().build();
if (ipFamilyPolicy != null) {
service.getSpec().setIpFamilyPolicy(ipFamilyPolicy.toValue());
}
if (ipFamilies != null && !ipFamilies.isEmpty()) {
service.getSpec().setIpFamilies(ipFamilies.stream().map(IpFamily::toValue).collect(Collectors.toList()));
}
LOGGER.traceCr(reconciliation, "Created service {}", service);
return service;
}
use of io.strimzi.api.kafka.model.template.IpFamily in project strimzi-kafka-operator by strimzi.
the class AbstractModel method createService.
protected Service createService(String name, String type, List<ServicePort> ports, Labels labels, Labels selector, Map<String, String> annotations, IpFamilyPolicy ipFamilyPolicy, List<IpFamily> ipFamilies) {
Service service = new ServiceBuilder().withNewMetadata().withName(name).withLabels(labels.toMap()).withNamespace(namespace).withAnnotations(annotations).withOwnerReferences(createOwnerReference()).endMetadata().withNewSpec().withType(type).withSelector(selector.toMap()).withPorts(ports).endSpec().build();
if (ipFamilyPolicy != null) {
service.getSpec().setIpFamilyPolicy(ipFamilyPolicy.toValue());
}
if (ipFamilies != null && !ipFamilies.isEmpty()) {
service.getSpec().setIpFamilies(ipFamilies.stream().map(IpFamily::toValue).collect(Collectors.toList()));
}
LOGGER.traceCr(reconciliation, "Created service {}", service);
return service;
}
Aggregations