From 6984e258f9c530a9e962dcdcd4a816a52ce59b8e Mon Sep 17 00:00:00 2001 From: Emil Natan Date: Tue, 6 Dec 2022 13:07:36 +0200 Subject: [PATCH] Fix api config location and e2e tests The api config location was inconsistent between the code and deployment manifest. The new location was chosen based on https://github.com/GoogleContainerTools/distroless/issues/718. Kubernetes v1.25 uses new types of tokens for the service accounts which are not automatically created. --- cmd/api/main.go | 1 + config/api.yaml | 2 +- test/e2e/00-setup.sh | 4 ++-- test/e2e/01-install.sh | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmd/api/main.go b/cmd/api/main.go index e9ca8406b..c3185fc11 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -62,6 +62,7 @@ type ConfigFile struct { func main() { viper.AddConfigPath("./env") + viper.AddConfigPath("/env") viper.SetConfigName("config") viper.SetConfigType("env") diff --git a/config/api.yaml b/config/api.yaml index 5161bb8a6..730b80745 100644 --- a/config/api.yaml +++ b/config/api.yaml @@ -53,7 +53,7 @@ spec: value: tekton-results volumeMounts: - name: config - mountPath: /home/nonroot/env + mountPath: /env readOnly: true - name: tls mountPath: "/etc/tls" diff --git a/test/e2e/00-setup.sh b/test/e2e/00-setup.sh index b73fee1c0..67b39103a 100755 --- a/test/e2e/00-setup.sh +++ b/test/e2e/00-setup.sh @@ -19,5 +19,5 @@ export KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-"tekton-results"} ROOT="$(git rev-parse --show-toplevel)" -kind create cluster --loglevel=debug --config "${ROOT}/test/e2e/kind-cluster.yaml" --name=${KIND_CLUSTER_NAME} --wait=60s -kind export kubeconfig \ No newline at end of file +kind create cluster --verbosity 3 --config "${ROOT}/test/e2e/kind-cluster.yaml" --name=${KIND_CLUSTER_NAME} --wait=60s +kind export kubeconfig diff --git a/test/e2e/01-install.sh b/test/e2e/01-install.sh index 4c2bc6df5..5ed6cb64e 100755 --- a/test/e2e/01-install.sh +++ b/test/e2e/01-install.sh @@ -70,10 +70,10 @@ tokens_dir=/tmp/tekton-results/tokens mkdir -p $tokens_dir service_accounts=(all-namespaces-read-access single-namespace-read-access) for service_account in ${service_accounts[@]}; do - kubectl get secrets -o jsonpath="{.items[?(@.metadata.annotations['kubernetes\.io/service-account\.name']=='$service_account')].data.token}"|base64 --decode > $tokens_dir/$service_account + kubectl create token $service_account > $tokens_dir/$service_account echo "Created $tokens_dir/$service_account" done echo "Waiting for deployments to be ready..." -kubectl wait deployment "tekton-results-api" --namespace="tekton-pipelines" --for="condition=available" --timeout="60s" -kubectl wait deployment "tekton-results-watcher" --namespace="tekton-pipelines" --for="condition=available" --timeout="60s" +kubectl wait deployment "tekton-results-api" --namespace="tekton-pipelines" --for="condition=available" --timeout="90s" +kubectl wait deployment "tekton-results-watcher" --namespace="tekton-pipelines" --for="condition=available" --timeout="90s"