Extend manager roles to accept ephemeralrunnerset/finalizers (#2493)
This commit is contained in:
		
							parent
							
								
									1a491cbfe5
								
							
						
					
					
						commit
						b86af190f7
					
				|  | @ -78,6 +78,13 @@ rules: | ||||||
|   - get |   - get | ||||||
|   - patch |   - patch | ||||||
|   - update |   - update | ||||||
|  | - apiGroups: | ||||||
|  |   - actions.github.com | ||||||
|  |   resources: | ||||||
|  |   - ephemeralrunnersets/finalizers | ||||||
|  |   verbs: | ||||||
|  |   - patch | ||||||
|  |   - update | ||||||
| - apiGroups: | - apiGroups: | ||||||
|   - actions.github.com |   - actions.github.com | ||||||
|   resources: |   resources: | ||||||
|  |  | ||||||
|  | @ -52,6 +52,13 @@ rules: | ||||||
|   - get |   - get | ||||||
|   - patch |   - patch | ||||||
|   - update |   - update | ||||||
|  | - apiGroups: | ||||||
|  |   - actions.github.com | ||||||
|  |   resources: | ||||||
|  |   - ephemeralrunnersets/finalizers | ||||||
|  |   verbs: | ||||||
|  |   - patch | ||||||
|  |   - update | ||||||
| - apiGroups: | - apiGroups: | ||||||
|   - actions.github.com |   - actions.github.com | ||||||
|   resources: |   resources: | ||||||
|  |  | ||||||
|  | @ -169,7 +169,7 @@ func TestTemplate_CreateManagerClusterRole(t *testing.T) { | ||||||
| 
 | 
 | ||||||
| 	assert.Empty(t, managerClusterRole.Namespace, "ClusterRole should not have a namespace") | 	assert.Empty(t, managerClusterRole.Namespace, "ClusterRole should not have a namespace") | ||||||
| 	assert.Equal(t, "test-arc-gha-runner-scale-set-controller-manager-cluster-role", managerClusterRole.Name) | 	assert.Equal(t, "test-arc-gha-runner-scale-set-controller-manager-cluster-role", managerClusterRole.Name) | ||||||
| 	assert.Equal(t, 15, len(managerClusterRole.Rules)) | 	assert.Equal(t, 16, len(managerClusterRole.Rules)) | ||||||
| 
 | 
 | ||||||
| 	_, err = helm.RenderTemplateE(t, options, helmChartPath, releaseName, []string{"templates/manager_single_namespace_controller_role.yaml"}) | 	_, err = helm.RenderTemplateE(t, options, helmChartPath, releaseName, []string{"templates/manager_single_namespace_controller_role.yaml"}) | ||||||
| 	assert.ErrorContains(t, err, "could not find template templates/manager_single_namespace_controller_role.yaml in chart", "We should get an error because the template should be skipped") | 	assert.ErrorContains(t, err, "could not find template templates/manager_single_namespace_controller_role.yaml in chart", "We should get an error because the template should be skipped") | ||||||
|  | @ -843,7 +843,7 @@ func TestTemplate_CreateManagerSingleNamespaceRole(t *testing.T) { | ||||||
| 
 | 
 | ||||||
| 	assert.Equal(t, "test-arc-gha-runner-scale-set-controller-manager-single-namespace-role", managerSingleNamespaceWatchRole.Name) | 	assert.Equal(t, "test-arc-gha-runner-scale-set-controller-manager-single-namespace-role", managerSingleNamespaceWatchRole.Name) | ||||||
| 	assert.Equal(t, "demo", managerSingleNamespaceWatchRole.Namespace) | 	assert.Equal(t, "demo", managerSingleNamespaceWatchRole.Namespace) | ||||||
| 	assert.Equal(t, 13, len(managerSingleNamespaceWatchRole.Rules)) | 	assert.Equal(t, 14, len(managerSingleNamespaceWatchRole.Rules)) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func TestTemplate_ManagerSingleNamespaceRoleBinding(t *testing.T) { | func TestTemplate_ManagerSingleNamespaceRoleBinding(t *testing.T) { | ||||||
|  |  | ||||||
|  | @ -102,6 +102,13 @@ rules: | ||||||
|   - patch |   - patch | ||||||
|   - update |   - update | ||||||
|   - watch |   - watch | ||||||
|  | - apiGroups: | ||||||
|  |   - actions.github.com | ||||||
|  |   resources: | ||||||
|  |   - ephemeralrunnersets/finalizers | ||||||
|  |   verbs: | ||||||
|  |   - patch | ||||||
|  |   - update | ||||||
| - apiGroups: | - apiGroups: | ||||||
|   - actions.github.com |   - actions.github.com | ||||||
|   resources: |   resources: | ||||||
|  |  | ||||||
|  | @ -56,6 +56,7 @@ type EphemeralRunnerSetReconciler struct { | ||||||
| 
 | 
 | ||||||
| //+kubebuilder:rbac:groups=actions.github.com,resources=ephemeralrunnersets,verbs=get;list;watch;create;update;patch;delete
 | //+kubebuilder:rbac:groups=actions.github.com,resources=ephemeralrunnersets,verbs=get;list;watch;create;update;patch;delete
 | ||||||
| //+kubebuilder:rbac:groups=actions.github.com,resources=ephemeralrunnersets/status,verbs=get;update;patch
 | //+kubebuilder:rbac:groups=actions.github.com,resources=ephemeralrunnersets/status,verbs=get;update;patch
 | ||||||
|  | // +kubebuilder:rbac:groups=actions.github.com,resources=ephemeralrunnersets/finalizers,verbs=update;patch
 | ||||||
| //+kubebuilder:rbac:groups=actions.github.com,resources=ephemeralrunners,verbs=get;list;watch;create;update;patch;delete
 | //+kubebuilder:rbac:groups=actions.github.com,resources=ephemeralrunners,verbs=get;list;watch;create;update;patch;delete
 | ||||||
| //+kubebuilder:rbac:groups=actions.github.com,resources=ephemeralrunners/status,verbs=get
 | //+kubebuilder:rbac:groups=actions.github.com,resources=ephemeralrunners/status,verbs=get
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue