diff --git a/spring-cloud-kubernetes/1.0.2.RELEASE/multi/multi__contributing.html b/spring-cloud-kubernetes/1.0.2.RELEASE/multi/multi__contributing.html index 1e882511..d5af3da4 100644 --- a/spring-cloud-kubernetes/1.0.2.RELEASE/multi/multi__contributing.html +++ b/spring-cloud-kubernetes/1.0.2.RELEASE/multi/multi__contributing.html @@ -84,4 +84,4 @@ $ touch .springformat
4       └── Intellij_Spring_Boot_Java_Conventions.xml 5

-

3

Default Checkstyle rules

2

File header setup

1

Default suppression rules

4

Project defaults for Intellij that apply most of Checkstyle rules

5

Project style conventions for Intellij that apply most of Checkstyle rules

Figure 15.1. Code style

Code style

Go to FileSettingsEditorCode style. There click on the icon next to the Scheme section. There, click on the Import Scheme value and pick the Intellij IDEA code style XML option. Import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml file.

Figure 15.2. Inspection profiles

Code style

Go to FileSettingsEditorInspections. There click on the icon next to the Profile section. There, click on the Import Profile and import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml file.

Checkstyle. To have Intellij work with Checkstyle, you have to install the Checkstyle plugin. It’s advisable to also install the Assertions2Assertj to automatically convert the JUnit assertions

Checkstyle

Go to FileSettingsOther settingsCheckstyle. There click on the + icon in the Configuration file section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the checkstyle.xml : https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml). We need to provide the following variables:

[Important]Important

Remember to set the Scan Scope to All sources since we apply checkstyle rules for production and test sources.

\ No newline at end of file +

3

Default Checkstyle rules

2

File header setup

1

Default suppression rules

4

Project defaults for Intellij that apply most of Checkstyle rules

5

Project style conventions for Intellij that apply most of Checkstyle rules

Figure 15.1. Code style

Code style

Go to FileSettingsEditorCode style. There click on the icon next to the Scheme section. There, click on the Import Scheme value and pick the Intellij IDEA code style XML option. Import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml file.

Figure 15.2. Inspection profiles

Code style

Go to FileSettingsEditorInspections. There click on the icon next to the Profile section. There, click on the Import Profile and import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml file.

Checkstyle. To have Intellij work with Checkstyle, you have to install the Checkstyle plugin. It’s advisable to also install the Assertions2Assertj to automatically convert the JUnit assertions

Checkstyle

Go to FileSettingsOther settingsCheckstyle. There click on the + icon in the Configuration file section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the checkstyle.xml : https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml). We need to provide the following variables:

[Important]Important

Remember to set the Scan Scope to All sources since we apply checkstyle rules for production and test sources.

\ No newline at end of file diff --git a/spring-cloud-kubernetes/1.0.2.RELEASE/multi/multi__kubernetes_propertysource_implementations.html b/spring-cloud-kubernetes/1.0.2.RELEASE/multi/multi__kubernetes_propertysource_implementations.html index b2da31b4..798ee2ef 100644 --- a/spring-cloud-kubernetes/1.0.2.RELEASE/multi/multi__kubernetes_propertysource_implementations.html +++ b/spring-cloud-kubernetes/1.0.2.RELEASE/multi/multi__kubernetes_propertysource_implementations.html @@ -86,7 +86,39 @@ when the ConfigMap is read. You can provide differe message: Say Goodbye to the Developers

However, if the production profile is active, the configuration becomes:

  greeting:
     message: Say Hello to the Ops
   farewell:
-    message: Say Goodbye

If both profiles are active, the property that appears last within the ConfigMap overwrites any preceding values.

To tell Spring Boot which profile should be enabled at bootstrap, you can pass a system property to the Java + message: Say Goodbye

If both profiles are active, the property that appears last within the ConfigMap overwrites any preceding values.

Another option is to create a different config map per profile and spring boot will automatically fetch it based +on active profiles

