Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add annotations for serviceaccount #1248

Merged
merged 2 commits into from
Mar 17, 2022

Conversation

muffl0n
Copy link
Contributor

@muffl0n muffl0n commented Feb 15, 2022

Change Overview

Add possibility to add annotations to the serviceaccount

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

n/a

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

@muffl0n
Copy link
Contributor Author

muffl0n commented Mar 17, 2022

Is there anything I can provide, so this can be merged? We use this feature, so that gcloud calls in our blueprint can make use of "Workload Identity".

serviceAccount:
  annotations:
    iam.gke.io/gcp-service-account: kanister@myproject.iam.gserviceaccount.com
      - func: KubeTask
        name: backupMysql
        args:
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          podOverride:
            serviceAccount: kanister-kanister-operator
          command:
            - /bin/bash
            - -ce
            - |
              backupId="{{ .Options.id }}"

              gcloud sql backups create -i archive --description="${backupId}"
              kando output mysqlArchiveBackupId "${mysqlArchiveBackupId}"

Copy link
Contributor

@ihcsim ihcsim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Works great!

With this added to my values.yaml:

diff --git a/helm/kanister-operator/values.yaml b/helm/kanister-operator/values.yaml
index 763d1ad8..c36dc251 100644
--- a/helm/kanister-operator/values.yaml
+++ b/helm/kanister-operator/values.yaml
@@ -10,6 +10,10 @@ rbac:
 serviceAccount:
   create: true
   name:
+  annotations:
+    foo1: bar
+    foo2: bar
+    kubernetes.io/apps: kanister
 controller:
   service:
     port: 443

I get:

$ helm template helm/kanister-operator --set image-tag=latest 2>&1 | grep -5 annotations                                                       
---
# Source: kanister-operator/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  annotations:
    foo1: bar
    foo2: bar
    kubernetes.io/apps: kanister
  labels:
    heritage: Helm

@ihcsim ihcsim added the kueue label Mar 17, 2022
@mergify mergify bot merged commit b8e8008 into kanisterio:master Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants