From 98c7eb52d80f09962553ad8f5b0bf6f3689f8828 Mon Sep 17 00:00:00 2001 From: Tim Ysewyn Date: Tue, 10 Dec 2019 17:23:35 +0100 Subject: [PATCH] Updated documentation --- README.adoc | 2 + docs/src/main/asciidoc/_configprops.adoc | 2 +- .../kubernetes/KubernetesProperties.java | 46 +++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 spring-cloud-kubernetes-core/src/main/java/org/springframework/cloud/kubernetes/KubernetesProperties.java diff --git a/README.adoc b/README.adoc index 13e6903d..057f90fa 100644 --- a/README.adoc +++ b/README.adoc @@ -824,6 +824,8 @@ as the code of the project relies on the https://github.com/fabric8io/kubernetes-client[Fabric8 Kubernetes Java client], which is a fluent DSL that can communicate by using `http` protocol to the REST API of the Kubernetes Server. +To disable the integration with Kubernetes you can set `spring.cloud.kubernetes.enabled` to `false`. + === Kubernetes Profile Autoconfiguration When the application runs as a pod inside Kubernetes, a Spring profile named `kubernetes` automatically gets activated. diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/src/main/asciidoc/_configprops.adoc index 833a920e..42e7a2bf 100644 --- a/docs/src/main/asciidoc/_configprops.adoc +++ b/docs/src/main/asciidoc/_configprops.adoc @@ -1,7 +1,6 @@ |=== |Name | Default | Description -|spring.cloud.kubernetes.enabled | true | If Kubernetes integration is enabled. |spring.cloud.kubernetes.client.api-version | | |spring.cloud.kubernetes.client.apiVersion | v1 | Kubernetes API Version |spring.cloud.kubernetes.client.ca-cert-data | | @@ -63,6 +62,7 @@ |spring.cloud.kubernetes.discovery.primary-port-name | | If set then the port with a given name is used as primary when multiple ports are defined for a service. |spring.cloud.kubernetes.discovery.service-labels | | If set, then only the services matching these labels will be fetched from the Kubernetes API server. |spring.cloud.kubernetes.discovery.service-name | unknown | The service name of the local instance. +|spring.cloud.kubernetes.enabled | true | If Kubernetes integration is enabled. |spring.cloud.kubernetes.reload.enabled | false | Enables the Kubernetes configuration reload on change. |spring.cloud.kubernetes.reload.max-wait-for-restart | 2s | If Restart or Shutdown strategies are used, Spring Cloud Kubernetes waits a random amount of time before restarting. This is done in order to avoid having all instances of the same application restart at the same time. This property configures the maximum of amount of wait time from the moment the signal is received that a restart is needed until the moment the restart is actually triggered |spring.cloud.kubernetes.reload.mode | | Sets the detection mode for Kubernetes configuration reload. diff --git a/spring-cloud-kubernetes-core/src/main/java/org/springframework/cloud/kubernetes/KubernetesProperties.java b/spring-cloud-kubernetes-core/src/main/java/org/springframework/cloud/kubernetes/KubernetesProperties.java new file mode 100644 index 00000000..072052c6 --- /dev/null +++ b/spring-cloud-kubernetes-core/src/main/java/org/springframework/cloud/kubernetes/KubernetesProperties.java @@ -0,0 +1,46 @@ +/* + * Copyright 2013-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.kubernetes; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.core.style.ToStringCreator; + +/** + * Kubernetes properties. + * + * @author Tim Ysewyn + */ +@ConfigurationProperties("spring.cloud.kubernetes") +public class KubernetesProperties { + + /** If Kubernetes integration is enabled. */ + private boolean enabled = true; + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + @Override + public String toString() { + return new ToStringCreator(this).append("enabled", this.enabled).toString(); + } + +}