Skip to content

Commit

Permalink
Undo changes to dev script
Browse files Browse the repository at this point in the history
Script `./dev/setup-fleet-downstream` is no longer needed by
multi-cluster end-to-end test cases for the agent's strict TLS mode.
  • Loading branch information
weyfonk committed Jun 14, 2024
1 parent cc94542 commit 6d5b14d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 30 deletions.
34 changes: 13 additions & 21 deletions dev/setup-fleet-downstream
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

set -euxo pipefail

root_dir=$(git rev-parse --show-toplevel)
cd "$root_dir"
if [ ! -d ./charts/fleet ]; then
echo "please change the current directory to the fleet repo checkout"
exit 1
fi

upstream_ctx="${FLEET_E2E_CLUSTER-k3d-upstream}"
downstream_ctx="${FLEET_E2E_CLUSTER_DOWNSTREAM-k3d-downstream}"
ns="${FLEET_E2E_NS_DOWNSTREAM-fleet-local}"
force_empty_ca="${FORCE_EMPTY_AGENT_CA-}"
api_server_url="${FORCE_API_SERVER_URL-}"
agent_tls_mode="${AGENT_TLS_MODE-system-store}"

kubectl create ns "$ns"|| true

Expand Down Expand Up @@ -46,34 +45,27 @@ kubectl wait clusterregistrationtoken -n "$ns" --for=jsonpath='{.status.secretNa
token=$(kubectl get secret -n "$ns" second-token -o go-template='{{index .data "values" | base64decode}}' | yq .token -)

ca=""
if [ -z $force_empty_ca ]; then
serverver=$(kubectl version -ojson 2> /dev/null | jq '.serverVersion.minor' | sed 's/"//g')
if [ "$serverver" -gt 23 ]; then
ca=$(kubectl get secret -n cattle-fleet-system fleet-controller-bootstrap-token -o go-template='{{index .data "ca.crt" | base64decode}}')
else
name=$(kubectl get -n default sa default -o=jsonpath='{.secrets[0].name}')
ca=$(kubectl get -n default secret "$name" -o go-template='{{index .data "ca.crt" | base64decode}}')
fi
serverver=$(kubectl version -ojson 2> /dev/null | jq '.serverVersion.minor' | sed 's/"//g')
if [ "$serverver" -gt 23 ]; then
ca=$(kubectl get secret -n cattle-fleet-system fleet-controller-bootstrap-token -o go-template='{{index .data "ca.crt" | base64decode}}')
else
name=$(kubectl get -n default sa default -o=jsonpath='{.secrets[0].name}')
ca=$(kubectl get -n default secret "$name" -o go-template='{{index .data "ca.crt" | base64decode}}')
fi

# docker network inspect bridge -f '{{(index .IPAM.Config 0).Gateway}}'
# public_hostname="${public_hostname-172.17.0.1.sslip.io}"

# works due to same network of k3d clusters and patched SAN cert
# works due to same network of k3d clustres and patched SAN cert
public_hostname="${public_hostname-k3d-upstream-server-0}"

if [ -z $api_server_url ]; then
api_server_url="https://$public_hostname:6443"
fi

kubectl config use-context "$downstream_ctx"
helm -n cattle-fleet-system upgrade --install --create-namespace --wait fleet-agent charts/fleet-agent \
--set-string labels.env=test \
--set apiServerCA="$ca" \
--set apiServerURL="$api_server_url" \
--set apiServerURL="https://$public_hostname:6443" \
--set clusterNamespace="$ns" \
--set token="$token" \
--set agentTLSMode="$agent_tls_mode"
--set token="$token"
#--set systemRegistrationNamespace="fleet-clusters-system" \
#--set clientID="fake-random" \
# --set global.cattle.systemDefaultRegistry=public.ecr.aws/b3e3i8k2 \
Expand Down
9 changes: 0 additions & 9 deletions e2e/multi-cluster/installation/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package installation_test

import (
"fmt"
"os"
"os/exec"

. "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -37,14 +36,6 @@ var _ = Describe("Fleet installation with TLS agent modes", func() {
deleteOut, err := kd.Delete("ns", "cattle-fleet-system", "--now")
Expect(err).ToNot(HaveOccurred(), deleteOut)

err = os.Setenv("FORCE_EMPTY_AGENT_CA", "yes")
Expect(err).ToNot(HaveOccurred())
err = os.Setenv("FORCE_API_SERVER_URL", "https://google.com")
Expect(err).ToNot(HaveOccurred())

err = os.Setenv("AGENT_TLS_MODE", agentMode)
Expect(err).ToNot(HaveOccurred())

go func() {
cmd := exec.Command(
"helm",
Expand Down

0 comments on commit 6d5b14d

Please sign in to comment.