kind: ConfigMap
+apiVersion: v1
+metadata:
+  name: demo
+data:
+  application.yml: |-
+    greeting:
+      message: Say Hello to the World
+    farewell:
+      message: Say Goodbye
kind: ConfigMap
+apiVersion: v1
+metadata:
+  name: demo-development
+data:
+  application.yml: |-
+    spring:
+      profiles: development
+    greeting:
+      message: Say Hello to the Developers
+    farewell:
+      message: Say Goodbye to the Developers
kind: ConfigMap
+apiVersion: v1
+metadata:
+  name: demo-production
+data:
+  application.yml: |-
+    spring:
+      profiles: production
+    greeting:
+      message: Say Hello to the Ops
+    farewell:
+      message: Say Goodbye

To tell Spring Boot which profile should be enabled at bootstrap, you can pass a system property to the Java command. To do so, you can launch your Spring Boot application with an environment variable that you can define with the OpenShift DeploymentConfig or Kubernetes ReplicationConfig resource file, as follows:

apiVersion: v1
 kind: DeploymentConfig
@@ -104,7 +136,7 @@ Kubernetes service accounts, roles and role bindings.

spring.cloud.kubernetes.config.paths property. You can use it in addition to or instead of the mechanism described earlier. -You can specify multiple (exact) file paths in spring.cloud.kubernetes.config.paths by using the , delimiter.

[Note]Note

You have to provide the full exact path to each property file, because directories are not being recursively parsed.

Table 5.1. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.config.enableApi

Boolean

true

Enable or disable consuming ConfigMap instances through APIs

spring.cloud.kubernetes.config.enabled

Boolean

true

Enable Secrets PropertySource

spring.cloud.kubernetes.config.name

String

${spring.application.name}

Sets the name of ConfigMap to look up

spring.cloud.kubernetes.config.namespace

String

Client namespace

Sets the Kubernetes namespace where to lookup

spring.cloud.kubernetes.config.paths

List

null

Sets the paths where ConfigMap instances are mounted


5.2 Secrets PropertySource

Kubernetes has the notion of Secrets for storing +You can specify multiple (exact) file paths in spring.cloud.kubernetes.config.paths by using the , delimiter.

[Note]Note

You have to provide the full exact path to each property file, because directories are not being recursively parsed.

Table 5.1. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.config.enableApi

Boolean

true

Enable or disable consuming ConfigMap instances through APIs

spring.cloud.kubernetes.config.enabled

Boolean

true

Enable Secrets PropertySource

spring.cloud.kubernetes.config.name

String

${spring.application.name}

Sets the name of ConfigMap to look up

spring.cloud.kubernetes.config.namespace

String

Client namespace

Sets the Kubernetes namespace where to lookup

spring.cloud.kubernetes.config.paths

List

null

Sets the paths where ConfigMap instances are mounted


5.2 Secrets PropertySource

Kubernetes has the notion of Secrets for storing sensitive data such as passwords, OAuth tokens, and so on. This project provides integration with Secrets to make secrets accessible by Spring Boot applications. You can explicitly enable or disable This feature by setting the spring.cloud.kubernetes.secrets.enabled property.

When enabled, the SecretsPropertySource looks up Kubernetes for Secrets from the following sources:

  1. Reading recursively from secrets mounts
  2. Named after the application (as defined by spring.application.name)
  3. Matching some labels

Note that, by default, consuming Secrets through the API (points 2 and 3 above) is not enabled for security reasons. Further, we recommend that containers share secrets through mounted volumes. @@ -141,7 +173,7 @@ configuration. We can create a Kubernetes secret by using the following command: secretKeyRef: name: db-secret key: password

You can select the Secrets to consume in a number of ways:

  1. By listing the directories where secrets are mapped:

    -Dspring.cloud.kubernetes.secrets.paths=/etc/secrets/db-secret,etc/secrets/postgresql

    If you have all the secrets mapped to a common root, you can set them like:

    -Dspring.cloud.kubernetes.secrets.paths=/etc/secrets
  2. By setting a named secret:

    -Dspring.cloud.kubernetes.secrets.name=db-secret
  3. By defining a list of labels:

    -Dspring.cloud.kubernetes.secrets.labels.broker=activemq
    --Dspring.cloud.kubernetes.secrets.labels.db=postgresql

Table 5.2. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.secrets.enableApi

Boolean

false

Enables or disables consuming secrets through APIs (examples 2 and 3)

spring.cloud.kubernetes.secrets.enabled

Boolean

true

Enable Secrets PropertySource

spring.cloud.kubernetes.secrets.name

