Spring Boot Actuator endpoints not showing property values when read from K8s configmap

3/5/2021

I am trying to view some custom properties that I have in a projects application.yml.

meanwhileinhell:
  myproject:
    myserver:
      security:
        users:
          - username: user1
            password: "{noop}password1"
            roles:
              - USER
          - username: user2
            password: "{noop}password2"
            roles:
              - USER
      services:
        - "service-the-first"
        - "another-service"

I run my system in a Kubernetes cluster, and during my installation I create configmaps of each of my projects application.yml, with the command:

kubectl create configmap <project> --from-file "<project>/src/main/resources/application.yml"

Viewing these configmaps on my running system, I can see that all the values are there.

These properties bind to a Kotlin classes:

@ConstructorBinding
@ConfigurationProperties("meanwhileinhell.myproject.myserver.security")
class SecurityUsersProperties(val users: List<User>)

data class User(val username: String, val password: String, val roles: List<String>)
@ConstructorBinding
@ConfigurationProperties("meanwhileinhell.myproject.myserver")
class ServiceNameProperties(val services: List<String>)

which are then enabled in a couple of config classes:

@EnableConfigurationProperties(ServiceNameProperties::class)

Note! The SecurityUsersProperties::class is enabled on WebSecurityConfig class.

These values are all loaded successfully, as I can use the credentials to log in where needed, and monitor that specific list of services.

My issue is when I try to view the properties on the actuator/configprops endpoint. I can see the list of property names, but when I click to expand the values they are not displayed.

contexts:
  application-1:
    beans:
      meanwhileinhell.myproject.myserver.security-com.meanwhileinhell.myproject.myserver.security.properties.SecurityUsersProperties:
        properties:
          users:
        inputs:
          users:
            0:
              roles:
                0:
                  origin:    "\"meanwhileinhell.myproject.myserver.security.users[0].roles[0]\" from property source \"bootstrapProperties-configmap.myserver.default\""
            1:
              roles:
                0:
                  origin:    "\"meanwhileinhell.myproject.myserver.security.users[1].roles[0]\" from property source \"bootstrapProperties-configmap.myserver.default\""

In this instance, only roles: are shown, no username or (sanitised) password. The same is true if I search for my list of services:

contexts:
  application-1:
    beans:
      meanwhileinhell.myproject.myserver.services-com.meanwhileinhell.myproject.myserver.health.properties.ServiceNameProperties:
        properties:
          services:
        inputs:
          services:
            0:
              origin:   "\"meanwhileinhell.myproject.myserver.services[0]\" from property source \"bootstrapProperties-configmap.myserver.default\""
            1:
              origin:   "\"meanwhileinhell.myproject.myserver.services[1]\" from property source \"bootstrapProperties-configmap.myserver.default\""

In my root build.gradle.kts, I have enabled the actuator endpoints on all services:

implementation("org.springframework.boot:spring-boot-starter-actuator")

Is there something I'm missing that is allowing my properties to be displayed?

Update My env actuator endpoint seems to be working now, and displaying my username and (sanitized) passwords as well as the role. But, configprops still is not displaying them, only the roles like mentioned above.

-- MeanwhileInHell
configmap
kotlin
kubernetes
spring-boot
spring-boot-actuator

0 Answers