Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
Add VolumeSnapshot related RBACs to provider service account for TKC/…
Browse files Browse the repository at this point in the history
…GC (#4491)
  • Loading branch information
akankshapanse authored and Guo XiaoShuang committed Mar 27, 2023
1 parent 62e13dc commit 170cb6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions addons/controllers/csi/vspherecsiconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ var providerServiceAccountRBACRules = []rbacv1.PolicyRule{
Resources: []string{"events"},
Verbs: []string{"list"},
},
{
APIGroups: []string{""},
Resources: []string{"volumesnapshots"},
Verbs: []string{"create", "delete", "get", "list", "patch"},
},
}

// VsphereCSIProviderServiceAccountAggregatedClusterRole is the cluster role to assign permissions to capv provider
Expand Down
4 changes: 2 additions & 2 deletions addons/controllers/vspherecsiconfig_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ var _ = Describe("VSphereCSIConfig Reconciler", func() {
}
Expect(serviceAccount.Spec.Ref.Name).To(Equal(vsphereClusterName))
Expect(serviceAccount.Spec.Ref.Namespace).To(Equal(configKey.Namespace))
Expect(serviceAccount.Spec.Rules).To(HaveLen(6))
Expect(serviceAccount.Spec.Rules).To(HaveLen(7))
Expect(serviceAccount.Spec.TargetNamespace).To(Equal("vmware-system-csi"))
Expect(serviceAccount.Spec.TargetSecretName).To(Equal("pvcsi-provider-creds"))
return nil
Expand All @@ -421,7 +421,7 @@ var _ = Describe("VSphereCSIConfig Reconciler", func() {
Expect(clusterRole.Labels).To(Equal(map[string]string{
constants.CAPVClusterRoleAggregationRuleLabelSelectorKey: constants.CAPVClusterRoleAggregationRuleLabelSelectorValue,
}))
Expect(clusterRole.Rules).To(HaveLen(6))
Expect(clusterRole.Rules).To(HaveLen(7))
return nil
}, waitTimeout, pollingInterval).Should(Succeed())
})
Expand Down

0 comments on commit 170cb6b

Please # to comment.