String

${spring.application.name}

Sets the name of the secret to look up

spring.cloud.kubernetes.secrets.namespace

String

Client namespace

Sets the Kubernetes namespace where to look up

spring.cloud.kubernetes.secrets.labels

Map

null

Sets the labels used to lookup secrets

spring.cloud.kubernetes.secrets.paths

List

null

Sets the paths where secrets are mounted (example 1)


Notes: +-Dspring.cloud.kubernetes.secrets.labels.db=postgresql

Table 5.2. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.secrets.enableApi

Boolean

false

Enables or disables consuming secrets through APIs (examples 2 and 3)

spring.cloud.kubernetes.secrets.enabled

Boolean

true

Enable Secrets PropertySource

spring.cloud.kubernetes.secrets.name

String

${spring.application.name}

Sets the name of the secret to look up

spring.cloud.kubernetes.secrets.namespace

String

Client namespace

Sets the Kubernetes namespace where to look up

spring.cloud.kubernetes.secrets.labels

Map

null

Sets the labels used to lookup secrets

spring.cloud.kubernetes.secrets.paths

List

null

Sets the paths where secrets are mounted (example 1)


Notes: * The spring.cloud.kubernetes.secrets.labels property behaves as defined by Map-based binding. * The spring.cloud.kubernetes.secrets.paths property behaves as defined by @@ -190,6 +222,6 @@ The view role on the service account is required in * Polling: Oeriodically re-creates the configuration from config maps and secrets to see if it has changed. You can configure the polling period by using the spring.cloud.kubernetes.reload.period property and defaults to 15 seconds. It requires the same role as the monitored property source. -This means, for example, that using polling on file-mounted secret sources does not require particular privileges.

Table 5.3. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.reload.period

Duration

15s

The period for verifying changes when using the polling strategy

spring.cloud.kubernetes.reload.enabled

Boolean

false

Enables monitoring of property sources and configuration reload

spring.cloud.kubernetes.reload.monitoring-config-maps

Boolean

true

Allow monitoring changes in config maps

spring.cloud.kubernetes.reload.monitoring-secrets

Boolean

false

Allow monitoring changes in secrets

`spring.cloud.kubernetes.reload.strategy `

Enum

refresh

The strategy to use when firing a reload (refresh, restart_context, or shutdown)

spring.cloud.kubernetes.reload.mode

Enum

event

Specifies how to listen for changes in property sources (event or polling)


Notes: +This means, for example, that using polling on file-mounted secret sources does not require particular privileges.

Table 5.3. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.reload.period

Duration

15s

The period for verifying changes when using the polling strategy

spring.cloud.kubernetes.reload.enabled

Boolean

false

Enables monitoring of property sources and configuration reload

spring.cloud.kubernetes.reload.monitoring-config-maps

Boolean

true

Allow monitoring changes in config maps

spring.cloud.kubernetes.reload.monitoring-secrets

Boolean

false

Allow monitoring changes in secrets

`spring.cloud.kubernetes.reload.strategy `

Enum

refresh

The strategy to use when firing a reload (refresh, restart_context, or shutdown)

spring.cloud.kubernetes.reload.mode

Enum

event

Specifies how to listen for changes in property sources (event or polling)


Notes: * You should not use properties under spring.cloud.kubernetes.reload in config maps or secrets. Changing such properties at runtime may lead to unexpected results. * Deleting a property or the whole config map does not restore the original state of the beans when you use the refresh level.

\ No newline at end of file diff --git a/spring-cloud-kubernetes/1.0.2.RELEASE/single/spring-cloud-kubernetes.html b/spring-cloud-kubernetes/1.0.2.RELEASE/single/spring-cloud-kubernetes.html index 6d8ce876..fc79fe07 100644 --- a/spring-cloud-kubernetes/1.0.2.RELEASE/single/spring-cloud-kubernetes.html +++ b/spring-cloud-kubernetes/1.0.2.RELEASE/single/spring-cloud-kubernetes.html @@ -125,7 +125,39 @@ when the ConfigMap is read. You can provide differe message: Say Goodbye to the Developers

However, if the production profile is active, the configuration becomes:

  greeting:
     message: Say Hello to the Ops
   farewell:
-    message: Say Goodbye

