e2e: Custom RBAC resources for make test success reporting work when k8s container mode or runner update hook is enabled
This commit is contained in:
		
							parent
							
								
									f70f325f48
								
							
						
					
					
						commit
						6ef276b239
					
				|  | @ -6,6 +6,8 @@ OP=${OP:-apply} | ||||||
| 
 | 
 | ||||||
| RUNNER_LABEL=${RUNNER_LABEL:-self-hosted} | RUNNER_LABEL=${RUNNER_LABEL:-self-hosted} | ||||||
| 
 | 
 | ||||||
|  | cat acceptance/testdata/kubernetes_container_mode.envsubst.yaml  | NAMESPACE=${RUNNER_NAMESPACE} envsubst  | kubectl apply -f - | ||||||
|  | 
 | ||||||
| if [ -n "${TEST_REPO}" ]; then | if [ -n "${TEST_REPO}" ]; then | ||||||
|   if [ "${USE_RUNNERSET}" != "false" ]; then |   if [ "${USE_RUNNERSET}" != "false" ]; then | ||||||
|     cat acceptance/testdata/runnerset.envsubst.yaml | TEST_ENTERPRISE= TEST_ORG= RUNNER_MIN_REPLICAS=${REPO_RUNNER_MIN_REPLICAS} NAME=repo-runnerset envsubst | kubectl ${OP} -f - |     cat acceptance/testdata/runnerset.envsubst.yaml | TEST_ENTERPRISE= TEST_ORG= RUNNER_MIN_REPLICAS=${REPO_RUNNER_MIN_REPLICAS} NAME=repo-runnerset envsubst | kubectl ${OP} -f - | ||||||
|  |  | ||||||
|  | @ -20,6 +20,10 @@ rules: | ||||||
| - apiGroups: [""] | - apiGroups: [""] | ||||||
|   resources: ["secrets"] |   resources: ["secrets"] | ||||||
|   verbs: ["get", "list", "create", "delete"] |   verbs: ["get", "list", "create", "delete"] | ||||||
|  | # Needed to report test success by crating a cm from within workflow job step | ||||||
|  | - apiGroups: [""] | ||||||
|  |   resources: ["configmaps"] | ||||||
|  |   verbs: ["create", "delete"] | ||||||
| --- | --- | ||||||
| apiVersion: rbac.authorization.k8s.io/v1 | apiVersion: rbac.authorization.k8s.io/v1 | ||||||
| kind: ClusterRole | kind: ClusterRole | ||||||
|  | @ -33,7 +37,7 @@ rules: | ||||||
| apiVersion: v1 | apiVersion: v1 | ||||||
| kind: ServiceAccount | kind: ServiceAccount | ||||||
| metadata: | metadata: | ||||||
|   name: runner |   name: ${RUNNER_SERVICE_ACCOUNT_NAME} | ||||||
|   namespace: ${NAMESPACE} |   namespace: ${NAMESPACE} | ||||||
| --- | --- | ||||||
| # To verify it's working, try: | # To verify it's working, try: | ||||||
|  | @ -50,7 +54,7 @@ metadata: | ||||||
|   namespace: ${NAMESPACE} |   namespace: ${NAMESPACE} | ||||||
| subjects: | subjects: | ||||||
| - kind: ServiceAccount | - kind: ServiceAccount | ||||||
|   name: runner |   name: ${RUNNER_SERVICE_ACCOUNT_NAME} | ||||||
|   namespace: ${NAMESPACE} |   namespace: ${NAMESPACE} | ||||||
| roleRef: | roleRef: | ||||||
|   kind: ClusterRole |   kind: ClusterRole | ||||||
|  | @ -64,7 +68,7 @@ metadata: | ||||||
|   namespace: ${NAMESPACE} |   namespace: ${NAMESPACE} | ||||||
| subjects: | subjects: | ||||||
| - kind: ServiceAccount | - kind: ServiceAccount | ||||||
|   name: runner |   name: ${RUNNER_SERVICE_ACCOUNT_NAME} | ||||||
|   namespace: ${NAMESPACE} |   namespace: ${NAMESPACE} | ||||||
| roleRef: | roleRef: | ||||||
|   kind: ClusterRole |   kind: ClusterRole | ||||||
|  |  | ||||||
|  | @ -64,6 +64,7 @@ spec: | ||||||
|         resources: |         resources: | ||||||
|           requests: |           requests: | ||||||
|             storage: 10Gi |             storage: 10Gi | ||||||
|  |       serviceAccountName: ${RUNNER_SERVICE_ACCOUNT_NAME} | ||||||
| --- | --- | ||||||
| apiVersion: actions.summerwind.dev/v1alpha1 | apiVersion: actions.summerwind.dev/v1alpha1 | ||||||
| kind: HorizontalRunnerAutoscaler | kind: HorizontalRunnerAutoscaler | ||||||
|  |  | ||||||
|  | @ -112,6 +112,7 @@ spec: | ||||||
|       labels: |       labels: | ||||||
|         app: ${NAME} |         app: ${NAME} | ||||||
|     spec: |     spec: | ||||||
|  |       serviceAccountName: ${RUNNER_SERVICE_ACCOUNT_NAME} | ||||||
|       containers: |       containers: | ||||||
|       - name: runner |       - name: runner | ||||||
|         imagePullPolicy: IfNotPresent |         imagePullPolicy: IfNotPresent | ||||||
|  |  | ||||||
|  | @ -320,6 +320,8 @@ type env struct { | ||||||
| 	rootlessDocker                              bool | 	rootlessDocker                              bool | ||||||
| 	doDockerBuild                               bool | 	doDockerBuild                               bool | ||||||
| 	containerMode                               string | 	containerMode                               string | ||||||
|  | 	runnerServiceAccuontName                    string | ||||||
|  | 	runnerNamespace                             string | ||||||
| 	remoteKubeconfig                            string | 	remoteKubeconfig                            string | ||||||
| 	imagePullSecretName                         string | 	imagePullSecretName                         string | ||||||
| 	imagePullPolicy                             string | 	imagePullPolicy                             string | ||||||
|  | @ -448,6 +450,8 @@ func initTestEnv(t *testing.T, k8sMinorVer string, vars vars) *env { | ||||||
| 	e.testOrgRepo = testing.Getenv(t, "TEST_ORG_REPO", "") | 	e.testOrgRepo = testing.Getenv(t, "TEST_ORG_REPO", "") | ||||||
| 	e.testEnterprise = testing.Getenv(t, "TEST_ENTERPRISE", "") | 	e.testEnterprise = testing.Getenv(t, "TEST_ENTERPRISE", "") | ||||||
| 	e.testEphemeral = testing.Getenv(t, "TEST_EPHEMERAL", "") | 	e.testEphemeral = testing.Getenv(t, "TEST_EPHEMERAL", "") | ||||||
|  | 	e.runnerServiceAccuontName = testing.Getenv(t, "TEST_RUNNER_SERVICE_ACCOUNT_NAME", "") | ||||||
|  | 	e.runnerNamespace = testing.Getenv(t, "TEST_RUNNER_NAMESPACE", "default") | ||||||
| 	e.remoteKubeconfig = testing.Getenv(t, "ARC_E2E_REMOTE_KUBECONFIG", "") | 	e.remoteKubeconfig = testing.Getenv(t, "ARC_E2E_REMOTE_KUBECONFIG", "") | ||||||
| 	e.imagePullSecretName = testing.Getenv(t, "ARC_E2E_IMAGE_PULL_SECRET_NAME", "") | 	e.imagePullSecretName = testing.Getenv(t, "ARC_E2E_IMAGE_PULL_SECRET_NAME", "") | ||||||
| 	e.vars = vars | 	e.vars = vars | ||||||
|  | @ -642,6 +646,8 @@ func (e *env) do(t *testing.T, op string, kind DeployKind, testID string) { | ||||||
| 	scriptEnv := []string{ | 	scriptEnv := []string{ | ||||||
| 		"KUBECONFIG=" + e.Kubeconfig, | 		"KUBECONFIG=" + e.Kubeconfig, | ||||||
| 		"OP=" + op, | 		"OP=" + op, | ||||||
|  | 		"RUNNER_NAMESPACE=" + e.runnerNamespace, | ||||||
|  | 		"RUNNER_SERVICE_ACCOUNT_NAME=" + e.runnerServiceAccuontName, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	switch kind { | 	switch kind { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue