---
dependencies:
  - role: kubernetes-apps/ansible
    when:
      - inventory_hostname == groups['kube_control_plane'][0]

  - role: kubernetes-apps/helm
    when:
      - helm_enabled
    tags:
      - helm

  - role: kubernetes-apps/krew
    when:
      - krew_enabled
    tags:
      - krew

  - role: kubernetes-apps/registry
    when:
      - registry_enabled
      - inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - registry

  - role: kubernetes-apps/metrics_server
    when:
      - metrics_server_enabled
      - inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - metrics_server

  - role: kubernetes-apps/csi_driver/csi_crd
    when:
      - cinder_csi_enabled or csi_snapshot_controller_enabled
      - inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - csi-driver

  - role: kubernetes-apps/csi_driver/cinder
    when:
      - cinder_csi_enabled
    tags:
      - cinder-csi-driver
      - csi-driver

  - role: kubernetes-apps/csi_driver/aws_ebs
    when:
      - aws_ebs_csi_enabled
    tags:
      - aws-ebs-csi-driver
      - csi-driver

  - role: kubernetes-apps/csi_driver/azuredisk
    when:
      - azure_csi_enabled
    tags:
      - azure-csi-driver
      - csi-driver

  - role: kubernetes-apps/csi_driver/gcp_pd
    when:
      - gcp_pd_csi_enabled
    tags:
      - gcp-pd-csi-driver
      - csi-driver

  - role: kubernetes-apps/csi_driver/upcloud
    when:
      - upcloud_csi_enabled
    tags:
      - upcloud-csi-driver
      - csi-driver

  - role: kubernetes-apps/csi_driver/vsphere
    when:
      - vsphere_csi_enabled
    tags:
      - vsphere-csi-driver
      - csi-driver

  - role: kubernetes-apps/persistent_volumes
    when:
      - persistent_volumes_enabled
      - inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - persistent_volumes

  - role: kubernetes-apps/snapshots
    when: inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - snapshots
      - csi-driver

  - role: kubernetes-apps/container_runtimes
    when:
      - inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - container-runtimes

  - role: kubernetes-apps/container_engine_accelerator
    when: nvidia_accelerator_enabled
    tags:
      - container_engine_accelerator

  - role: kubernetes-apps/cloud_controller/oci
    when:
      - cloud_provider is defined
      - cloud_provider == "oci"
      - inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - oci

  - role: kubernetes-apps/metallb
    when:
      - metallb_enabled
      - inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - metallb

  - role: kubernetes-apps/argocd
    when:
      - argocd_enabled
      - inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - argocd

  - role: kubernetes-apps/scheduler_plugins
    when:
      - scheduler_plugins_enabled
      - kube_major_version is version('v1.28', '<')
      - inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - scheduler_plugins

  - role: kubernetes-apps/node_feature_discovery
    when:
      - node_feature_discovery_enabled
      - inventory_hostname == groups['kube_control_plane'][0]
    tags:
      - node_feature_discovery