If both profiles are active, the property that appears last within the ConfigMap overwrites any preceding values.

To tell Spring Boot which profile should be enabled at bootstrap, you can pass a system property to the Java + message: Say Goodbye

If both profiles are active, the property that appears last within the ConfigMap overwrites any preceding values.

Another option is to create a different config map per profile and spring boot will automatically fetch it based +on active profiles

kind: ConfigMap
+apiVersion: v1
+metadata:
+  name: demo
+data:
+  application.yml: |-
+    greeting:
+      message: Say Hello to the World
+    farewell:
+      message: Say Goodbye
kind: ConfigMap
+apiVersion: v1
+metadata:
+  name: demo-development
+data:
+  application.yml: |-
+    spring:
+      profiles: development
+    greeting:
+      message: Say Hello to the Developers
+    farewell:
+      message: Say Goodbye to the Developers
kind: ConfigMap
+apiVersion: v1
+metadata:
+  name: demo-production
+data:
+  application.yml: |-
+    spring:
+      profiles: production
+    greeting:
+      message: Say Hello to the Ops
+    farewell:
+      message: Say Goodbye

To tell Spring Boot which profile should be enabled at bootstrap, you can pass a system property to the Java command. To do so, you can launch your Spring Boot application with an environment variable that you can define with the OpenShift DeploymentConfig or Kubernetes ReplicationConfig resource file, as follows:

apiVersion: v1
 kind: DeploymentConfig
@@ -143,7 +175,7 @@ Kubernetes service accounts, roles and role bindings.

spring.cloud.kubernetes.config.paths property. You can use it in addition to or instead of the mechanism described earlier. -You can specify multiple (exact) file paths in spring.cloud.kubernetes.config.paths by using the , delimiter.

[Note]Note

You have to provide the full exact path to each property file, because directories are not being recursively parsed.

Table 5.1. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.config.enableApi

Boolean

true

Enable or disable consuming ConfigMap instances through APIs

spring.cloud.kubernetes.config.enabled

Boolean

true

Enable Secrets PropertySource

spring.cloud.kubernetes.config.name

String

${spring.application.name}

Sets the name of ConfigMap to look up

spring.cloud.kubernetes.config.namespace

String

Client namespace

Sets the Kubernetes namespace where to lookup

spring.cloud.kubernetes.config.paths

List

null

Sets the paths where ConfigMap instances are mounted


5.2 Secrets PropertySource

Kubernetes has the notion of Secrets for storing +You can specify multiple (exact) file paths in spring.cloud.kubernetes.config.paths by using the , delimiter.

[Note]Note

You have to provide the full exact path to each property file, because directories are not being recursively parsed.

Table 5.1. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.config.enableApi

Boolean

true

Enable or disable consuming ConfigMap instances through APIs

spring.cloud.kubernetes.config.enabled

Boolean

true

Enable Secrets PropertySource

spring.cloud.kubernetes.config.name

String

${spring.application.name}

Sets the name of ConfigMap to look up

spring.cloud.kubernetes.config.namespace

String

Client namespace

Sets the Kubernetes namespace where to lookup

spring.cloud.kubernetes.config.paths

List

null

Sets the paths where ConfigMap instances are mounted


5.2 Secrets PropertySource

Kubernetes has the notion of Secrets for storing sensitive data such as passwords, OAuth tokens, and so on. This project provides integration with Secrets to make secrets accessible by Spring Boot applications. You can explicitly enable or disable This feature by setting the spring.cloud.kubernetes.secrets.enabled property.

When enabled, the SecretsPropertySource looks up Kubernetes for Secrets from the following sources:

  1. Reading recursively from secrets mounts
  2. Named after the application (as defined by spring.application.name)
  3. Matching some labels

Note that, by default, consuming Secrets through the API (points 2 and 3 above) is not enabled for security reasons. Further, we recommend that containers share secrets through mounted volumes. @@ -180,7 +212,7 @@ configuration. We can create a Kubernetes secret by using the following command: secretKeyRef: name: db-secret key: password

