Remap IRSA for DaemonSets too

This commit is contained in:
Ole Markus With 2021-07-10 13:44:10 +02:00
parent 76727cb4a0
commit 2042912a5b
1 changed files with 10 additions and 4 deletions

View File

@ -87,10 +87,7 @@ func addServiceAccountRole(context *model.KopsModelContext, objects kubemanifest
}
for _, object := range objects {
if object.Kind() != "Deployment" {
continue
}
if object.APIVersion() != "apps/v1" {
if !hasPodSpecTemplate(object) {
continue
}
podSpec := &corev1.PodSpec{}
@ -160,3 +157,12 @@ func addLabels(addon *addonsapi.AddonSpec, objects kubemanifest.ObjectList) erro
}
return nil
}
func hasPodSpecTemplate(object *kubemanifest.Object) bool {
if object.Kind() == "Deployment" || object.Kind() == "DaemonSet" {
if object.APIVersion() == "apps/v1" {
return true
}
}
return false
}