apiVersion: v1
kind: ConfigMap
metadata:
  name: get-linode-id
  namespace: kube-system
  labels:
    app: csi-linode
data:
  get-linode-id.sh: |-
    #!/bin/bash -efu
    id="$(kubectl get node/"${NODE_NAME}" -o jsonpath='{.spec.providerID}')"
    if [[ ! -z "${id}" ]]; then
      echo "${id}"
      echo -n "${id:9}" > /linode-info/linode-id
      exit 0
    fi
    echo "Provider ID not found"
    # Exit here so that we wait for the CCM to initialize the provider ID
    exit 1