You can select the Secrets to consume in a number of ways:

  1. By listing the directories where secrets are mapped:

    -Dspring.cloud.kubernetes.secrets.paths=/etc/secrets/db-secret,etc/secrets/postgresql

    If you have all the secrets mapped to a common root, you can set them like:

    -Dspring.cloud.kubernetes.secrets.paths=/etc/secrets
  2. By setting a named secret:

    -Dspring.cloud.kubernetes.secrets.name=db-secret
  3. By defining a list of labels:

    -Dspring.cloud.kubernetes.secrets.labels.broker=activemq
    --Dspring.cloud.kubernetes.secrets.labels.db=postgresql

Table 5.2. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.secrets.enableApi

Boolean

false

Enables or disables consuming secrets through APIs (examples 2 and 3)

spring.cloud.kubernetes.secrets.enabled

Boolean

true

Enable Secrets PropertySource

spring.cloud.kubernetes.secrets.name

String

${spring.application.name}

Sets the name of the secret to look up

spring.cloud.kubernetes.secrets.namespace

String

Client namespace

Sets the Kubernetes namespace where to look up

spring.cloud.kubernetes.secrets.labels

Map

null

Sets the labels used to lookup secrets

spring.cloud.kubernetes.secrets.paths

List

null

Sets the paths where secrets are mounted (example 1)


Notes: +-Dspring.cloud.kubernetes.secrets.labels.db=postgresql

Table 5.2. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.secrets.enableApi

Boolean

false

Enables or disables consuming secrets through APIs (examples 2 and 3)

spring.cloud.kubernetes.secrets.enabled

Boolean

true

Enable Secrets PropertySource

spring.cloud.kubernetes.secrets.name

String

${spring.application.name}

Sets the name of the secret to look up

spring.cloud.kubernetes.secrets.namespace

String

Client namespace

Sets the Kubernetes namespace where to look up

spring.cloud.kubernetes.secrets.labels

Map

null

Sets the labels used to lookup secrets

spring.cloud.kubernetes.secrets.paths

List

null

Sets the paths where secrets are mounted (example 1)


Notes: * The spring.cloud.kubernetes.secrets.labels property behaves as defined by Map-based binding. * The spring.cloud.kubernetes.secrets.paths property behaves as defined by @@ -229,7 +261,7 @@ The view role on the service account is required in * Polling: Oeriodically re-creates the configuration from config maps and secrets to see if it has changed. You can configure the polling period by using the spring.cloud.kubernetes.reload.period property and defaults to 15 seconds. It requires the same role as the monitored property source. -This means, for example, that using polling on file-mounted secret sources does not require particular privileges.

Table 5.3. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.reload.period

Duration

15s

The period for verifying changes when using the polling strategy

spring.cloud.kubernetes.reload.enabled

Boolean

false

Enables monitoring of property sources and configuration reload

spring.cloud.kubernetes.reload.monitoring-config-maps

Boolean

true

Allow monitoring changes in config maps

spring.cloud.kubernetes.reload.monitoring-secrets

Boolean

false

Allow monitoring changes in secrets

`spring.cloud.kubernetes.reload.strategy `

Enum

refresh

The strategy to use when firing a reload (refresh, restart_context, or shutdown)

spring.cloud.kubernetes.reload.mode

Enum

event

Specifies how to listen for changes in property sources (event or polling)


Notes: +This means, for example, that using polling on file-mounted secret sources does not require particular privileges.

Table 5.3. Properties:

NameTypeDefaultDescription

spring.cloud.kubernetes.reload.period

Duration

15s

The period for verifying changes when using the polling strategy

spring.cloud.kubernetes.reload.enabled

Boolean

false

Enables monitoring of property sources and configuration reload

spring.cloud.kubernetes.reload.monitoring-config-maps

Boolean

true

Allow monitoring changes in config maps

spring.cloud.kubernetes.reload.monitoring-secrets

Boolean

false

Allow monitoring changes in secrets

`spring.cloud.kubernetes.reload.strategy `

Enum

refresh

The strategy to use when firing a reload (refresh, restart_context, or shutdown)

spring.cloud.kubernetes.reload.mode

Enum

event

Specifies how to listen for changes in property sources (event or polling)


Notes: * You should not use properties under spring.cloud.kubernetes.reload in config maps or secrets. Changing such properties at runtime may lead to unexpected results. * Deleting a property or the whole config map does not restore the original state of the beans when you use the refresh level.

6. Ribbon Discovery in Kubernetes

