mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #39103 from a-robinson/v1.5
Automatic merge from submit-queue (batch tested with PRs 40335, 40320, 40324, 39103, 40315) Add pod anti-affinity and a disruption budget to cockroachdb example Pulling in some useful 1.5 features.
This commit is contained in:
commit
e6ed110705
@ -116,7 +116,7 @@ Because all of the resources in this example have been tagged with the label `ap
|
|||||||
we can clean up everything that we created in one quick command using a selector on that label:
|
we can clean up everything that we created in one quick command using a selector on that label:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
kubectl delete statefulsets,pods,persistentvolumes,persistentvolumeclaims,services -l app=cockroachdb
|
kubectl delete statefulsets,persistentvolumes,persistentvolumeclaims,services,poddisruptionbudget -l app=cockroachdb
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +54,18 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
app: cockroachdb
|
app: cockroachdb
|
||||||
---
|
---
|
||||||
|
apiVersion: policy/v1beta1
|
||||||
|
kind: PodDisruptionBudget
|
||||||
|
metadata:
|
||||||
|
name: cockroachdb-budget
|
||||||
|
labels:
|
||||||
|
app: cockroachdb
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: cockroachdb
|
||||||
|
minAvailable: 67%
|
||||||
|
---
|
||||||
apiVersion: apps/v1beta1
|
apiVersion: apps/v1beta1
|
||||||
kind: StatefulSet
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
@ -66,6 +78,22 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: cockroachdb
|
app: cockroachdb
|
||||||
annotations:
|
annotations:
|
||||||
|
scheduler.alpha.kubernetes.io/affinity: >
|
||||||
|
{
|
||||||
|
"podAntiAffinity": {
|
||||||
|
"preferredDuringSchedulingIgnoredDuringExecution": [{
|
||||||
|
"weight": 100,
|
||||||
|
"labelSelector": {
|
||||||
|
"matchExpressions": [{
|
||||||
|
"key": "app",
|
||||||
|
"operator": "In",
|
||||||
|
"values": ["cockroachdb"]
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"topologyKey": "kubernetes.io/hostname"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
# Init containers are run only once in the lifetime of a pod, before
|
# 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
|
# it's started up for the first time. It has to exit successfully
|
||||||
# before the pod's main containers are allowed to start.
|
# before the pod's main containers are allowed to start.
|
||||||
@ -80,6 +108,7 @@ spec:
|
|||||||
{
|
{
|
||||||
"name": "bootstrap",
|
"name": "bootstrap",
|
||||||
"image": "cockroachdb/cockroach-k8s-init:0.1",
|
"image": "cockroachdb/cockroach-k8s-init:0.1",
|
||||||
|
"imagePullPolicy": "IfNotPresent",
|
||||||
"args": [
|
"args": [
|
||||||
"-on-start=/on-start.sh",
|
"-on-start=/on-start.sh",
|
||||||
"-service=cockroachdb"
|
"-service=cockroachdb"
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
set -exuo pipefail
|
set -exuo pipefail
|
||||||
|
|
||||||
# Clean up anything from a prior run:
|
# Clean up anything from a prior run:
|
||||||
kubectl delete statefulsets,pods,persistentvolumes,persistentvolumeclaims,services -l app=cockroachdb
|
kubectl delete statefulsets,persistentvolumes,persistentvolumeclaims,services,poddisruptionbudget -l app=cockroachdb
|
||||||
|
|
||||||
# Make persistent volumes and (correctly named) claims. We must create the
|
# Make persistent volumes and (correctly named) claims. We must create the
|
||||||
# claims here manually even though that sounds counter-intuitive. For details
|
# claims here manually even though that sounds counter-intuitive. For details
|
||||||
|
Loading…
Reference in New Issue
Block a user