-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from nats-io/account-server
[helm] Add support for using NATS Account Server as the resolver
- Loading branch information
Showing
10 changed files
with
389 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v2 | ||
appVersion: "0.8.6" | ||
description: A Helm chart for the NATS.io JWT Account Server | ||
name: nats-account-server | ||
keywords: | ||
- nats | ||
- messaging | ||
- cncf | ||
- jwt | ||
- auth | ||
version: 0.3.0 | ||
home: http://github.com/nats-io/k8s | ||
maintainers: | ||
- name: Waldemar Quevedo | ||
github: https://github.com/wallyqs | ||
email: [email protected] | ||
- name: Colin Sullivan | ||
github: https://github.com/ColinSullivan1 | ||
email: [email protected] | ||
icon: https://nats.io/img/logo.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "name" -}} | ||
{{- default .Release.Name -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "name" . }}-config | ||
labels: | ||
app: {{ template "name" . }} | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
data: | ||
accountserver.conf: | | ||
# Host/Port for the NATS Account Server | ||
http { | ||
host: "0.0.0.0" | ||
port: 9090 | ||
} | ||
# Operator JWT used to validate the accounts. | ||
operatorjwtpath: "/etc/nats-config/operator/{{ .Values.operator.operatorjwt.configMap.key }}" | ||
{{- if .Values.nats.url }} | ||
# System Account JWT | ||
systemaccountjwtpath: "/etc/nats-config/sys/{{ .Values.operator.systemaccountjwt.configMap.key }}" | ||
# NATS Server connection | ||
nats { | ||
servers: [{{ .Values.nats.url }}] | ||
usercredentials: "/etc/nats-config/syscreds/{{ .Values.nats.credentials.secret.key }}" | ||
} | ||
{{- end }} | ||
{{- if eq .Values.store.type "file"}} | ||
store { | ||
dir: "/store" | ||
} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ template "name" . }} | ||
labels: | ||
app: {{ template "name" . }} | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
selector: | ||
app: {{ template "name" . }} | ||
clusterIP: None | ||
ports: | ||
- name: server | ||
port: 9090 |
92 changes: 92 additions & 0 deletions
92
helm/charts/nats-account-server/templates/statefulset.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: {{ template "name" . }} | ||
labels: | ||
app: {{ template "name" . }} | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: {{ template "name" . }} | ||
replicas: 1 | ||
serviceName: {{ template "name" . }} | ||
{{- if eq .Values.store.type "file"}} | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: {{ template "name" . }}-pvc | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: {{ .Values.store.file.storageSize }} | ||
{{- end }} | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ template "name" . }} | ||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: {{ template "name" . }}-config | ||
- name: nats-sys-creds | ||
secret: | ||
secretName: {{ .Values.nats.credentials.secret.name }} | ||
- name: system-account-jwt-volume | ||
configMap: | ||
name: {{ .Values.operator.systemaccountjwt.configMap.name }} | ||
- name: operator-jwt-volume | ||
configMap: | ||
name: {{ .Values.operator.operatorjwt.configMap.name }} | ||
|
||
######################## | ||
# # | ||
# NATS Account Server # | ||
# # | ||
######################## | ||
terminationGracePeriodSeconds: 60 | ||
containers: | ||
- name: nats-account-server | ||
image: {{ .Values.accountserver.image }} | ||
imagePullPolicy: {{ .Values.accountserver.pullPolicy }} | ||
ports: | ||
- containerPort: 9090 | ||
# hostPort: 9090 | ||
name: server | ||
command: | ||
- "nats-account-server" | ||
- "-c" | ||
- "/etc/nats-config/conf/accountserver.conf" | ||
|
||
volumeMounts: | ||
- name: config-volume | ||
mountPath: /etc/nats-config/conf | ||
- name: system-account-jwt-volume | ||
mountPath: /etc/nats-config/sys | ||
- name: operator-jwt-volume | ||
mountPath: /etc/nats-config/operator | ||
- name: nats-sys-creds | ||
mountPath: /etc/nats-config/syscreds | ||
{{- if eq .Values.store.type "file"}} | ||
- name: {{ template "name" . }}-pvc | ||
mountPath: /store | ||
{{- end }} | ||
|
||
# Liveness/Readiness probes against the monitoring. | ||
# | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 9090 | ||
initialDelaySeconds: 10 | ||
timeoutSeconds: 5 | ||
readinessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 9090 | ||
initialDelaySeconds: 10 | ||
timeoutSeconds: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright 2020 The NATS Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
accountserver: | ||
image: "synadia/nats-account-server:0.8.4" | ||
pullPolicy: IfNotPresent | ||
|
||
store: | ||
type: file | ||
file: | ||
storageSize: 1Gi | ||
|
||
# NATS Server connection settings. | ||
# nats: | ||
# # # NATS Service to which we can connect. | ||
# # url: "nats://nats:4222" | ||
# # | ||
# # # Credentials to connect to the NATS Server. | ||
# # credentials: | ||
# # secret: | ||
# # name: nats-sys-creds | ||
# # key: sys.creds | ||
|
||
# Trusted Operator mode settings. | ||
# operator: | ||
# # # Reference to the system account jwt. | ||
# # systemaccountjwt: | ||
# # configMap: | ||
# # name: nats-sys-jwt | ||
# # key: SYS.jwt | ||
# # | ||
# # # Reference to the Operator JWT. | ||
# # operatorjwt: | ||
# # configMap: | ||
# # name: operator-jwt | ||
# # key: KO.jwt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.