Skip to content

Commit

Permalink
Merge pull request #1879 from pohly/generic-ephemeral-volume-pod-crea…
Browse files Browse the repository at this point in the history
…tion

pod startup: pre-define generic ephemeral volume type
  • Loading branch information
k8s-ci-robot committed Sep 8, 2021
2 parents 85a23e2 + 8280122 commit 60c7b83
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
Expand Up @@ -146,6 +146,9 @@ steps:
templateFillMap:
Group: volume-test
VolumesPerPod: {{$VOLUMES_PER_POD}}
VolSize: {{$VOL_SIZE}}
StorageClass: {{$STORAGE_CLASS}}
Provisioner: {{$PROVISIONER}}
- name: Waiting for deployments to be running
measurements:
- Identifier: WaitForRunningDeployments
Expand Down
@@ -0,0 +1,67 @@
{{$index := .Index}}
{{$volumesPerPod := .VolumesPerPod}}
{{$name := .Name}}
{{$group := .Group}}
{{$provisioner := .Provisioner}}
{{$storageclass := .StorageClass}}
{{$volsize := .VolSize}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{.Name}}
labels:
group: {{.Group}}
spec:
replicas: 1
selector:
matchLabels:
name: {{.Name}}
template:
metadata:
labels:
group: {{.Group}}
name: {{.Name}}
spec:
containers:
- name: {{.Name}}
image: k8s.gcr.io/pause:3.1
imagePullPolicy: IfNotPresent
volumeMounts:
{{ range $volumeIndex := Loop .VolumesPerPod }}
- name: vol-{{$volumeIndex}}
mountPath: /usr/share/{{$volumeIndex}}
{{ end }}
volumes:
{{ range $volumeIndex := Loop .VolumesPerPod }}
- name: vol-{{$volumeIndex}}
ephemeral:
volumeClaimTemplate:
metadata:
labels:
app: {{$name}}
group: {{$group}}
{{ if $provisioner }}
annotations:
volume.beta.kubernetes.io/storage-provisioner: {{$provisioner}}
{{ end }}
spec:
accessModes:
- ReadWriteOnce
{{ if $storageclass }}
storageClassName: {{$storageclass}}
{{ end }}
resources:
requests:
storage: {{$volsize}}
{{ end }}
# Add not-ready/unreachable tolerations for 15 minutes so that node
# failure doesn't trigger pod deletion.
tolerations:
- key: "node.kubernetes.io/not-ready"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 900
- key: "node.kubernetes.io/unreachable"
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 900
@@ -0,0 +1,4 @@
PROVISION_VOLUME: false
WAIT_FOR_PVS_BOUND: false
WAIT_FOR_PVS_DELETED: false
DEPLOYMENT_TEMPLATE_PATH: "volume-types/genericephemeralinline/deployment_with_inline.yaml"

0 comments on commit 60c7b83

Please sign in to comment.