diff --git a/cicd-scripts/setup-e2e-tests.sh b/cicd-scripts/setup-e2e-tests.sh index 30f75bb9d..f53a163a3 100755 --- a/cicd-scripts/setup-e2e-tests.sh +++ b/cicd-scripts/setup-e2e-tests.sh @@ -43,7 +43,7 @@ deploy_hub_spoke_core() { REGISTRATION_LATEST_SNAPSHOT='2.4.9-SNAPSHOT-2022-11-17-20-19-31' make cluster-ip IMAGE_REGISTRY=quay.io/stolostron IMAGE_TAG=${REGISTRATION_LATEST_SNAPSHOT} WORK_TAG=${REGISTRATION_LATEST_SNAPSHOT} REGISTRATION_TAG=${REGISTRATION_LATEST_SNAPSHOT} PLACEMENT_TAG=${REGISTRATION_LATEST_SNAPSHOT} make deploy IMAGE_REGISTRY=quay.io/stolostron IMAGE_TAG=${REGISTRATION_LATEST_SNAPSHOT} WORK_TAG=${REGISTRATION_LATEST_SNAPSHOT} REGISTRATION_TAG=${REGISTRATION_LATEST_SNAPSHOT} PLACEMENT_TAG=${REGISTRATION_LATEST_SNAPSHOT} - # wait until hub and spoke are ready + # wait until hub and spoke are ready wait_for_deployment_ready 10 60s ${HUB_NS} cluster-manager-registration-controller cluster-manager-registration-webhook cluster-manager-work-webhook wait_for_deployment_ready 10 60s ${AGENT_NS} klusterlet-registration-agent klusterlet-work-agent @@ -61,22 +61,22 @@ approve_csr_joinrequest() { for i in {1..60}; do # TODO(morvencao): remove the hard-coded cluster label # for loop for the case that multiple clusters are created - csrs=$(kubectl get csr -lopen-cluster-management.io/cluster-name=${MANAGED_CLUSTER}) - if [[ -n ${csrs} ]]; then - csrnames=$(kubectl get csr -lopen-cluster-management.io/cluster-name=${MANAGED_CLUSTER} -o jsonpath={.items..metadata.name}) - for csrname in ${csrnames}; do - echo "approve CSR: ${csrname}" - kubectl certificate approve ${csrname} - done - break - fi - if [[ ${i} -eq 60 ]]; then - echo "timeout wait for CSR is created." - exit 1 - fi - echo "retrying in 10s..." - sleep 10 - done + csrs=$(kubectl get csr -lopen-cluster-management.io/cluster-name=${MANAGED_CLUSTER}) + if [[ -n ${csrs} ]]; then + csrnames=$(kubectl get csr -lopen-cluster-management.io/cluster-name=${MANAGED_CLUSTER} -o jsonpath={.items..metadata.name}) + for csrname in ${csrnames}; do + echo "approve CSR: ${csrname}" + kubectl certificate approve ${csrname} + done + break + fi + if [[ ${i} -eq 60 ]]; then + echo "timeout wait for CSR is created." + exit 1 + fi + echo "retrying in 10s..." + sleep 10 + done done for i in {1..20}; do @@ -228,7 +228,6 @@ wait_for_deployment_ready() { deploy_managed_cluster() { echo "Setting Kubernetes context to the managed cluster..." - KUBECONFIG=/tmp/managed.yaml IS_KIND_ENV=true kubectl config use-context kind-managed export MANAGED_CLUSTER="managed-cluster-1" @@ -243,7 +242,7 @@ deploy_managed_cluster() { ${SED_COMMAND} "s~clusterName: cluster1$~clusterName: ${MANAGED_CLUSTER}~g" deploy/klusterlet/config/samples/operator_open-cluster-management_klusterlets.cr.yaml make deploy-spoke IMAGE_REGISTRY=quay.io/stolostron IMAGE_TAG=${REGISTRATION_LATEST_SNAPSHOT} WORK_TAG=${REGISTRATION_LATEST_SNAPSHOT} REGISTRATION_TAG=${REGISTRATION_LATEST_SNAPSHOT} PLACEMENT_TAG=${REGISTRATION_LATEST_SNAPSHOT} wait_for_deployment_ready 10 60s ${AGENT_NS} klusterlet-registration-agent klusterlet-work-agent - } +} deploy_hub_and_managed_cluster() { cd $(dirname ${BASH_SOURCE}) @@ -269,15 +268,15 @@ deploy_hub_and_managed_cluster() { echo "Accept join of hub,cluster1" KUBECONFIG=/tmp/hub.yaml IS_KIND_ENV=true - clusteradm accept --context ${hubctx} --clusters ${c1},${hub_name} --skip-approve-check + clusteradm accept --context ${hubctx} --clusters ${c1},${hub_name} --skip-approve-check kubectl get managedclusters --all-namespaces --context ${hubctx} } # function execute is the main routine to do the actual work execute() { -# deploy_hub_spoke_core -# approve_csr_joinrequest -# deploy_managed_cluster + # deploy_hub_spoke_core + # approve_csr_joinrequest + # deploy_managed_cluster deploy_hub_and_managed_cluster deploy_mco_operator deploy_grafana_test diff --git a/go.mod b/go.mod index 94758aea6..1ac8ecf81 100644 --- a/go.mod +++ b/go.mod @@ -44,7 +44,6 @@ require ( k8s.io/apimachinery v0.28.2 k8s.io/client-go v12.0.0+incompatible k8s.io/klog v1.0.0 - k8s.io/klog/v2 v2.100.1 k8s.io/kubectl v0.27.2 open-cluster-management.io/addon-framework v0.8.1-0.20231128122622-3bfdbffb237c open-cluster-management.io/api v0.12.1-0.20231130134655-97a8a92a7f30 @@ -164,6 +163,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/apiserver v0.27.2 // indirect k8s.io/component-base v0.27.2 // indirect + k8s.io/klog/v2 v2.100.1 // indirect k8s.io/kube-aggregator v0.26.1 // indirect k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect diff --git a/tests/pkg/utils/mco_managedcluster.go b/tests/pkg/utils/mco_managedcluster.go index 29d450402..763c85405 100644 --- a/tests/pkg/utils/mco_managedcluster.go +++ b/tests/pkg/utils/mco_managedcluster.go @@ -7,6 +7,7 @@ package utils import ( "context" "errors" + goversion "github.com/hashicorp/go-version" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/tests/run-in-kind/run-e2e-in-kind.sh b/tests/run-in-kind/run-e2e-in-kind.sh index 74460cf01..4838b46a3 100755 --- a/tests/run-in-kind/run-e2e-in-kind.sh +++ b/tests/run-in-kind/run-e2e-in-kind.sh @@ -23,7 +23,6 @@ create_kind_cluster() { export KUBECONFIG=$HOME/.kube/kind-config-$1 } - deploy_service_ca_operator() { kubectl create ns openshift-config-managed kubectl apply -f ${WORKDIR}/service-ca/ @@ -62,4 +61,3 @@ run() { } run -