-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable ACL Client Token #1093
Enable ACL Client Token #1093
Changes from all commits
4dc7dfa
7c5223f
88379a1
7746ad7
492c8a0
be58c6d
b7d9fa3
de48da0
f2b59af
1cac8f7
19d0064
2c76ee6
eb41a15
14200d1
10c9b8c
c690c57
653f819
1fadcb4
b3a3ac9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
{{- if and .Values.global.federation.enabled .Values.global.adminPartitions.enabled }}{{ fail "If global.federation.enabled is true, global.adminPartitions.enabled must be false because they are mutually exclusive" }}{{ end }} | ||
{{- if (and .Values.global.enterpriseLicense.secretName (not .Values.global.enterpriseLicense.secretKey)) }}{{fail "enterpriseLicense.secretKey and secretName must both be specified." }}{{ end -}} | ||
{{- if (and (not .Values.global.enterpriseLicense.secretName) .Values.global.enterpriseLicense.secretKey) }}{{fail "enterpriseLicense.secretKey and secretName must both be specified." }}{{ end -}} | ||
{{- if and .Values.externalServers.enabled (not .Values.externalServers.hosts) }}{{ fail "externalServers.hosts must be set if externalServers.enabled is true" }}{{ end -}} | ||
# DaemonSet to run the Consul clients on every node. | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
|
@@ -48,6 +49,7 @@ spec: | |
annotations: | ||
{{- if .Values.global.secretsBackend.vault.enabled }} | ||
"vault.hashicorp.com/agent-inject": "true" | ||
"vault.hashicorp.com/agent-init-first": "true" | ||
"vault.hashicorp.com/role": "{{ .Values.global.secretsBackend.vault.consulClientRole }}" | ||
{{- if and .Values.global.secretsBackend.vault.ca.secretName .Values.global.secretsBackend.vault.ca.secretKey }} | ||
"vault.hashicorp.com/agent-extra-secret": "{{ .Values.global.secretsBackend.vault.ca.secretName }}" | ||
|
@@ -124,6 +126,9 @@ spec: | |
- name: config | ||
configMap: | ||
name: {{ template "consul.fullname" . }}-client-config | ||
- name: consul-data | ||
emptyDir: | ||
medium: "Memory" | ||
{{- if .Values.global.tls.enabled }} | ||
{{- if not .Values.global.secretsBackend.vault.enabled }} | ||
- name: consul-ca-cert | ||
|
@@ -136,7 +141,8 @@ spec: | |
items: | ||
- key: {{ default "tls.crt" .Values.global.tls.caCert.secretKey }} | ||
path: tls.crt | ||
{{ if not .Values.global.tls.enableAutoEncrypt }} | ||
{{- end }} | ||
{{- if (and (not .Values.global.secretsBackend.vault.enabled) (not .Values.global.tls.enableAutoEncrypt)) }} | ||
- name: consul-ca-key | ||
secret: | ||
{{- if .Values.global.tls.caKey.secretName }} | ||
|
@@ -154,7 +160,6 @@ spec: | |
medium: "Memory" | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- range .Values.client.extraVolumes }} | ||
- name: userconfig-{{ .name }} | ||
{{ .type }}: | ||
|
@@ -177,7 +182,21 @@ spec: | |
containers: | ||
- name: consul | ||
image: "{{ default .Values.global.image .Values.client.image }}" | ||
{{- if .Values.global.acls.manageSystemACLs }} | ||
lifecycle: | ||
preStop: | ||
exec: | ||
command: | ||
- "/bin/sh" | ||
- "-ec" | ||
- | | ||
consul logout | ||
{{- end }} | ||
env: | ||
{{- if .Values.global.acls.manageSystemACLs }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need this also for the logout command in the preStop above. |
||
- name: CONSUL_HTTP_TOKEN_FILE | ||
value: "/consul/login/acl-token" | ||
{{- end }} | ||
- name: ADVERTISE_IP | ||
valueFrom: | ||
fieldRef: | ||
|
@@ -340,6 +359,9 @@ spec: | |
mountPath: /consul/data | ||
- name: config | ||
mountPath: /consul/config | ||
- mountPath: /consul/login | ||
name: consul-data | ||
readOnly: true | ||
{{- if .Values.global.tls.enabled }} | ||
{{- if not .Values.global.secretsBackend.vault.enabled }} | ||
- name: consul-ca-cert | ||
|
@@ -435,17 +457,57 @@ spec: | |
{{- if .Values.global.acls.manageSystemACLs }} | ||
- name: client-acl-init | ||
image: {{ .Values.global.imageK8S }} | ||
env: | ||
- name: CONSUL_HTTP_ADDR | ||
{{- if .Values.global.tls.enabled }} | ||
value: https://{{ template "consul.fullname" . }}-server.{{ .Release.Namespace }}.svc:8501 | ||
{{- else }} | ||
value: http://{{ template "consul.fullname" . }}-server.{{ .Release.Namespace }}.svc:8500 | ||
{{- end }} | ||
{{- if (and .Values.global.tls.enabled (not .Values.externalServers.useSystemRoots)) }} | ||
- name: CONSUL_CACERT | ||
{{- if .Values.global.secretsBackend.vault.enabled }} | ||
value: "/vault/secrets/serverca.crt" | ||
{{- else }} | ||
value: "/consul/tls/ca/tls.crt" | ||
{{- end }} | ||
{{- end }} | ||
command: | ||
- "/bin/sh" | ||
- "-ec" | ||
- | | ||
consul-k8s-control-plane acl-init \ | ||
-secret-name="{{ template "consul.fullname" . }}-client-acl-token" \ | ||
-k8s-namespace={{ .Release.Namespace }} \ | ||
-component-name=client \ | ||
-acl-auth-method="{{ template "consul.fullname" . }}-k8s-component-auth-method" \ | ||
{{- if .Values.global.adminPartitions.enabled }} | ||
-partition={{ .Values.global.adminPartitions.name }} \ | ||
{{- end }} | ||
-log-level={{ default .Values.global.logLevel .Values.client.logLevel }} \ | ||
-log-json={{ .Values.global.logJSON }} \ | ||
{{- if .Values.externalServers.enabled }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this follows prior art of |
||
{{- if .Values.global.tls.enabled }} | ||
-use-https \ | ||
{{- end }} | ||
{{- range .Values.externalServers.hosts }} | ||
-server-address={{ quote . }} \ | ||
{{- end }} | ||
-server-port={{ .Values.externalServers.httpsPort }} \ | ||
{{- if .Values.externalServers.tlsServerName }} | ||
-tls-server-name={{ .Values.externalServers.tlsServerName }} \ | ||
{{- end }} | ||
{{- end }} | ||
-init-type="client" | ||
volumeMounts: | ||
- name: aclconfig | ||
mountPath: /consul/aclconfig | ||
- mountPath: /consul/login | ||
name: consul-data | ||
readOnly: false | ||
{{- if (and (not .Values.global.secretsBackend.vault.enabled) (not .Values.externalServers.useSystemRoots)) }} | ||
- name: consul-ca-cert | ||
mountPath: /consul/tls/ca | ||
readOnly: false | ||
{{- end }} | ||
resources: | ||
requests: | ||
memory: "25Mi" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,10 +86,10 @@ spec: | |
{{- if .Values.global.tls.enabled }} | ||
-use-https \ | ||
{{- if not .Values.externalServers.useSystemRoots }} | ||
-consul-ca-cert=/consul/tls/ca/tls.crt \ | ||
-ca-file=/consul/tls/ca/tls.crt \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two flags are already available in |
||
{{- end }} | ||
{{- if .Values.externalServers.tlsServerName }} | ||
-consul-tls-server-name={{ .Values.externalServers.tlsServerName }} \ | ||
-tls-server-name={{ .Values.externalServers.tlsServerName }} \ | ||
{{- end }} | ||
{{- end }} | ||
-partition-name={{ .Values.global.adminPartitions.name }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,7 +244,7 @@ spec: | |
{{- end }} | ||
|
||
{{- if not (or (and (ne (.Values.client.enabled | toString) "-") .Values.client.enabled) (and (eq (.Values.client.enabled | toString) "-") .Values.global.enabled)) }} | ||
-create-client-token=false \ | ||
-client=false \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing flag to the new flag convention. |
||
{{- end }} | ||
|
||
{{- if .Values.global.acls.createReplicationToken }} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,9 @@ spec: | |
-additional-dnsname="{{ template "consul.fullname" . }}-server" \ | ||
-additional-dnsname="*.{{ template "consul.fullname" . }}-server" \ | ||
-additional-dnsname="*.{{ template "consul.fullname" . }}-server.${NAMESPACE}" \ | ||
-additional-dnsname="{{ template "consul.fullname" . }}-server.${NAMESPACE}" \ | ||
-additional-dnsname="*.{{ template "consul.fullname" . }}-server.${NAMESPACE}.svc" \ | ||
-additional-dnsname="{{ template "consul.fullname" . }}-server.${NAMESPACE}.svc" \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modifying SANs in cert so client pod can talk to server load balancer.
ishustava marked this conversation as resolved.
Show resolved
Hide resolved
|
||
-additional-dnsname="*.server.{{ .Values.global.datacenter }}.{{ .Values.global.domain }}" \ | ||
{{- range .Values.global.tls.serverAdditionalIPSANs }} | ||
-additional-ipaddress={{ . }} \ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need vault agent injector to fun before
client-acl-init
initContainer.