From 597940e6ba88640415a6014abe8e488152c694c6 Mon Sep 17 00:00:00 2001 From: Jakub Scholz Date: Sat, 24 Apr 2021 22:04:11 +0200 Subject: [PATCH] Make it possible to disable service links - Close #4800 Signed-off-by: Jakub Scholz --- CHANGELOG.md | 1 + .../api/kafka/model/template/PodTemplate.java | 11 +++ .../api/kafka/model/040-Crd-kafka.yaml | 72 +++++++++++++++++++ .../api/kafka/model/041-Crd-kafkaconnect.yaml | 24 +++++++ .../kafka/model/042-Crd-kafkaconnects2i.yaml | 24 +++++++ .../kafka/model/045-Crd-kafkamirrormaker.yaml | 12 ++++ .../api/kafka/model/046-Crd-kafkabridge.yaml | 8 +++ .../model/048-Crd-kafkamirrormaker2.yaml | 16 +++++ .../operator/cluster/model/AbstractModel.java | 4 ++ .../cluster/model/KafkaConnectS2ICluster.java | 1 + .../operator/cluster/model/ModelUtils.java | 1 + .../cluster/model/EntityOperatorTest.java | 2 + .../operator/cluster/model/JmxTransTest.java | 2 + .../cluster/model/KafkaBridgeClusterTest.java | 2 + .../cluster/model/KafkaClusterTest.java | 2 + .../cluster/model/KafkaConnectBuildTest.java | 2 + .../model/KafkaConnectClusterTest.java | 2 + .../model/KafkaConnectS2IClusterTest.java | 2 + .../cluster/model/KafkaExporterTest.java | 2 + .../model/KafkaMirrorMaker2ClusterTest.java | 2 + .../model/KafkaMirrorMakerClusterTest.java | 2 + .../cluster/model/ZookeeperClusterTest.java | 2 + documentation/modules/appendix_crds.adoc | 2 + .../crds/040-Crd-kafka.yaml | 18 +++++ .../crds/041-Crd-kafkaconnect.yaml | 6 ++ .../crds/042-Crd-kafkaconnects2i.yaml | 6 ++ .../crds/045-Crd-kafkamirrormaker.yaml | 3 + .../crds/046-Crd-kafkabridge.yaml | 3 + .../crds/048-Crd-kafkamirrormaker2.yaml | 6 ++ .../cluster-operator/040-Crd-kafka.yaml | 24 +++++++ .../041-Crd-kafkaconnect.yaml | 8 +++ .../042-Crd-kafkaconnects2i.yaml | 8 +++ .../045-Crd-kafkamirrormaker.yaml | 4 ++ .../cluster-operator/046-Crd-kafkabridge.yaml | 4 ++ .../048-Crd-kafkamirrormaker2.yaml | 8 +++ 35 files changed, 296 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3c66e544f..5a8e80d5bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ * Changed Reconciliation interval for Topic Operator from 90 to 120 seconds (to keep it the same as for other operators) * Changed Zookeeper session timeout default value to 18 seconds for Topic and User Operators (for improved resiliency) * Removed requirement for replicas and partitions KafkaTopic spec making these parameters optional +* Allow disabling service links (environment variables describing Kubernetes services) in Pod template ### Changes, deprecations and removals diff --git a/api/src/main/java/io/strimzi/api/kafka/model/template/PodTemplate.java b/api/src/main/java/io/strimzi/api/kafka/model/template/PodTemplate.java index 92d251bf61..1a48189dbc 100644 --- a/api/src/main/java/io/strimzi/api/kafka/model/template/PodTemplate.java +++ b/api/src/main/java/io/strimzi/api/kafka/model/template/PodTemplate.java @@ -52,6 +52,7 @@ public class PodTemplate implements Serializable, UnknownPropertyPreserving { private String priorityClassName; private String schedulerName; private List hostAliases; + private Boolean enableServiceLinks; private Map additionalProperties = new HashMap<>(0); @Description("Metadata applied to the resource.") @@ -171,6 +172,16 @@ public void setHostAliases(List hostAliases) { this.hostAliases = hostAliases; } + @Description("Indicates whether information about services should be injected into pod's environment variables.") + @JsonInclude(JsonInclude.Include.NON_DEFAULT) + public Boolean getEnableServiceLinks() { + return enableServiceLinks; + } + + public void setEnableServiceLinks(Boolean enableServiceLinks) { + this.enableServiceLinks = enableServiceLinks; + } + @Override public Map getAdditionalProperties() { return this.additionalProperties; diff --git a/api/src/test/resources/io/strimzi/api/kafka/model/040-Crd-kafka.yaml b/api/src/test/resources/io/strimzi/api/kafka/model/040-Crd-kafka.yaml index f71bc79da4..0f16081365 100644 --- a/api/src/test/resources/io/strimzi/api/kafka/model/040-Crd-kafka.yaml +++ b/api/src/test/resources/io/strimzi/api/kafka/model/040-Crd-kafka.yaml @@ -1392,6 +1392,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -2422,6 +2426,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -3427,6 +3435,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -4364,6 +4376,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -5121,6 +5137,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -5633,6 +5653,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -8542,6 +8566,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -9928,6 +9956,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -11825,6 +11857,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -12766,6 +12802,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -13527,6 +13567,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -14039,6 +14083,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -16948,6 +16996,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -18334,6 +18386,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -20231,6 +20287,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -21172,6 +21232,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -21933,6 +21997,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -22445,6 +22513,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: diff --git a/api/src/test/resources/io/strimzi/api/kafka/model/041-Crd-kafkaconnect.yaml b/api/src/test/resources/io/strimzi/api/kafka/model/041-Crd-kafkaconnect.yaml index 66be18808e..d690ae0b6b 100644 --- a/api/src/test/resources/io/strimzi/api/kafka/model/041-Crd-kafkaconnect.yaml +++ b/api/src/test/resources/io/strimzi/api/kafka/model/041-Crd-kafkaconnect.yaml @@ -774,6 +774,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -1263,6 +1267,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -2784,6 +2792,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -3273,6 +3285,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -4794,6 +4810,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -5283,6 +5303,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: diff --git a/api/src/test/resources/io/strimzi/api/kafka/model/042-Crd-kafkaconnects2i.yaml b/api/src/test/resources/io/strimzi/api/kafka/model/042-Crd-kafkaconnects2i.yaml index d973bdc0c5..ef7041d0c0 100644 --- a/api/src/test/resources/io/strimzi/api/kafka/model/042-Crd-kafkaconnects2i.yaml +++ b/api/src/test/resources/io/strimzi/api/kafka/model/042-Crd-kafkaconnects2i.yaml @@ -782,6 +782,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -1271,6 +1275,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -2809,6 +2817,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -3298,6 +3310,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -4836,6 +4852,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -5325,6 +5345,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: diff --git a/api/src/test/resources/io/strimzi/api/kafka/model/045-Crd-kafkamirrormaker.yaml b/api/src/test/resources/io/strimzi/api/kafka/model/045-Crd-kafkamirrormaker.yaml index 826147b02d..e517c5c6b2 100644 --- a/api/src/test/resources/io/strimzi/api/kafka/model/045-Crd-kafkamirrormaker.yaml +++ b/api/src/test/resources/io/strimzi/api/kafka/model/045-Crd-kafkamirrormaker.yaml @@ -959,6 +959,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -2349,6 +2353,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -3739,6 +3747,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: diff --git a/api/src/test/resources/io/strimzi/api/kafka/model/046-Crd-kafkabridge.yaml b/api/src/test/resources/io/strimzi/api/kafka/model/046-Crd-kafkabridge.yaml index 3ad90df2f9..b50ff139ef 100644 --- a/api/src/test/resources/io/strimzi/api/kafka/model/046-Crd-kafkabridge.yaml +++ b/api/src/test/resources/io/strimzi/api/kafka/model/046-Crd-kafkabridge.yaml @@ -789,6 +789,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -1754,6 +1758,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: diff --git a/api/src/test/resources/io/strimzi/api/kafka/model/048-Crd-kafkamirrormaker2.yaml b/api/src/test/resources/io/strimzi/api/kafka/model/048-Crd-kafkamirrormaker2.yaml index 5bd8be6d71..e4b408e46e 100644 --- a/api/src/test/resources/io/strimzi/api/kafka/model/048-Crd-kafkamirrormaker2.yaml +++ b/api/src/test/resources/io/strimzi/api/kafka/model/048-Crd-kafkamirrormaker2.yaml @@ -887,6 +887,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -1376,6 +1380,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -2893,6 +2901,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: @@ -3382,6 +3394,10 @@ spec: description: The pod's HostAliases. HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. + enableServiceLinks: + type: boolean + description: Indicates whether information about services + should be injected into pod's environment variables. topologySpreadConstraints: type: array items: diff --git a/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/AbstractModel.java b/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/AbstractModel.java index 8ebb265809..bc7062b71a 100644 --- a/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/AbstractModel.java +++ b/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/AbstractModel.java @@ -276,6 +276,7 @@ public abstract class AbstractModel { protected List templatePodHostAliases; protected List templatePodTopologySpreadConstraints; protected PodManagementPolicy templatePodManagementPolicy = PodManagementPolicy.PARALLEL; + protected Boolean templatePodEnableServiceLinks; protected Map templateClusterRoleBindingLabels; protected Map templateClusterRoleBindingAnnotations; @@ -1027,6 +1028,7 @@ protected StatefulSet createStatefulSet( .endMetadata() .withNewSpec() .withServiceAccountName(getServiceAccountName()) + .withEnableServiceLinks(templatePodEnableServiceLinks) .withAffinity(affinity) .withInitContainers(initContainers) .withContainers(containers) @@ -1079,6 +1081,7 @@ protected Pod createPod( .withNewSpec() .withRestartPolicy("Never") .withServiceAccountName(getServiceAccountName()) + .withEnableServiceLinks(templatePodEnableServiceLinks) .withAffinity(getUserAffinity()) .withInitContainers(initContainers) .withContainers(containers) @@ -1125,6 +1128,7 @@ protected Deployment createDeployment( .withNewSpec() .withAffinity(affinity) .withServiceAccountName(getServiceAccountName()) + .withEnableServiceLinks(templatePodEnableServiceLinks) .withInitContainers(initContainers) .withContainers(containers) .withVolumes(volumes) diff --git a/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/KafkaConnectS2ICluster.java b/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/KafkaConnectS2ICluster.java index 5bb828358d..f7c5c53869 100644 --- a/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/KafkaConnectS2ICluster.java +++ b/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/KafkaConnectS2ICluster.java @@ -145,6 +145,7 @@ public DeploymentConfig generateDeploymentConfig(Map annotations .withLabels(getLabelsWithStrimziName(name, templatePodLabels).toMap()) .endMetadata() .withNewSpec() + .withEnableServiceLinks(templatePodEnableServiceLinks) .withContainers(container) .withVolumes(getVolumes(isOpenShift, true)) .withTolerations(getTolerations()) diff --git a/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/ModelUtils.java b/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/ModelUtils.java index ad1517a916..4e09614e51 100644 --- a/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/ModelUtils.java +++ b/cluster-operator/src/main/java/io/strimzi/operator/cluster/model/ModelUtils.java @@ -254,6 +254,7 @@ public static void parsePodTemplate(AbstractModel model, PodTemplate pod) { model.templatePodSchedulerName = pod.getSchedulerName(); model.templatePodHostAliases = pod.getHostAliases(); model.templatePodTopologySpreadConstraints = pod.getTopologySpreadConstraints(); + model.templatePodEnableServiceLinks = pod.getEnableServiceLinks(); } } diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/EntityOperatorTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/EntityOperatorTest.java index e6d1202518..aec5e3b852 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/EntityOperatorTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/EntityOperatorTest.java @@ -223,6 +223,7 @@ public void testTemplate() { .withNewSchedulerName("my-scheduler") .withTolerations(singletonList(toleration)) .withTopologySpreadConstraints(tsc1, tsc2) + .withEnableServiceLinks(false) .endPod() .endTemplate() .endEntityOperator() @@ -241,6 +242,7 @@ public void testTemplate() { assertThat(dep.getSpec().getTemplate().getMetadata().getAnnotations().entrySet().containsAll(podAnots.entrySet()), is(true)); assertThat(dep.getSpec().getTemplate().getSpec().getSchedulerName(), is("my-scheduler")); assertThat(dep.getSpec().getTemplate().getSpec().getTopologySpreadConstraints(), containsInAnyOrder(tsc1, tsc2)); + assertThat(dep.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false)); assertThat(dep.getSpec().getTemplate().getSpec().getTolerations(), is(singletonList(assertToleration))); } diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/JmxTransTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/JmxTransTest.java index 85a245ba62..f62ee5c986 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/JmxTransTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/JmxTransTest.java @@ -238,6 +238,7 @@ public void testTemplate() { .withNewSchedulerName("my-scheduler") .withAffinity(affinity) .withTolerations(tolerations) + .withEnableServiceLinks(false) .endPod() .endTemplate() .endJmxTrans() @@ -257,6 +258,7 @@ public void testTemplate() { assertThat(dep.getSpec().getTemplate().getMetadata().getLabels(), hasEntries(podLabels)); assertThat(dep.getSpec().getTemplate().getMetadata().getAnnotations(), hasEntries(podAnots)); assertThat(dep.getSpec().getTemplate().getSpec().getSchedulerName(), is("my-scheduler")); + assertThat(dep.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false)); } @Test diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaBridgeClusterTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaBridgeClusterTest.java index 2c685c8244..b036eaa790 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaBridgeClusterTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaBridgeClusterTest.java @@ -407,6 +407,7 @@ public void testTemplate() { .withAffinity(affinity) .withTolerations(tolerations) .withTopologySpreadConstraints(tsc1, tsc2) + .withEnableServiceLinks(false) .endPod() .withNewApiService() .withNewMetadata() @@ -440,6 +441,7 @@ public void testTemplate() { assertThat(dep.getSpec().getTemplate().getSpec().getAffinity(), is(affinity)); assertThat(dep.getSpec().getTemplate().getSpec().getTolerations(), is(tolerations)); assertThat(dep.getSpec().getTemplate().getSpec().getTopologySpreadConstraints(), containsInAnyOrder(tsc1, tsc2)); + assertThat(dep.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false)); // Check Service Service svc = kbc.generateService(); diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaClusterTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaClusterTest.java index 370bb7aacd..4aa0ac65ee 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaClusterTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaClusterTest.java @@ -1513,6 +1513,7 @@ image, healthDelay, healthTimeout, metricsCm, jmxMetricsConfig, configuration, e .withNewSchedulerName("my-scheduler") .withHostAliases(hostAlias1, hostAlias2) .withTopologySpreadConstraints(tsc1, tsc2) + .withEnableServiceLinks(false) .endPod() .withNewBootstrapService() .withNewMetadata() @@ -1580,6 +1581,7 @@ image, healthDelay, healthTimeout, metricsCm, jmxMetricsConfig, configuration, e assertThat(sts.getSpec().getTemplate().getSpec().getSchedulerName(), is("my-scheduler")); assertThat(sts.getSpec().getTemplate().getSpec().getHostAliases(), containsInAnyOrder(hostAlias1, hostAlias2)); assertThat(sts.getSpec().getTemplate().getSpec().getTopologySpreadConstraints(), containsInAnyOrder(tsc1, tsc2)); + assertThat(sts.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false)); // Check Service Service svc = kc.generateService(); diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectBuildTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectBuildTest.java index 81cb5143ac..0e4c1fb451 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectBuildTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectBuildTest.java @@ -411,6 +411,7 @@ public void testTemplate() { .endMetadata() .withNewPriorityClassName("top-priority") .withNewSchedulerName("my-scheduler") + .withEnableServiceLinks(false) .endBuildPod() .withNewBuildContainer() .withEnv(new ContainerEnvVarBuilder().withName("TEST_ENV_VAR").withValue("testValue").build()) @@ -432,6 +433,7 @@ public void testTemplate() { assertThat(pod.getMetadata().getAnnotations().entrySet().containsAll(buildPodAnnos.entrySet()), is(true)); assertThat(pod.getSpec().getPriorityClassName(), is("top-priority")); assertThat(pod.getSpec().getSchedulerName(), is("my-scheduler")); + assertThat(pod.getSpec().getEnableServiceLinks(), is(false)); assertThat(pod.getSpec().getContainers().get(0).getEnv().stream().filter(env -> "TEST_ENV_VAR".equals(env.getName())).findFirst().get().getValue(), is("testValue")); KafkaConnectDockerfile dockerfile = new KafkaConnectDockerfile("my-image:latest", kc.getSpec().getBuild()); diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectClusterTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectClusterTest.java index e32770b683..fea08591a4 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectClusterTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectClusterTest.java @@ -598,6 +598,7 @@ public void testTemplate() { .withNewSchedulerName("my-scheduler") .withHostAliases(hostAlias1, hostAlias2) .withTopologySpreadConstraints(tsc1, tsc2) + .withEnableServiceLinks(false) .endPod() .withNewApiService() .withNewMetadata() @@ -636,6 +637,7 @@ public void testTemplate() { assertThat(dep.getSpec().getTemplate().getSpec().getSchedulerName(), is("my-scheduler")); assertThat(dep.getSpec().getTemplate().getSpec().getHostAliases(), containsInAnyOrder(hostAlias1, hostAlias2)); assertThat(dep.getSpec().getTemplate().getSpec().getTopologySpreadConstraints(), containsInAnyOrder(tsc1, tsc2)); + assertThat(dep.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false)); // Check Service Service svc = kc.generateService(); diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectS2IClusterTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectS2IClusterTest.java index 75b3483a5d..6771df03ab 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectS2IClusterTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaConnectS2IClusterTest.java @@ -577,6 +577,7 @@ public void testTemplate() { .withNewSchedulerName("my-scheduler") .withHostAliases(hostAlias1, hostAlias2) .withTopologySpreadConstraints(tsc1, tsc2) + .withEnableServiceLinks(false) .endPod() .withNewApiService() .withNewMetadata() @@ -615,6 +616,7 @@ public void testTemplate() { assertThat(dep.getSpec().getTemplate().getSpec().getSchedulerName(), is("my-scheduler")); assertThat(dep.getSpec().getTemplate().getSpec().getHostAliases(), containsInAnyOrder(hostAlias1, hostAlias2)); assertThat(dep.getSpec().getTemplate().getSpec().getTopologySpreadConstraints(), containsInAnyOrder(tsc1, tsc2)); + assertThat(dep.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false)); // Check Service Service svc = kc.generateService(); diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaExporterTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaExporterTest.java index 69601a7edc..04ca0f5591 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaExporterTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaExporterTest.java @@ -392,6 +392,7 @@ public void testTemplate() { .withAffinity(affinity) .withTolerations(tolerations) .withTopologySpreadConstraints(tsc1, tsc2) + .withEnableServiceLinks(false) .endPod() .withNewService() .withNewMetadata() @@ -418,6 +419,7 @@ public void testTemplate() { assertThat(dep.getSpec().getTemplate().getSpec().getAffinity(), is(affinity)); assertThat(dep.getSpec().getTemplate().getSpec().getTolerations(), is(tolerations)); assertThat(dep.getSpec().getTemplate().getSpec().getTopologySpreadConstraints(), containsInAnyOrder(tsc1, tsc2)); + assertThat(dep.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false)); } @AfterAll diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaMirrorMaker2ClusterTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaMirrorMaker2ClusterTest.java index 8df921ef6c..0f1931100e 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaMirrorMaker2ClusterTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaMirrorMaker2ClusterTest.java @@ -723,6 +723,7 @@ public void testTemplate() { .withNewPriorityClassName("top-priority") .withNewSchedulerName("my-scheduler") .withHostAliases(hostAlias1, hostAlias2) + .withEnableServiceLinks(false) .endPod() .withNewApiService() .withNewMetadata() @@ -754,6 +755,7 @@ public void testTemplate() { assertThat(dep.getSpec().getTemplate().getMetadata().getAnnotations().entrySet().containsAll(podAnots.entrySet()), is(true)); assertThat(dep.getSpec().getTemplate().getSpec().getSchedulerName(), is("my-scheduler")); assertThat(dep.getSpec().getTemplate().getSpec().getHostAliases(), containsInAnyOrder(hostAlias1, hostAlias2)); + assertThat(dep.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false)); // Check Service Service svc = kmm2.generateService(); diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaMirrorMakerClusterTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaMirrorMakerClusterTest.java index c3dba808b3..a0cfd2a431 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaMirrorMakerClusterTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/KafkaMirrorMakerClusterTest.java @@ -534,6 +534,7 @@ public void testTemplate() { .withNewPriorityClassName("top-priority") .withNewSchedulerName("my-scheduler") .withHostAliases(hostAlias1, hostAlias2) + .withEnableServiceLinks(false) .endPod() .withNewPodDisruptionBudget() .withNewMetadata() @@ -559,6 +560,7 @@ public void testTemplate() { assertThat(dep.getSpec().getTemplate().getMetadata().getAnnotations().entrySet().containsAll(podAnots.entrySet()), is(true)); assertThat(dep.getSpec().getTemplate().getSpec().getSchedulerName(), is("my-scheduler")); assertThat(dep.getSpec().getTemplate().getSpec().getHostAliases(), containsInAnyOrder(hostAlias1, hostAlias2)); + assertThat(dep.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false)); // Check PodDisruptionBudget PodDisruptionBudget pdb = mmc.generatePodDisruptionBudget(); diff --git a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/ZookeeperClusterTest.java b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/ZookeeperClusterTest.java index 69676f1ae4..bb3dba652d 100644 --- a/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/ZookeeperClusterTest.java +++ b/cluster-operator/src/test/java/io/strimzi/operator/cluster/model/ZookeeperClusterTest.java @@ -437,6 +437,7 @@ image, healthDelay, healthTimeout, metricsCm, jmxMetricsConfig, configurationJso .withNewSchedulerName("my-scheduler") .withHostAliases(hostAlias1, hostAlias2) .withTopologySpreadConstraints(tsc1, tsc2) + .withEnableServiceLinks(false) .endPod() .withNewClientService() .withNewMetadata() @@ -474,6 +475,7 @@ image, healthDelay, healthTimeout, metricsCm, jmxMetricsConfig, configurationJso assertThat(sts.getSpec().getTemplate().getSpec().getSchedulerName(), is("my-scheduler")); assertThat(sts.getSpec().getTemplate().getSpec().getHostAliases(), containsInAnyOrder(hostAlias1, hostAlias2)); assertThat(sts.getSpec().getTemplate().getSpec().getTopologySpreadConstraints(), containsInAnyOrder(tsc1, tsc2)); + assertThat(sts.getSpec().getTemplate().getSpec().getEnableServiceLinks(), is(false)); // Check Service Service svc = zc.generateService(); diff --git a/documentation/modules/appendix_crds.adoc b/documentation/modules/appendix_crds.adoc index da5eb50fff..59f5f2092c 100644 --- a/documentation/modules/appendix_crds.adoc +++ b/documentation/modules/appendix_crds.adoc @@ -886,6 +886,8 @@ include::../api/io.strimzi.api.kafka.model.template.PodTemplate.adoc[leveloffset |https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#HostAlias-v1-core[HostAlias] array +|enableServiceLinks 1.2+<.