Spring Cloud client applications that call a microservice should be interested on relying on a client load-balancing feature in order to automatically discover at which endpoint(s) it can reach a given service. This mechanism has been @@ -398,4 +430,4 @@ $ touch .springformat

4       └── Intellij_Spring_Boot_Java_Conventions.xml 5

-

3

Default Checkstyle rules

2

File header setup

1

Default suppression rules

4

Project defaults for Intellij that apply most of Checkstyle rules

5

Project style conventions for Intellij that apply most of Checkstyle rules

Figure 15.1. Code style

Code style

Go to FileSettingsEditorCode style. There click on the icon next to the Scheme section. There, click on the Import Scheme value and pick the Intellij IDEA code style XML option. Import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml file.

Figure 15.2. Inspection profiles

Code style

Go to FileSettingsEditorInspections. There click on the icon next to the Profile section. There, click on the Import Profile and import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml file.

Checkstyle. To have Intellij work with Checkstyle, you have to install the Checkstyle plugin. It’s advisable to also install the Assertions2Assertj to automatically convert the JUnit assertions

Checkstyle

Go to FileSettingsOther settingsCheckstyle. There click on the + icon in the Configuration file section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the checkstyle.xml : https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml). We need to provide the following variables:

[Important]Important

Remember to set the Scan Scope to All sources since we apply checkstyle rules for production and test sources.

\ No newline at end of file +

3

Default Checkstyle rules

2

File header setup

1

Default suppression rules

4

Project defaults for Intellij that apply most of Checkstyle rules

5

Project style conventions for Intellij that apply most of Checkstyle rules

Figure 15.1. Code style

Code style

Go to FileSettingsEditorCode style. There click on the icon next to the Scheme section. There, click on the Import Scheme value and pick the Intellij IDEA code style XML option. Import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml file.

Figure 15.2. Inspection profiles

Code style

Go to FileSettingsEditorInspections. There click on the icon next to the Profile section. There, click on the Import Profile and import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml file.

Checkstyle. To have Intellij work with Checkstyle, you have to install the Checkstyle plugin. It’s advisable to also install the Assertions2Assertj to automatically convert the JUnit assertions

Checkstyle

Go to FileSettingsOther settingsCheckstyle. There click on the + icon in the Configuration file section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the checkstyle.xml : https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/spring-cloud-build-tools/src/main/resources/checkstyle.xml). We need to provide the following variables:

[Important]Important

Remember to set the Scan Scope to All sources since we apply checkstyle rules for production and test sources.

\ No newline at end of file diff --git a/spring-cloud-kubernetes/1.0.2.RELEASE/spring-cloud-kubernetes.xml b/spring-cloud-kubernetes/1.0.2.RELEASE/spring-cloud-kubernetes.xml index 1525968a..6f672b64 100644 --- a/spring-cloud-kubernetes/1.0.2.RELEASE/spring-cloud-kubernetes.xml +++ b/spring-cloud-kubernetes/1.0.2.RELEASE/spring-cloud-kubernetes.xml @@ -4,7 +4,7 @@ Spring Cloud Kubernetes -2019-06-11 +2019-06-20 @@ -271,6 +271,48 @@ data: message: Say Goodbye If both profiles are active, the property that appears last within the ConfigMap overwrites any preceding values. +Another option is to create a different config map per profile and spring boot will automatically fetch it based +on active profiles + +kind: ConfigMap +apiVersion: v1 +metadata: + name: demo +data: + application.yml: |- + greeting: + message: Say Hello to the World + farewell: + message: Say Goodbye + + +kind: ConfigMap +apiVersion: v1 +metadata: + name: demo-development +data: + application.yml: |- + spring: + profiles: development + greeting: + message: Say Hello to the Developers + farewell: + message: Say Goodbye to the Developers + + +kind: ConfigMap +apiVersion: v1 +metadata: + name: demo-production +data: + application.yml: |- + spring: + profiles: production + greeting: + message: Say Hello to the Ops + farewell: + message: Say Goodbye + To tell Spring Boot which profile should be enabled at bootstrap, you can pass a system property to the Java command. To do so, you can launch your Spring Boot application with an environment variable that you can define with the OpenShift DeploymentConfig or Kubernetes ReplicationConfig resource file, as follows: