Skip to content

Commit 412f63b

Browse files
authored
Fix test environment on GKE (#5207)
* Prevent private img test from being run if GKE Signed-off-by: Antonio Gamez Diaz <[email protected]> * Fix typo Signed-off-by: Antonio Gamez Diaz <[email protected]> * Use a clusterrolebinding for "edit" ci user Signed-off-by: Antonio Gamez Diaz <[email protected]> * Add todo and minor typo Signed-off-by: Antonio Gamez Diaz <[email protected]> Signed-off-by: Antonio Gamez Diaz <[email protected]>
1 parent 00346f1 commit 412f63b

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

cmd/kubeapps-apis/plugins/helm/packages/v1alpha1/repositories.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,10 @@ func (s *Server) mapToPackageRepositoryDetail(source *apprepov1alpha1.AppReposit
251251
// Using owner references on the secret so that it can be
252252
// (1) cleaned up automatically and/or
253253
// (2) enable some control (ie. if I add a secret manually
254-
// via kubectl before running kubeapps, it won't get deleted just
255-
// because Kubeapps is deleting it)?
254+
//
255+
// via kubectl before running kubeapps, it won't get deleted just
256+
// because Kubeapps is deleting it)?
257+
//
256258
// See https://github.com/vmware-tanzu/kubeapps/pull/4630#discussion_r861446394 for details
257259
func (s *Server) setOwnerReferencesForRepoSecret(
258260
ctx context.Context,
@@ -500,6 +502,7 @@ func (s *Server) GetPkgRepositories(ctx context.Context, cluster, namespace stri
500502
if err != nil {
501503
return nil, err
502504
}
505+
// TODO(agamez): handle permission denied scenario when listing w/o namespace, which would need a ClusterRole
503506
unstructured, err := resource.List(ctx, metav1.ListOptions{})
504507
if err != nil {
505508
return nil, err

cmd/kubeapps-apis/plugins/helm/packages/v1alpha1/repositories_resources.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (s *Server) updatePkgRepository(ctx context.Context, cluster, namespace str
8484
}
8585

8686
if err = client.Update(ctx, newPkgRepository); err != nil {
87-
return statuserror.FromK8sError("get", AppRepositoryKind, newPkgRepository.Name, err)
87+
return statuserror.FromK8sError("update", AppRepositoryKind, newPkgRepository.Name, err)
8888
}
8989
return nil
9090
}

script/e2e-test.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,11 @@ installChartMuseum "${CHARTMUSEUM_VERSION}"
309309
pushChart apache 8.6.2 admin password
310310
pushChart apache 8.6.3 admin password
311311

312-
# Setting up local Docker registry
313-
setupLocalDockerRegistry
314-
pushLocalChart
312+
# Setting up local Docker registry if not in GKE
313+
if [[ -z "${GKE_BRANCH-}" ]]; then
314+
setupLocalDockerRegistry
315+
pushLocalChart
316+
fi
315317

316318
# Ensure that we are testing the correct image
317319
info ""
@@ -396,7 +398,7 @@ kubectl create serviceaccount kubeapps-edit -n kubeapps
396398
# default). See https://github.com/vmware-tanzu/kubeapps/issues/4435
397399
kubectl create rolebinding kubeapps-edit -n kubeapps --clusterrole=edit --serviceaccount kubeapps:kubeapps-edit
398400
kubectl create rolebinding kubeapps-edit -n default --clusterrole=edit --serviceaccount kubeapps:kubeapps-edit
399-
kubectl create rolebinding kubeapps-repositories-read -n kubeapps --clusterrole kubeapps:kubeapps:apprepositories-read --serviceaccount kubeapps:kubeapps-edit
401+
kubectl create clusterrolebinding kubeapps-repositories-read --clusterrole kubeapps:kubeapps:apprepositories-read --serviceaccount kubeapps:kubeapps-edit
400402
# TODO(minelson): Similar to the `global-repos-read` rolebinding that the chart
401403
# adds to the `kubeapps-repos-global` namespace for all authenticated users, we
402404
# should eventually consider adding a similar rolebinding for secrets in the

0 commit comments

Comments
 (0)