Last active
April 26, 2019 10:39
-
-
Save skinny/d84e1cdcb6607d03255cb38993896242 to your computer and use it in GitHub Desktop.
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
local kap = import 'lib/kapitan.libjsonnet'; | |
local kube = import 'lib/kube.libjsonnet'; | |
local inv = kap.inventory(); | |
local name = 'redis-ha'; | |
local replicas = 3; | |
local statefulset = import "./components/redis/statefulset.jsonnet"; | |
local announcer = import "./components/redis/announce-service.jsonnet"; | |
{ | |
'00_serviceaccount': kube.ServiceAccount('redis-ha'), | |
'01_rbac': kube.List() + { | |
items: [ | |
kube.Role('redis-ha') + { | |
rules: [ | |
{ | |
apiGroups: [''], | |
resources: ['endpoints'], | |
verbs: ['get'], | |
}, | |
], | |
}, | |
kube.RoleBinding('redis-ha') + { | |
roleRef: { | |
name: 'redis-ha', | |
kind: 'Role', | |
apiGroup: 'rbac.authorization.k8s.io', | |
}, | |
subjects: { | |
kind: 'ServiceAccount', | |
name: 'redis-ha' | |
}, | |
}, | |
], | |
} | |
} + statefulset.RedisStatefulSet(name, replicas) | |
------- | |
00_serviceaccount: | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
annotations: {} | |
labels: | |
name: redis-ha | |
name: redis-ha | |
01_rbac: | |
apiVersion: v1 | |
items: | |
- apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: Role | |
metadata: | |
annotations: {} | |
labels: | |
name: redis-ha | |
name: redis-ha | |
rules: | |
- apiGroups: | |
- '' | |
resources: | |
- endpoints | |
verbs: | |
- get | |
- apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: RoleBinding | |
metadata: | |
annotations: {} | |
labels: | |
name: redis-ha | |
name: redis-ha | |
roleRef: | |
apiGroup: rbac.authorization.k8s.io | |
kind: Role | |
name: redis-ha | |
subjects: | |
kind: ServiceAccount | |
name: redis-ha | |
kind: List | |
deployment: | |
apiVersion: apps/v1beta2 | |
kind: StatefulSet | |
metadata: | |
annotations: {} | |
labels: | |
name: redis-ha | |
name: redis-ha | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
name: redis-ha | |
serviceName: redis-ha | |
template: | |
metadata: | |
annotations: {} | |
labels: | |
name: redis-ha | |
spec: | |
containers: | |
- args: '' | |
env: [] | |
image: redis | |
imagePullPolicy: IfNotPresent | |
name: redis-ha | |
ports: [] | |
stdin: false | |
tty: false | |
volumeMounts: [] | |
imagePullSecrets: [] | |
initContainers: [] | |
terminationGracePeriodSeconds: 30 | |
volumes: [] | |
updateStrategy: | |
rollingUpdate: | |
partition: 0 | |
type: RollingUpdate | |
volumeClaimTemplates: [] | |
service: | |
- apiVersion: v1 | |
kind: Service | |
metadata: | |
annotations: | |
service.alpha.kubernetes.io/tolerate-unready-endpoints: 'true' | |
labels: | |
name: redis-ha-announce-0 | |
name: redis-ha-announce-0 | |
spec: | |
ports: | |
- name: server | |
port: 6379 | |
protocol: TCP | |
- name: sentinel | |
port: 26379 | |
protocol: TCP | |
publishNotReadyAddresses: true | |
selector: | |
statefulset.kubernetes.io/pod-name: redis-ha-0 | |
type: ClusterIP | |
- apiVersion: v1 | |
kind: Service | |
metadata: | |
annotations: | |
service.alpha.kubernetes.io/tolerate-unready-endpoints: 'true' | |
labels: | |
name: redis-ha-announce-1 | |
name: redis-ha-announce-1 | |
spec: | |
ports: | |
- name: server | |
port: 6379 | |
protocol: TCP | |
- name: sentinel | |
port: 26379 | |
protocol: TCP | |
publishNotReadyAddresses: true | |
selector: | |
statefulset.kubernetes.io/pod-name: redis-ha-1 | |
type: ClusterIP | |
- apiVersion: v1 | |
kind: Service | |
metadata: | |
annotations: | |
service.alpha.kubernetes.io/tolerate-unready-endpoints: 'true' | |
labels: | |
name: redis-ha-announce-2 | |
name: redis-ha-announce-2 | |
spec: | |
ports: | |
- name: server | |
port: 6379 | |
protocol: TCP | |
- name: sentinel | |
port: 26379 | |
protocol: TCP | |
publishNotReadyAddresses: true | |
selector: | |
statefulset.kubernetes.io/pod-name: redis-ha-2 | |
type: ClusterIP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment