Skip to content

Instantly share code, notes, and snippets.

@allanlei
Created September 16, 2018 15:07
Show Gist options
  • Select an option

  • Save allanlei/547b4621f8eb2384fea59c4fb1ce2ca9 to your computer and use it in GitHub Desktop.

Select an option

Save allanlei/547b4621f8eb2384fea59c4fb1ce2ca9 to your computer and use it in GitHub Desktop.

Revisions

  1. allanlei created this gist Sep 16, 2018.
    48 changes: 48 additions & 0 deletions xfs-detector.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    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