From aba63f0f9a825f4b3163eebc6dd06ace44a0bbe0 Mon Sep 17 00:00:00 2001 From: Mateusz Adamek Date: Sat, 26 Sep 2020 19:50:48 +0200 Subject: [PATCH] Added support for dynamic tags in AWS and Azure. (#6752) * Added support for dynamic tags in AWS and Azure. * Added examples of dynamic tags configuration. --- inventory/sample/group_vars/all/aws.yml | 1 + inventory/sample/group_vars/all/azure.yml | 1 + .../aws_ebs/templates/aws-ebs-csi-controllerservice.yml.j2 | 3 +++ .../aws_ebs/templates/aws-ebs-csi-nodeservice.yml.j2 | 3 +++ .../azuredisk-csi/templates/azure-csi-storage-class.yml.j2 | 3 +++ 5 files changed, 11 insertions(+) diff --git a/inventory/sample/group_vars/all/aws.yml b/inventory/sample/group_vars/all/aws.yml index ffaac3592..dab674e60 100644 --- a/inventory/sample/group_vars/all/aws.yml +++ b/inventory/sample/group_vars/all/aws.yml @@ -6,3 +6,4 @@ # aws_ebs_csi_enable_volume_resizing: false # aws_ebs_csi_controller_replicas: 1 # aws_ebs_csi_plugin_image_tag: latest +# aws_ebs_csi_extra_volume_tags: "Owner=owner,Team=team,Environment=environment' diff --git a/inventory/sample/group_vars/all/azure.yml b/inventory/sample/group_vars/all/azure.yml index b9daeb91a..4524edd23 100644 --- a/inventory/sample/group_vars/all/azure.yml +++ b/inventory/sample/group_vars/all/azure.yml @@ -30,6 +30,7 @@ # azure_csi_subnet_name: # azure_csi_security_group_name: # azure_csi_use_instance_metadata: +# azure_csi_tags: "Owner=owner,Team=team,Environment=environment' ## To enable Azure Disk CSI, uncomment below # azure_csi_enabled: true diff --git a/roles/kubernetes-apps/csi_driver/aws_ebs/templates/aws-ebs-csi-controllerservice.yml.j2 b/roles/kubernetes-apps/csi_driver/aws_ebs/templates/aws-ebs-csi-controllerservice.yml.j2 index 021694dd6..0aa5f2b38 100644 --- a/roles/kubernetes-apps/csi_driver/aws_ebs/templates/aws-ebs-csi-controllerservice.yml.j2 +++ b/roles/kubernetes-apps/csi_driver/aws_ebs/templates/aws-ebs-csi-controllerservice.yml.j2 @@ -25,6 +25,9 @@ spec: image: {{ aws_ebs_csi_plugin_image_repo }}:{{ aws_ebs_csi_plugin_image_tag }} args: - --endpoint=$(CSI_ENDPOINT) +{% if aws_ebs_csi_extra_volume_tags is defined %} + - --extra-volume-tags={{ aws_ebs_csi_extra_volume_tags }} +{% endif %} - --logtostderr - --v=5 env: diff --git a/roles/kubernetes-apps/csi_driver/aws_ebs/templates/aws-ebs-csi-nodeservice.yml.j2 b/roles/kubernetes-apps/csi_driver/aws_ebs/templates/aws-ebs-csi-nodeservice.yml.j2 index 3c86e882c..1dc19250d 100644 --- a/roles/kubernetes-apps/csi_driver/aws_ebs/templates/aws-ebs-csi-nodeservice.yml.j2 +++ b/roles/kubernetes-apps/csi_driver/aws_ebs/templates/aws-ebs-csi-nodeservice.yml.j2 @@ -27,6 +27,9 @@ spec: image: {{ aws_ebs_csi_plugin_image_repo }}:{{ aws_ebs_csi_plugin_image_tag }} args: - --endpoint=$(CSI_ENDPOINT) +{% if aws_ebs_csi_extra_volume_tags is defined %} + - --extra-volume-tags={{ aws_ebs_csi_extra_volume_tags }} +{% endif %} - --logtostderr - --v=5 env: diff --git a/roles/kubernetes-apps/persistent_volumes/azuredisk-csi/templates/azure-csi-storage-class.yml.j2 b/roles/kubernetes-apps/persistent_volumes/azuredisk-csi/templates/azure-csi-storage-class.yml.j2 index 80f02b3db..be5cb38f3 100644 --- a/roles/kubernetes-apps/persistent_volumes/azuredisk-csi/templates/azure-csi-storage-class.yml.j2 +++ b/roles/kubernetes-apps/persistent_volumes/azuredisk-csi/templates/azure-csi-storage-class.yml.j2 @@ -6,6 +6,9 @@ metadata: provisioner: disk.csi.azure.com parameters: skuname: {{ storage_account_type }} +{% if azure_csi_tags is defined %} + tags: {{ azure_csi_tags }} +{% endif %} reclaimPolicy: Delete volumeBindingMode: Immediate allowVolumeExpansion: true