Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Coleen Iona Quadros <[email protected]>
  • Loading branch information
coleenquadros committed May 23, 2024
1 parent c78637e commit aedd94e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 26 deletions.
45 changes: 22 additions & 23 deletions cicd-scripts/setup-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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})
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/pkg/utils/mco_managedcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package utils
import (
"context"
"errors"

goversion "github.com/hashicorp/go-version"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down
2 changes: 0 additions & 2 deletions tests/run-in-kind/run-e2e-in-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -62,4 +61,3 @@ run() {
}

run

0 comments on commit aedd94e

Please sign in to comment.