Vault Changes

The following assumes vault is needed for the project. If it isn’t then all references to vault can be removed from the project.

Vault values go in kubernetes/components/secrets/application-secrets.env file.

Add the Vault dependency

In the pom.xml add:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-vault-config</artifactId>
</dependency>

Update the application.properties file

In the projects /src/main/resources/application.properties file add:

#Vault properties
spring.cloud.vault.enabled=${VAULT_ENABLED:false}
spring.cloud.vault.uri=${VAULT_ADDR}
spring.cloud.vault.connection-timeout=5000
spring.cloud.vault.read-timeout=15000
spring.cloud.vault.authentication=${VAULT_AUTH:APPROLE}
spring.cloud.vault.app-role.role-id=${NAMESPACE}-read
spring.config.import=optional:vault://${VAULT_MOUNT_PATH}/${NAMESPACE}/${APP_NAME},optional:vault://${VAULT_MOUNT_PATH:}/${NAMESPACE:}/${APP_NAME:}/${APP_VERSION}

Enable Vault in the appropriate environments

Possibly outdated but wont hurt to add it. TODO remove this section later if not needed
  • add the VAULT_ENABLED=true var to application.env for sandbox, sqa, and prod. It will be false for dev so we don’t need to add it.

  • Update the project’s application.properties with the required vault values