Skip to content

Instantly share code, notes, and snippets.

@allanlei
Created September 16, 2018 15:07
Show Gist options
  • Save allanlei/547b4621f8eb2384fea59c4fb1ce2ca9 to your computer and use it in GitHub Desktop.
Save allanlei/547b4621f8eb2384fea59c4fb1ce2ca9 to your computer and use it in GitHub Desktop.
Kubernetes XFS support detector
apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: kube-system
name: xfs-detector
labels:
app: xfs-detector
spec:
selector:
matchLabels:
app: xfs-detector
template:
metadata:
labels:
app: xfs-detector
spec:
hostPID: true
volumes:
- name: tmp
emptyDir: {}
initContainers:
- name: detect
image: wardsco/nsenter
imagePullPolicy: IfNotPresent
command: ["sh", "-eo", "pipefail", "-c"]
args: ["nsenter -t 1 -m -u -i -n -p -- sh -c 'command -v xfs_mkfile' && touch /tmp/xfs_mkfile || true"]
securityContext:
privileged: true
volumeMounts:
- name: tmp
mountPath: /tmp/
- name: label
image: wardsco/kubectl:1.11
command: ["sh", "-eo", "pipefail", "-c"]
args: ["kubectl label node --overwrite $NODE_NAME fs.type/xfs=$(test -e /tmp/xfs_mkfile && echo 'true' || echo 'false'"]
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: tmp
mountPath: /tmp/
readOnly: true
containers:
- name: sleep
image: wardsco/sleep
imagePullPolicy: IfNotPresent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment