372 lines
20 KiB
YAML
372 lines
20 KiB
YAML
---
|
|
# Source: nats/templates/pod-disruption-budget.yaml
|
|
apiVersion: policy/v1
|
|
kind: PodDisruptionBudget
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: nats
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: nats
|
|
app.kubernetes.io/version: 2.12.5
|
|
helm.sh/chart: nats-2.12.5
|
|
name: nats-cluster
|
|
spec:
|
|
maxUnavailable: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: nats
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/name: nats
|
|
---
|
|
# Source: nats/templates/nats-box/contexts-secret.yaml
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: nats-box
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: nats
|
|
app.kubernetes.io/version: 2.12.5
|
|
helm.sh/chart: nats-2.12.5
|
|
name: nats-cluster-box-contexts
|
|
stringData:
|
|
default.json: |
|
|
{
|
|
"url": "nats://nats-cluster"
|
|
}
|
|
type: Opaque
|
|
---
|
|
# Source: nats/templates/config-map.yaml
|
|
apiVersion: v1
|
|
data:
|
|
nats.conf: |
|
|
{
|
|
"cluster": {
|
|
"name": "nats-cluster",
|
|
"no_advertise": true,
|
|
"port": 6222,
|
|
"routes": [
|
|
"nats://nats-cluster-0.nats-cluster-headless:6222",
|
|
"nats://nats-cluster-1.nats-cluster-headless:6222",
|
|
"nats://nats-cluster-2.nats-cluster-headless:6222"
|
|
]
|
|
},
|
|
"http_port": 8222,
|
|
"jetstream": {
|
|
"max_file_store": 10Gi,
|
|
"max_memory_store": 0,
|
|
"store_dir": "/data"
|
|
},
|
|
"lame_duck_duration": "30s",
|
|
"lame_duck_grace_period": "10s",
|
|
"pid_file": "/var/run/nats/nats.pid",
|
|
"port": 4222,
|
|
"server_name": $SERVER_NAME
|
|
}
|
|
kind: ConfigMap
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: nats
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: nats
|
|
app.kubernetes.io/version: 2.12.5
|
|
helm.sh/chart: nats-2.12.5
|
|
name: nats-cluster-config
|
|
---
|
|
# Source: nats/templates/headless-service.yaml
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: nats
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: nats
|
|
app.kubernetes.io/version: 2.12.5
|
|
helm.sh/chart: nats-2.12.5
|
|
name: nats-cluster-headless
|
|
spec:
|
|
clusterIP: None
|
|
ports:
|
|
- appProtocol: tcp
|
|
name: nats
|
|
port: 4222
|
|
targetPort: nats
|
|
- appProtocol: tcp
|
|
name: cluster
|
|
port: 6222
|
|
targetPort: cluster
|
|
- appProtocol: http
|
|
name: monitor
|
|
port: 8222
|
|
targetPort: monitor
|
|
publishNotReadyAddresses: true
|
|
selector:
|
|
app.kubernetes.io/component: nats
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/name: nats
|
|
---
|
|
# Source: nats/templates/service.yaml
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: nats
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: nats
|
|
app.kubernetes.io/version: 2.12.5
|
|
helm.sh/chart: nats-2.12.5
|
|
name: nats-cluster
|
|
spec:
|
|
ports:
|
|
- appProtocol: tcp
|
|
name: nats
|
|
port: 4222
|
|
targetPort: nats
|
|
selector:
|
|
app.kubernetes.io/component: nats
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/name: nats
|
|
---
|
|
# Source: nats/templates/nats-box/deployment.yaml
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: nats-box
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: nats
|
|
app.kubernetes.io/version: 2.12.5
|
|
helm.sh/chart: nats-2.12.5
|
|
name: nats-cluster-box
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: nats-box
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/name: nats
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: nats-box
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: nats
|
|
app.kubernetes.io/version: 2.12.5
|
|
helm.sh/chart: nats-2.12.5
|
|
spec:
|
|
containers:
|
|
- args:
|
|
- sh
|
|
- -ec
|
|
- trap true INT TERM; sleep infinity & wait
|
|
command:
|
|
- sh
|
|
- -ec
|
|
- |
|
|
work_dir="$(pwd)"
|
|
mkdir -p "$XDG_CONFIG_HOME/nats"
|
|
cd "$XDG_CONFIG_HOME/nats"
|
|
if ! [ -s context ]; then
|
|
ln -s /etc/nats-contexts context
|
|
fi
|
|
if ! [ -f context.txt ]; then
|
|
echo -n "default" > context.txt
|
|
fi
|
|
cd "$work_dir"
|
|
exec /entrypoint.sh "$@"
|
|
- --
|
|
image: natsio/nats-box:0.19.3
|
|
name: nats-box
|
|
resources: null
|
|
volumeMounts:
|
|
- mountPath: /etc/nats-contexts
|
|
name: contexts
|
|
enableServiceLinks: false
|
|
volumes:
|
|
- name: contexts
|
|
secret:
|
|
secretName: nats-cluster-box-contexts
|
|
---
|
|
# Source: nats/templates/stateful-set.yaml
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/component: nats
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: nats
|
|
app.kubernetes.io/version: 2.12.5
|
|
helm.sh/chart: nats-2.12.5
|
|
name: nats-cluster
|
|
spec:
|
|
podManagementPolicy: Parallel
|
|
replicas: 3
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/component: nats
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/name: nats
|
|
serviceName: nats-cluster-headless
|
|
template:
|
|
metadata:
|
|
annotations: null
|
|
labels:
|
|
app.kubernetes.io/component: nats
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: nats
|
|
app.kubernetes.io/version: 2.12.5
|
|
helm.sh/chart: nats-2.12.5
|
|
spec:
|
|
containers:
|
|
- args:
|
|
- --config
|
|
- /etc/nats-config/nats.conf
|
|
env:
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: SERVER_NAME
|
|
value: $(POD_NAME)
|
|
image: nats:2.12.5-alpine
|
|
lifecycle:
|
|
preStop:
|
|
exec:
|
|
command:
|
|
- nats-server
|
|
- -sl=ldm=/var/run/nats/nats.pid
|
|
livenessProbe:
|
|
failureThreshold: 3
|
|
httpGet:
|
|
path: /healthz?js-enabled-only=true
|
|
port: monitor
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 30
|
|
successThreshold: 1
|
|
timeoutSeconds: 5
|
|
name: nats
|
|
ports:
|
|
- containerPort: 4222
|
|
name: nats
|
|
- containerPort: 6222
|
|
name: cluster
|
|
- containerPort: 8222
|
|
name: monitor
|
|
readinessProbe:
|
|
failureThreshold: 3
|
|
httpGet:
|
|
path: /healthz?js-server-only=true
|
|
port: monitor
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
successThreshold: 1
|
|
timeoutSeconds: 5
|
|
resources: {}
|
|
startupProbe:
|
|
failureThreshold: 90
|
|
httpGet:
|
|
path: /healthz
|
|
port: monitor
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
successThreshold: 1
|
|
timeoutSeconds: 5
|
|
volumeMounts:
|
|
- mountPath: /etc/nats-config
|
|
name: config
|
|
- mountPath: /var/run/nats
|
|
name: pid
|
|
- mountPath: /data
|
|
name: nats-cluster-js
|
|
- args:
|
|
- -pid
|
|
- /var/run/nats/nats.pid
|
|
- -config
|
|
- /etc/nats-config/nats.conf
|
|
image: natsio/nats-server-config-reloader:0.21.1
|
|
name: reloader
|
|
volumeMounts:
|
|
- mountPath: /var/run/nats
|
|
name: pid
|
|
- mountPath: /etc/nats-config
|
|
name: config
|
|
enableServiceLinks: false
|
|
shareProcessNamespace: true
|
|
terminationGracePeriodSeconds: 60
|
|
volumes:
|
|
- configMap:
|
|
name: nats-cluster-config
|
|
name: config
|
|
- emptyDir: {}
|
|
name: pid
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: nats-cluster-js
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 10Gi
|
|
storageClassName: longhorn
|
|
---
|
|
# Source: nats/templates/tests/request-reply.yaml
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
annotations:
|
|
helm.sh/hook: test
|
|
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
|
|
labels:
|
|
app.kubernetes.io/component: test-request-reply
|
|
app.kubernetes.io/instance: nats-cluster
|
|
app.kubernetes.io/managed-by: Helm
|
|
app.kubernetes.io/name: nats
|
|
app.kubernetes.io/version: 2.12.5
|
|
helm.sh/chart: nats-2.12.5
|
|
name: nats-cluster-test-request-reply
|
|
spec:
|
|
containers:
|
|
- args:
|
|
- sh
|
|
- -ec
|
|
- nats reply --echo echo & pid="$!"; sleep 1; nats request echo hi > /tmp/resp;
|
|
kill "$pid"; wait; grep -qF hi /tmp/resp
|
|
command:
|
|
- sh
|
|
- -ec
|
|
- |
|
|
work_dir="$(pwd)"
|
|
mkdir -p "$XDG_CONFIG_HOME/nats"
|
|
cd "$XDG_CONFIG_HOME/nats"
|
|
if ! [ -s context ]; then
|
|
ln -s /etc/nats-contexts context
|
|
fi
|
|
if ! [ -f context.txt ]; then
|
|
echo -n "default" > context.txt
|
|
fi
|
|
cd "$work_dir"
|
|
exec /entrypoint.sh "$@"
|
|
- --
|
|
image: natsio/nats-box:0.19.3
|
|
name: nats-box
|
|
resources: null
|
|
volumeMounts:
|
|
- mountPath: /etc/nats-contexts
|
|
name: contexts
|
|
enableServiceLinks: false
|
|
restartPolicy: Never
|
|
volumes:
|
|
- name: contexts
|
|
secret:
|
|
secretName: nats-cluster-box-contexts
|