@@ -28,24 +28,18 @@ pub enum Error {
28
28
}
29
29
30
30
/// Build RBAC objects for the product workloads.
31
- /// The `product_name` is meant to be the product name, for example: zookeeper, airflow, etc.
32
- /// and it is a assumed that a ClusterRole named `{product_name}-clusterrole` exists.
31
+ /// The names of the service account and role binding match the following templates:
32
+ /// - `{resource_name}-serviceaccount`
33
+ /// - `{resource_name}-rolebinding`
34
+ ///
35
+ /// The service account is bound to a cluster role named `{product_name}-clusterrole` which
36
+ /// must already exist.
33
37
pub fn build_rbac_resources < T : Clone + Resource < DynamicType = ( ) > > (
34
38
resource : & T ,
35
- // 'product_name' is not used to build the names of the serviceAccount and roleBinding objects,
36
- // as this caused problems with multiple clusters of the same product within the same namespace
37
- // see <https://stackable.atlassian.net/browse/SUP-148> for more details.
38
- // Instead the names for these objects are created by reading the name from the cluster object
39
- // and appending [-rolebinding|-serviceaccount] to create unique names instead of using the
40
- // same objects for multiple clusters.
41
39
product_name : & str ,
42
40
labels : Labels ,
43
41
) -> Result < ( ServiceAccount , RoleBinding ) > {
44
42
let sa_name = service_account_name ( & resource. name_any ( ) ) ;
45
- // We add the legacy serviceAccount name to the binding here for at least one
46
- // release cycle, so that the switchover during the upgrade can be smoother.
47
- // To be removed in v24.3+1.
48
- let legacy_sa_name = service_account_name ( product_name) ;
49
43
let service_account = ServiceAccount {
50
44
metadata : ObjectMetaBuilder :: new ( )
51
45
. name_and_namespace ( resource)
@@ -74,22 +68,12 @@ pub fn build_rbac_resources<T: Clone + Resource<DynamicType = ()>>(
74
68
name : format ! ( "{product_name}-clusterrole" ) ,
75
69
api_group : "rbac.authorization.k8s.io" . to_string ( ) ,
76
70
} ,
77
- subjects : Some ( vec ! [
78
- Subject {
79
- kind: "ServiceAccount" . to_string( ) ,
80
- name: sa_name,
81
- namespace: resource. namespace( ) ,
82
- ..Subject :: default ( )
83
- } ,
84
- // We add the legacy serviceAccount name to the binding here for at least one
85
- // release cycle, so that the switchover during the upgrade can be smoother.
86
- Subject {
87
- kind: "ServiceAccount" . to_string( ) ,
88
- name: legacy_sa_name,
89
- namespace: resource. namespace( ) ,
90
- ..Subject :: default ( )
91
- } ,
92
- ] ) ,
71
+ subjects : Some ( vec ! [ Subject {
72
+ kind: "ServiceAccount" . to_string( ) ,
73
+ name: sa_name,
74
+ namespace: resource. namespace( ) ,
75
+ ..Subject :: default ( )
76
+ } ] ) ,
93
77
} ;
94
78
95
79
Ok ( ( service_account, role_binding) )
0 commit comments