Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Run kustomize with base resources #727

Merged
merged 6 commits into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: cockroachdb
labels:
app: cockroachdb
name: cockroachdb
rules:
- apiGroups:
- certificates.k8s.io
Expand All @@ -12,4 +12,4 @@ rules:
verbs:
- create
- get
- watch
- watch
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: cockroachdb
labels:
app: cockroachdb
name: cockroachdb
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cockroachdb
subjects:
- kind: ServiceAccount
name: cockroachdb
namespace: default
namespace: default
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: cockroachdb-budget
labels:
app: cockroachdb
name: cockroachdb-budget
spec:
maxUnavailable: 1
selector:
matchLabels:
app: cockroachdb
maxUnavailable: 1
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: cockroachdb
labels:
app: cockroachdb
name: cockroachdb
rules:
- apiGroups:
- ""
resources:
- secrets
verbs:
- create
- get
- get
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: cockroachdb
labels:
app: cockroachdb
name: cockroachdb
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: cockroachdb
subjects:
- kind: ServiceAccount
name: cockroachdb
namespace: default
namespace: default
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
apiVersion: v1
kind: Service
metadata:
# This service is meant to be used by clients of the database. It exposes a ClusterIP that will
# automatically load balance connections to the different database pods.
name: cockroachdb-public
labels:
app: cockroachdb
name: cockroachdb-public
spec:
ports:
# The main port, served by gRPC, serves Postgres-flavor SQL, internode
# traffic and the cli.
- port: 26257
- name: grpc
port: 26257
targetPort: 26257
name: grpc
# The secondary port serves the UI as well as health and debug endpoints.
- port: 8080
- name: http
port: 8080
targetPort: 8080
name: http
selector:
app: cockroachdb
app: cockroachdb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like how we're losing comments here
I suppose there's nothing for it though
Unless it's possible to use Ethan's comment preservation code... But I really highly doubt it

Copy link
Contributor Author

@Rob0h Rob0h Nov 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might actually - i'll give it a go the yaml contents get replaced by the output from kustomize so you're right it's not possible to change heh

35 changes: 12 additions & 23 deletions integration/init/cockroach/expected/base/Service-cockroachdb.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
apiVersion: v1
kind: Service
metadata:
# This service only exists to create DNS entries for each pod in the stateful
# set such that they can resolve each other's IP addresses. It does not
# create a load-balanced ClusterIP and should not be used directly by clients
# in most circumstances.
name: cockroachdb
labels:
app: cockroachdb
annotations:
# This is needed to make the peer-finder work properly and to help avoid
# edge cases where instance 0 comes up after losing its data and needs to
# decide whether it should create a new cluster or try to join an existing
# one. If it creates a new cluster when it should have joined an existing
# one, we'd end up with two separate clusters listening at the same service
# endpoint, which would be very bad.
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
# Enable automatic monitoring of all instances when Prometheus is running in the cluster.
prometheus.io/scrape: "true"
prometheus.io/path: "_status/vars"
prometheus.io/path: _status/vars
prometheus.io/port: "8080"
prometheus.io/scrape: "true"
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
labels:
app: cockroachdb
name: cockroachdb
spec:
clusterIP: None
ports:
- port: 26257
- name: grpc
port: 26257
targetPort: 26257
name: grpc
- port: 8080
- name: http
port: 8080
targetPort: 8080
name: http
clusterIP: None
selector:
app: cockroachdb
app: cockroachdb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: cockroachdb
labels:
app: cockroachdb
app: cockroachdb
name: cockroachdb
Original file line number Diff line number Diff line change
Expand Up @@ -3,97 +3,83 @@ kind: StatefulSet
metadata:
name: cockroachdb
spec:
serviceName: "cockroachdb"
replicas: 3
serviceName: cockroachdb
template:
metadata:
labels:
app: cockroachdb
spec:
serviceAccountName: cockroachdb
# Init containers are run only once in the lifetime of a pod, before
# it's started up for the first time. It has to exit successfully
# before the pod's main containers are allowed to start.
initContainers:
# The init-certs container sends a certificate signing request to the
# kubernetes cluster.
# You can see pending requests using: kubectl get csr
# CSRs can be approved using: kubectl certificate approve <csr name>
#
# All addresses used to contact a node must be specified in the --addresses arg.
#
# In addition to the node certificate and key, the init-certs entrypoint will symlink
# the cluster CA to the certs directory.
- name: init-certs
image: cockroachdb/cockroach-k8s-request-cert:0.2
imagePullPolicy: IfNotPresent
command:
- "/bin/ash"
- "-ecx"
- "/request-cert -namespace=${POD_NAMESPACE} -certs-dir=/cockroach-certs -type=node -addresses=localhost,127.0.0.1,${POD_IP},$(hostname -f),$(hostname -f|cut -f 1-2 -d '.'),cockroachdb-public -symlink-ca-from=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumeMounts:
- name: certs
mountPath: /cockroach-certs

affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- cockroachdb
topologyKey: kubernetes.io/hostname
weight: 100
containers:
- name: cockroachdb
- command:
- /bin/bash
- -ecx
- exec /cockroach/cockroach start --logtostderr --certs-dir /cockroach/cockroach-certs
--host $(hostname -f) --http-host 0.0.0.0 --join cockroachdb-0.cockroachdb,cockroachdb-1.cockroachdb,cockroachdb-2.cockroachdb
--cache 25% --max-sql-memory 25%
image: cockroachdb/cockroach:v1.1.5
imagePullPolicy: IfNotPresent
name: cockroachdb
ports:
- containerPort: 26257
name: grpc
- containerPort: 8080
name: http
volumeMounts:
- name: datadir
mountPath: /cockroach/cockroach-data
- name: certs
mountPath: /cockroach/cockroach-certs
command:
- "/bin/bash"
- "-ecx"
# The use of qualified `hostname -f` is crucial:
# Other nodes aren't able to look up the unqualified hostname.
# Once 2.0 is out, we should be able to switch from --host to --advertise-host to make port-forwarding work to the main port.
- "exec /cockroach/cockroach start --logtostderr --certs-dir /cockroach/cockroach-certs --host $(hostname -f) --http-host 0.0.0.0 --join cockroachdb-0.cockroachdb,cockroachdb-1.cockroachdb,cockroachdb-2.cockroachdb --cache 25% --max-sql-memory 25%"
# No pre-stop hook is required, a SIGTERM plus some time is all that's
# needed for graceful shutdown of a node.
- mountPath: /cockroach/cockroach-data
name: datadir
- mountPath: /cockroach/cockroach-certs
name: certs
initContainers:
- command:
- /bin/ash
- -ecx
- /request-cert -namespace=${POD_NAMESPACE} -certs-dir=/cockroach-certs -type=node
-addresses=localhost,127.0.0.1,${POD_IP},$(hostname -f),$(hostname -f|cut
-f 1-2 -d '.'),cockroachdb-public -symlink-ca-from=/var/run/secrets/kubernetes.io/serviceaccount/ca.crt
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: cockroachdb/cockroach-k8s-request-cert:0.2
imagePullPolicy: IfNotPresent
name: init-certs
volumeMounts:
- mountPath: /cockroach-certs
name: certs
serviceAccountName: cockroachdb
terminationGracePeriodSeconds: 60
volumes:
- name: datadir
persistentVolumeClaim:
claimName: datadir
- name: certs
emptyDir: {}
- emptyDir: {}
name: certs
updateStrategy:
type: RollingUpdate
volumeClaimTemplates:
- metadata:
name: datadir
spec:
accessModes:
- "ReadWriteOnce"
- ReadWriteOnce
resources:
requests:
storage: 1Gi
50 changes: 23 additions & 27 deletions integration/init/factorio/expected/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
---
# Source: factorio/templates/deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: factorio-factorio
labels:
app: factorio-factorio
chart: "factorio-0.3.1"
release: "factorio"
heritage: "Tiller"
chart: factorio-0.3.1
heritage: Tiller
release: factorio
name: factorio-factorio
spec:
template:
metadata:
labels:
app: factorio-factorio
spec:
containers:
- name: factorio-factorio
image: "quay.io/games_on_k8s/factorio:0.14.22"
imagePullPolicy: Always
resources:
requests:
cpu: 500m
memory: 512Mi

env:
- env:
- name: FACTORIO_SERVER_NAME
value: "Kubernetes Server"
value: Kubernetes Server
- name: FACTORIO_DESCRIPTION
value: "Factorio running on Kubernetes"
value: Factorio running on Kubernetes
- name: FACTORIO_PORT
value: "34197"
- name: FACTORIO_MAX_PLAYERS
Expand All @@ -38,26 +28,32 @@ spec:
- name: FACTORIO_REQUIRE_USER_VERIFICATION
value: "false"
- name: FACTORIO_ALLOW_COMMANDS
value: "admins-only"
value: admins-only
- name: FACTORIO_NO_AUTO_PAUSE
value: "false"
- name: FACTORIO_AUTOSAVE_INTERVAL
value: "2"
- name: FACTORIO_AUTOSAVE_SLOTS
value: "3"

image: quay.io/games_on_k8s/factorio:0.14.22
imagePullPolicy: Always
name: factorio-factorio
ports:
- name: factorio
containerPort: 34197
- containerPort: 34197
name: factorio
protocol: UDP
resources:
requests:
cpu: 500m
memory: 512Mi
volumeMounts:
- name: saves
mountPath: /opt/factorio/saves
- name: mods
mountPath: /opt/factorio/mods
- mountPath: /opt/factorio/saves
name: saves
- mountPath: /opt/factorio/mods
name: mods
volumes:
- name: saves
persistentVolumeClaim:
claimName: factorio-factorio-savedgames
- name: mods
emptyDir: {}
- emptyDir: {}
name: mods
Loading