【发布时间】:2018-08-24 17:51:25
【问题描述】:
我开始使用 helm。我已经定义了部署、服务、configMap 和秘密 yaml 文件。
我有一个简单的带有基本 http 身份验证的 Spring Boot 应用程序,用户名和密码在机密文件中定义。
我的应用部署正确,在浏览器中测试时提示用户名和密码错误。
有没有办法知道 spring boot 从 helms 接收到的值是什么?
或者有没有办法解密secret.yaml文件?
values.yaml
image:
repository: myrepo.azurecr.io
name: my-service
tag: latest
replicaCount: 1
users:
- name: "admin"
password: "admintest"
authority: "admin"
- name: "user-test"
password: "usertest"
authority: "user"
spring:
datasource:
url: someurl
username: someusername
password: somepassword
platform: postgresql
secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-secret
stringData:
spring.datasource.url: "{{ .Values.spring.datasource.url }}"
spring.datasource.username: "{{ .Values.spring.datasource.username }}"
spring.datasource.password: "{{ .Values.spring.datasource.password }}"
spring.datasource.platform: "{{ .Values.spring.datasource.platform }}"
{{- range $idx, $user := .Values.users }}
users_{{ $idx }}_.name: "{{ $user.name }}"
users_{{ $idx }}_.password: "{{ printf $user.password }}"
users_{{ $idx }}_.authority: "{{ printf $user.authority }}"
{{- end }}
【问题讨论】:
标签: spring-boot kubernetes-helm