{{- if or (eq .Values.cloudProvider "kwok") }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Values.kwokConfigMapName | default "kwok-provider-config" }}
  namespace: {{ .Release.Namespace }}
data: 
  config: |-
    # if you see '\n' everywhere, remove all the trailing spaces
    apiVersion: v1alpha1
    readNodesFrom: configmap # possible values: [cluster,configmap]
    nodegroups:
      # to specify how to group nodes into a nodegroup
      # e.g., you want to treat nodes with same instance type as a nodegroup
      # node1: m5.xlarge
      # node2: c5.xlarge
      # node3: m5.xlarge
      # nodegroup1: [node1,node3]
      # nodegroup2: [node2]
      fromNodeLabelKey: "kwok-nodegroup"
      # you can either specify fromNodeLabelKey OR fromNodeAnnotation
      # (both are not allowed)
      # fromNodeAnnotation: "eks.amazonaws.com/nodegroup"
    nodes:
      # gpuConfig:
      #   # to tell kwok provider what label should be considered as GPU label
      #   gpuLabelKey: "k8s.amazonaws.com/accelerator"
      #   availableGPUTypes:
      #     "nvidia-tesla-k80": {}
      #     "nvidia-tesla-p100": {}
    configmap:
      name: kwok-provider-templates
    kwok: {} # default: fetch latest release of kwok from github and install it
    # # you can also manually specify which kwok release you want to install
    # # for example:
    # kwok:
    #   release: v0.3.0
    # # you can also disable installing kwok in CA code (and install your own kwok release)
    # kwok:
    #   install: false (true if not specified)
--- 
apiVersion: v1
kind: ConfigMap
metadata:
  name: kwok-provider-templates
  namespace: {{ .Release.Namespace }}
data: 
  templates: |-
    # if you see '\n' everywhere, remove all the trailing spaces
    apiVersion: v1
    items:
    - apiVersion: v1
      kind: Node
      metadata:
        annotations:
          kubeadm.alpha.kubernetes.io/cri-socket: unix:///run/containerd/containerd.sock
          node.alpha.kubernetes.io/ttl: "0"
          volumes.kubernetes.io/controller-managed-attach-detach: "true"
        creationTimestamp: "2023-05-31T04:39:16Z"
        labels:
          beta.kubernetes.io/arch: amd64
          beta.kubernetes.io/os: linux
          kubernetes.io/arch: amd64
          kubernetes.io/hostname: kind-control-plane
          kwok-nodegroup: control-plane
          kubernetes.io/os: linux
          node-role.kubernetes.io/control-plane: ""
          node.kubernetes.io/exclude-from-external-load-balancers: ""
        name: kind-control-plane
        resourceVersion: "506"
        uid: 86716ec7-3071-4091-b055-77b4361d1dca
      spec:
        podCIDR: 10.244.0.0/24
        podCIDRs:
        - 10.244.0.0/24
        providerID: kind://docker/kind/kind-control-plane
        taints:
        - effect: NoSchedule
          key: node-role.kubernetes.io/control-plane
      status:
        addresses:
        - address: 172.18.0.2
          type: InternalIP
        - address: kind-control-plane
          type: Hostname
        allocatable:
          cpu: "12"
          ephemeral-storage: 959786032Ki
          hugepages-1Gi: "0"
          hugepages-2Mi: "0"
          memory: 32781516Ki
          pods: "110"
        capacity:
          cpu: "12"
          ephemeral-storage: 959786032Ki
          hugepages-1Gi: "0"
          hugepages-2Mi: "0"
          memory: 32781516Ki
          pods: "110"
        conditions:
        - lastHeartbeatTime: "2023-05-31T04:39:58Z"
          lastTransitionTime: "2023-05-31T04:39:13Z"
          message: kubelet has sufficient memory available
          reason: KubeletHasSufficientMemory
          status: "False"
          type: MemoryPressure
        - lastHeartbeatTime: "2023-05-31T04:39:58Z"
          lastTransitionTime: "2023-05-31T04:39:13Z"
          message: kubelet has no disk pressure
          reason: KubeletHasNoDiskPressure
          status: "False"
          type: DiskPressure
        - lastHeartbeatTime: "2023-05-31T04:39:58Z"
          lastTransitionTime: "2023-05-31T04:39:13Z"
          message: kubelet has sufficient PID available
          reason: KubeletHasSufficientPID
          status: "False"
          type: PIDPressure
        - lastHeartbeatTime: "2023-05-31T04:39:58Z"
          lastTransitionTime: "2023-05-31T04:39:46Z"
          message: kubelet is posting ready status
          reason: KubeletReady
          status: "True"
          type: Ready
        daemonEndpoints:
          kubeletEndpoint:
            Port: 10250
        images:
        - names:
          - registry.k8s.io/etcd:3.5.6-0
          sizeBytes: 102542580
        - names:
          - docker.io/library/import-2023-03-30@sha256:ba097b515c8c40689733c0f19de377e9bf8995964b7d7150c2045f3dfd166657
          - registry.k8s.io/kube-apiserver:v1.26.3
          sizeBytes: 80392681
        - names:
          - docker.io/library/import-2023-03-30@sha256:8dbb345de79d1c44f59a7895da702a5f71997ae72aea056609445c397b0c10dc
          - registry.k8s.io/kube-controller-manager:v1.26.3
          sizeBytes: 68538487
        - names:
          - docker.io/library/import-2023-03-30@sha256:44db4d50a5f9c8efbac0d37ea974d1c0419a5928f90748d3d491a041a00c20b5
          - registry.k8s.io/kube-proxy:v1.26.3
          sizeBytes: 67217404
        - names:
          - docker.io/library/import-2023-03-30@sha256:3dd2337f70af979c7362b5e52bbdfcb3a5fd39c78d94d02145150cd2db86ba39
          - registry.k8s.io/kube-scheduler:v1.26.3
          sizeBytes: 57761399
        - names:
          - docker.io/kindest/kindnetd:v20230330-48f316cd@sha256:c19d6362a6a928139820761475a38c24c0cf84d507b9ddf414a078cf627497af
          - docker.io/kindest/kindnetd@sha256:c19d6362a6a928139820761475a38c24c0cf84d507b9ddf414a078cf627497af
          sizeBytes: 27726335
        - names:
          - docker.io/kindest/local-path-provisioner:v0.0.23-kind.0@sha256:f2d0a02831ff3a03cf51343226670d5060623b43a4cfc4808bd0875b2c4b9501
          sizeBytes: 18664669
        - names:
          - registry.k8s.io/coredns/coredns:v1.9.3
          sizeBytes: 14837849
        - names:
          - docker.io/kindest/local-path-helper:v20230330-48f316cd@sha256:135203f2441f916fb13dad1561d27f60a6f11f50ec288b01a7d2ee9947c36270
          sizeBytes: 3052037
        - names:
          - registry.k8s.io/pause:3.7
          sizeBytes: 311278
        nodeInfo:
          architecture: amd64
          bootID: 2d71b318-5d07-4de2-9e61-2da28cf5bbf0
          containerRuntimeVersion: containerd://1.6.19-46-g941215f49
          kernelVersion: 5.15.0-72-generic
          kubeProxyVersion: v1.26.3
          kubeletVersion: v1.26.3
          machineID: 96f8c8b8c8ae4600a3654341f207586e
          operatingSystem: linux
          osImage: Ubuntu 22.04.2 LTS
          systemUUID: 111aa932-7f99-4bef-aaf7-36aa7fb9b012
    - apiVersion: v1
      kind: Node
      metadata:
        annotations:
          kubeadm.alpha.kubernetes.io/cri-socket: unix:///run/containerd/containerd.sock
          node.alpha.kubernetes.io/ttl: "0"
          volumes.kubernetes.io/controller-managed-attach-detach: "true"
        creationTimestamp: "2023-05-31T04:39:57Z"
        labels:
          beta.kubernetes.io/arch: amd64
          beta.kubernetes.io/os: linux
          kubernetes.io/arch: amd64
          kubernetes.io/hostname: kind-worker
          kwok-nodegroup: kind-worker
          kubernetes.io/os: linux
        name: kind-worker
        resourceVersion: "577"
        uid: 2ac0eb71-e5cf-4708-bbbf-476e8f19842b
      spec:
        podCIDR: 10.244.2.0/24
        podCIDRs:
        - 10.244.2.0/24
        providerID: kind://docker/kind/kind-worker
      status:
        addresses:
        - address: 172.18.0.3
          type: InternalIP
        - address: kind-worker
          type: Hostname
        allocatable:
          cpu: "12"
          ephemeral-storage: 959786032Ki
          hugepages-1Gi: "0"
          hugepages-2Mi: "0"
          memory: 32781516Ki
          pods: "110"
        capacity:
          cpu: "12"
          ephemeral-storage: 959786032Ki
          hugepages-1Gi: "0"
          hugepages-2Mi: "0"
          memory: 32781516Ki
          pods: "110"
        conditions:
        - lastHeartbeatTime: "2023-05-31T04:40:17Z"
          lastTransitionTime: "2023-05-31T04:39:57Z"
          message: kubelet has sufficient memory available
          reason: KubeletHasSufficientMemory
          status: "False"
          type: MemoryPressure
        - lastHeartbeatTime: "2023-05-31T04:40:17Z"
          lastTransitionTime: "2023-05-31T04:39:57Z"
          message: kubelet has no disk pressure
          reason: KubeletHasNoDiskPressure
          status: "False"
          type: DiskPressure
        - lastHeartbeatTime: "2023-05-31T04:40:17Z"
          lastTransitionTime: "2023-05-31T04:39:57Z"
          message: kubelet has sufficient PID available
          reason: KubeletHasSufficientPID
          status: "False"
          type: PIDPressure
        - lastHeartbeatTime: "2023-05-31T04:40:17Z"
          lastTransitionTime: "2023-05-31T04:40:05Z"
          message: kubelet is posting ready status
          reason: KubeletReady
          status: "True"
          type: Ready
        daemonEndpoints:
          kubeletEndpoint:
            Port: 10250
        images:
        - names:
          - registry.k8s.io/etcd:3.5.6-0
          sizeBytes: 102542580
        - names:
          - docker.io/library/import-2023-03-30@sha256:ba097b515c8c40689733c0f19de377e9bf8995964b7d7150c2045f3dfd166657
          - registry.k8s.io/kube-apiserver:v1.26.3
          sizeBytes: 80392681
        - names:
          - docker.io/library/import-2023-03-30@sha256:8dbb345de79d1c44f59a7895da702a5f71997ae72aea056609445c397b0c10dc
          - registry.k8s.io/kube-controller-manager:v1.26.3
          sizeBytes: 68538487
        - names:
          - docker.io/library/import-2023-03-30@sha256:44db4d50a5f9c8efbac0d37ea974d1c0419a5928f90748d3d491a041a00c20b5
          - registry.k8s.io/kube-proxy:v1.26.3
          sizeBytes: 67217404
        - names:
          - docker.io/library/import-2023-03-30@sha256:3dd2337f70af979c7362b5e52bbdfcb3a5fd39c78d94d02145150cd2db86ba39
          - registry.k8s.io/kube-scheduler:v1.26.3
          sizeBytes: 57761399
        - names:
          - docker.io/kindest/kindnetd:v20230330-48f316cd@sha256:c19d6362a6a928139820761475a38c24c0cf84d507b9ddf414a078cf627497af
          - docker.io/kindest/kindnetd@sha256:c19d6362a6a928139820761475a38c24c0cf84d507b9ddf414a078cf627497af
          sizeBytes: 27726335
        - names:
          - docker.io/kindest/local-path-provisioner:v0.0.23-kind.0@sha256:f2d0a02831ff3a03cf51343226670d5060623b43a4cfc4808bd0875b2c4b9501
          sizeBytes: 18664669
        - names:
          - registry.k8s.io/coredns/coredns:v1.9.3
          sizeBytes: 14837849
        - names:
          - docker.io/kindest/local-path-helper:v20230330-48f316cd@sha256:135203f2441f916fb13dad1561d27f60a6f11f50ec288b01a7d2ee9947c36270
          sizeBytes: 3052037
        - names:
          - registry.k8s.io/pause:3.7
          sizeBytes: 311278
        nodeInfo:
          architecture: amd64
          bootID: 2d71b318-5d07-4de2-9e61-2da28cf5bbf0
          containerRuntimeVersion: containerd://1.6.19-46-g941215f49
          kernelVersion: 5.15.0-72-generic
          kubeProxyVersion: v1.26.3
          kubeletVersion: v1.26.3
          machineID: a98a13ff474d476294935341f1ba9816
          operatingSystem: linux
          osImage: Ubuntu 22.04.2 LTS
          systemUUID: 5f3c1af8-a385-4776-85e4-73d7f4252b44
    - apiVersion: v1
      kind: Node
      metadata:
        annotations:
          kubeadm.alpha.kubernetes.io/cri-socket: unix:///run/containerd/containerd.sock
          node.alpha.kubernetes.io/ttl: "0"
          volumes.kubernetes.io/controller-managed-attach-detach: "true"
        creationTimestamp: "2023-05-31T04:39:57Z"
        labels:
          beta.kubernetes.io/arch: amd64
          beta.kubernetes.io/os: linux
          kubernetes.io/arch: amd64
          kubernetes.io/hostname: kind-worker2
          kwok-nodegroup: kind-worker2
          kubernetes.io/os: linux
        name: kind-worker2
        resourceVersion: "578"
        uid: edc7df38-feb2-4089-9955-780562bdd21e
      spec:
        podCIDR: 10.244.1.0/24
        podCIDRs:
        - 10.244.1.0/24
        providerID: kind://docker/kind/kind-worker2
      status:
        addresses:
        - address: 172.18.0.4
          type: InternalIP
        - address: kind-worker2
          type: Hostname
        allocatable:
          cpu: "12"
          ephemeral-storage: 959786032Ki
          hugepages-1Gi: "0"
          hugepages-2Mi: "0"
          memory: 32781516Ki
          pods: "110"
        capacity:
          cpu: "12"
          ephemeral-storage: 959786032Ki
          hugepages-1Gi: "0"
          hugepages-2Mi: "0"
          memory: 32781516Ki
          pods: "110"
        conditions:
        - lastHeartbeatTime: "2023-05-31T04:40:17Z"
          lastTransitionTime: "2023-05-31T04:39:57Z"
          message: kubelet has sufficient memory available
          reason: KubeletHasSufficientMemory
          status: "False"
          type: MemoryPressure
        - lastHeartbeatTime: "2023-05-31T04:40:17Z"
          lastTransitionTime: "2023-05-31T04:39:57Z"
          message: kubelet has no disk pressure
          reason: KubeletHasNoDiskPressure
          status: "False"
          type: DiskPressure
        - lastHeartbeatTime: "2023-05-31T04:40:17Z"
          lastTransitionTime: "2023-05-31T04:39:57Z"
          message: kubelet has sufficient PID available
          reason: KubeletHasSufficientPID
          status: "False"
          type: PIDPressure
        - lastHeartbeatTime: "2023-05-31T04:40:17Z"
          lastTransitionTime: "2023-05-31T04:40:08Z"
          message: kubelet is posting ready status
          reason: KubeletReady
          status: "True"
          type: Ready
        daemonEndpoints:
          kubeletEndpoint:
            Port: 10250
        images:
        - names:
          - registry.k8s.io/etcd:3.5.6-0
          sizeBytes: 102542580
        - names:
          - docker.io/library/import-2023-03-30@sha256:ba097b515c8c40689733c0f19de377e9bf8995964b7d7150c2045f3dfd166657
          - registry.k8s.io/kube-apiserver:v1.26.3
          sizeBytes: 80392681
        - names:
          - docker.io/library/import-2023-03-30@sha256:8dbb345de79d1c44f59a7895da702a5f71997ae72aea056609445c397b0c10dc
          - registry.k8s.io/kube-controller-manager:v1.26.3
          sizeBytes: 68538487
        - names:
          - docker.io/library/import-2023-03-30@sha256:44db4d50a5f9c8efbac0d37ea974d1c0419a5928f90748d3d491a041a00c20b5
          - registry.k8s.io/kube-proxy:v1.26.3
          sizeBytes: 67217404
        - names:
          - docker.io/library/import-2023-03-30@sha256:3dd2337f70af979c7362b5e52bbdfcb3a5fd39c78d94d02145150cd2db86ba39
          - registry.k8s.io/kube-scheduler:v1.26.3
          sizeBytes: 57761399
        - names:
          - docker.io/kindest/kindnetd:v20230330-48f316cd@sha256:c19d6362a6a928139820761475a38c24c0cf84d507b9ddf414a078cf627497af
          - docker.io/kindest/kindnetd@sha256:c19d6362a6a928139820761475a38c24c0cf84d507b9ddf414a078cf627497af
          sizeBytes: 27726335
        - names:
          - docker.io/kindest/local-path-provisioner:v0.0.23-kind.0@sha256:f2d0a02831ff3a03cf51343226670d5060623b43a4cfc4808bd0875b2c4b9501
          sizeBytes: 18664669
        - names:
          - registry.k8s.io/coredns/coredns:v1.9.3
          sizeBytes: 14837849
        - names:
          - docker.io/kindest/local-path-helper:v20230330-48f316cd@sha256:135203f2441f916fb13dad1561d27f60a6f11f50ec288b01a7d2ee9947c36270
          sizeBytes: 3052037
        - names:
          - registry.k8s.io/pause:3.7
          sizeBytes: 311278
        nodeInfo:
          architecture: amd64
          bootID: 2d71b318-5d07-4de2-9e61-2da28cf5bbf0
          containerRuntimeVersion: containerd://1.6.19-46-g941215f49
          kernelVersion: 5.15.0-72-generic
          kubeProxyVersion: v1.26.3
          kubeletVersion: v1.26.3
          machineID: fa9f4cd3b3a743bc867b04e44941dcb2
          operatingSystem: linux
          osImage: Ubuntu 22.04.2 LTS
          systemUUID: f36c0f00-8ba5-4c8c-88bc-2981c8d377b9
    kind: List
    metadata:
      resourceVersion: ""

    
{{- end }}
