Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions hack/ci/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -euo pipefail

# make git available
if ! [ -x "$(command -v git)" ]; then
echo "Installing git"
echo "Installing git..."
dnf install -y git
fi

Expand All @@ -27,7 +27,7 @@ if [ -n "${DOCKER_REGISTRY_MIRROR_ADDR:-}" ]; then
# remove "http://" or "https://" prefix
mirror="$(echo "$DOCKER_REGISTRY_MIRROR_ADDR" | awk -F// '{print $NF}')"

echo "Configuring registry mirror for docker.io"
echo "Configuring registry mirror for docker.io..."

cat <<EOF > /etc/containers/registries.conf.d/mirror.conf
[[registry]]
Expand Down Expand Up @@ -65,13 +65,13 @@ if [ -z "$version" ]; then
fi

image="$repository:$version"
echo "Building container image $image"
echo "Building container image $image..."

# build image for all architectures
for arch in $architectures; do
fullTag="$image-$arch"

echo "Building $version-$arch"
echo "Building $version-$arch..."
buildah build-using-dockerfile \
--file Dockerfile \
--tag "$fullTag" \
Expand All @@ -94,7 +94,7 @@ function create_manifest() {
buildah manifest create "$name"
}

echo "Creating manifest $image"
echo "Creating manifest $image..."
create_manifest "$image"
for arch in $architectures; do
buildah manifest add "$image" "$image-$arch"
Expand All @@ -107,7 +107,7 @@ done
if [ -n "$branchName" ]; then
branchImage="$repository:$branchName"

echo "Creating manifest $branchImage"
echo "Creating manifest $branchImage..."
create_manifest "$branchImage"
for arch in $architectures; do
buildah manifest add "$branchImage" "$image-$arch"
Expand All @@ -116,10 +116,10 @@ fi

# push manifest, except in presubmits
if [ -z "${DRY_RUN:-}" ]; then
echo "Logging into GHCR"
echo "Logging into GHCR..."
buildah login --username "$KCP_GHCR_USERNAME" --password "$KCP_GHCR_PASSWORD" ghcr.io

echo "Pushing manifest and images"
echo "Pushing manifest and images..."
buildah manifest push --all "$image" "docker://$image"

if [ -n "${branchImage:-}" ]; then
Expand Down
16 changes: 8 additions & 8 deletions hack/ci/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set -euo pipefail
if [ -n "${KCP_TAG:-}" ]; then
# resolve what looks like branch names
if [[ "$KCP_TAG" == main ]] || [[ "$KCP_TAG" =~ ^release- ]]; then
echo "Resolving kcp $KCP_TAG "
echo "Resolving kcp $KCP_TAG ..."

tmpdir="$(mktemp -d)"
here="$(pwd)"
Expand All @@ -46,7 +46,7 @@ fi
# build the image(s)
export IMAGE_TAG=local

echo "Building container images"
echo "Building container images..."
ARCHITECTURES=arm64 DRY_RUN=yes ./hack/ci/build-image.sh

# start docker so we can run kind
Expand All @@ -55,11 +55,11 @@ start-docker.sh
# create a local kind cluster
KIND_CLUSTER_NAME=e2e

echo "Preloading the kindest/node image"
echo "Preloading the kindest/node image..."
docker load --input /kindest.tar

export KUBECONFIG=$(mktemp)
echo "Creating kind cluster $KIND_CLUSTER_NAME"
echo "Creating kind cluster $KIND_CLUSTER_NAME..."
kind create cluster --name "$KIND_CLUSTER_NAME"
chmod 600 "$KUBECONFIG"

Expand All @@ -74,18 +74,18 @@ make helm
image="ghcr.io/kcp-dev/kcp-operator:$IMAGE_TAG"
archive=operator.tar

echo "Loading operator image into kind"
echo "Loading operator image into kind..."
buildah manifest push --all "$image" "oci-archive:$archive:$image"
kind load image-archive "$archive" --name "$KIND_CLUSTER_NAME"

# deploy the operator
echo "Deploying operator"
echo "Deploying operator..."
kubectl kustomize hack/ci/testdata | kubectl apply --filename -
kubectl --namespace kcp-operator-system wait deployment kcp-operator-controller-manager --for condition=Available
kubectl --namespace kcp-operator-system wait pod --all --for condition=Ready

# deploying cert-manager
echo "Deploying cert-manager"
echo "Deploying cert-manager..."

_tools/helm repo add jetstack https://charts.jetstack.io --force-update
_tools/helm repo update
Expand All @@ -100,7 +100,7 @@ _tools/helm upgrade \

kubectl apply --filename hack/ci/testdata/clusterissuer.yaml

echo "Running e2e tests"
echo "Running e2e tests..."

export HELM_BINARY="$(realpath _tools/helm)"
export ETCD_HELM_CHART="$(realpath hack/ci/testdata/etcd)"
Expand Down
2 changes: 1 addition & 1 deletion hack/download-tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fi
mkdir -p tmp
cd tmp

echo "Downloading $BINARY version $VERSION " >&2
echo "Downloading $BINARY version $VERSION ..." >&2

if $GO_MODULE; then
GOBIN=$(realpath .) go install "$URL@$VERSION"
Expand Down
14 changes: 7 additions & 7 deletions hack/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ DATA_DIR="$(realpath "$DATA_DIR")"
# create a local kind cluster

export KUBECONFIG="$DATA_DIR/kind.kubeconfig"
echo "Creating kind cluster $KIND_CLUSTER_NAME"
echo "Creating kind cluster $KIND_CLUSTER_NAME..."
kind create cluster --name "$KIND_CLUSTER_NAME"
chmod 600 "$KUBECONFIG"

teardown_kind() {
if [[ $OPERATOR_PID -gt 0 ]]; then
echo "Stopping kcp-operator"
echo "Stopping kcp-operator..."
kill -TERM $OPERATOR_PID
wait $OPERATOR_PID
fi

if [[ $PROTOKOL_PID -gt 0 ]]; then
echo "Stopping protokol"
echo "Stopping protokol..."
kill -TERM $PROTOKOL_PID
# no wait because protokol ends quickly and wait would fail
fi
Expand All @@ -59,11 +59,11 @@ fi
echo "Kubeconfig is in $KUBECONFIG."

# deploying operator CRDs
echo "Deploying operator CRDs"
echo "Deploying operator CRDs..."
kubectl apply --kustomize config/crd

# deploying cert-manager
echo "Deploying cert-manager"
echo "Deploying cert-manager..."

_tools/helm repo add jetstack https://charts.jetstack.io --force-update
_tools/helm repo update
Expand All @@ -80,7 +80,7 @@ _tools/helm upgrade \
kubectl apply --filename hack/ci/testdata/clusterissuer.yaml

# start the operator locally
echo "Starting kcp-operator"
echo "Starting kcp-operator..."
_build/manager \
-kubeconfig "$KUBECONFIG" \
-zap-log-level debug \
Expand All @@ -98,7 +98,7 @@ else
echo "collect logs from the kind cluster."
fi

echo "Running e2e tests"
echo "Running e2e tests..."

export HELM_BINARY="$(realpath _tools/helm)"
export ETCD_HELM_CHART="$(realpath hack/ci/testdata/etcd)"
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/frontproxies/frontproxies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ func TestCreateFrontProxy(t *testing.T) {
Groups: []string{"system:masters"},
}

t.Log("Creating kubeconfig for FrontProxy")
t.Log("Creating kubeconfig for FrontProxy...")
if err := client.Create(ctx, &fpConfig); err != nil {
t.Fatal(err)
}
utils.WaitForObject(t, ctx, client, &corev1.Secret{}, types.NamespacedName{Namespace: fpConfig.Namespace, Name: fpConfig.Spec.SecretRef.Name})

// verify that we can use frontproxy kubeconfig to access rootshard workspaces
t.Log("Connecting to FrontProxy")
t.Log("Connecting to FrontProxy...")
kcpClient := utils.ConnectWithKubeconfig(t, ctx, client, namespace.Name, fpConfig.Name)
// proof of life: list something every logicalcluster in kcp has
t.Log("Should be able to list Secrets.")
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/rootshards/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,22 @@ func TestRootShardProxy(t *testing.T) {
Groups: []string{"system:kcp:admin"},
}

t.Log("Creating kubeconfig for RootShard")
t.Log("Creating kubeconfig for RootShard...")
if err := client.Create(ctx, &rsConfig); err != nil {
t.Fatal(err)
}
utils.WaitForObject(t, ctx, client, &corev1.Secret{}, types.NamespacedName{Namespace: rsConfig.Namespace, Name: rsConfig.Spec.SecretRef.Name})

t.Log("Connecting to RootShard")
t.Log("Connecting to RootShard...")
rootShardClient := utils.ConnectWithKubeconfig(t, ctx, client, namespace.Name, rsConfig.Name)

// wait until the 2nd shard has registered itself successfully at the root shard
shardKey := types.NamespacedName{Name: shardName}
t.Log("Waiting for Shard to register itself on the RootShard")
t.Log("Waiting for Shard to register itself on the RootShard...")
utils.WaitForObject(t, ctx, rootShardClient, &kcpcorev1alpha1.Shard{}, shardKey)

// create workspace that we want to have scheduled onto the 2nd shard
t.Log("Creating workspace with its logicalcluster on the 2nd Shard")
t.Log("Creating workspace with its logicalcluster on the 2nd Shard...")
workspace := &kcptenancyv1alpha1.Workspace{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/rootshards/rootshards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ func TestCreateRootShard(t *testing.T) {
Groups: []string{"system:masters"},
}

t.Log("Creating kubeconfig for RootShard")
t.Log("Creating kubeconfig for RootShard...")
if err := client.Create(ctx, &rsConfig); err != nil {
t.Fatal(err)
}
utils.WaitForObject(t, ctx, client, &corev1.Secret{}, types.NamespacedName{Namespace: rsConfig.Namespace, Name: rsConfig.Spec.SecretRef.Name})

t.Log("Connecting to RootShard")
t.Log("Connecting to RootShard...")
kcpClient := utils.ConnectWithKubeconfig(t, ctx, client, namespace.Name, rsConfig.Name)

// proof of life: list something every logicalcluster in kcp has
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/shards/shards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ func TestCreateShard(t *testing.T) {
Groups: []string{"system:masters"},
}

t.Log("Creating kubeconfig for RootShard")
t.Log("Creating kubeconfig for RootShard...")
if err := client.Create(ctx, &rsConfig); err != nil {
t.Fatal(err)
}
utils.WaitForObject(t, ctx, client, &corev1.Secret{}, types.NamespacedName{Namespace: rsConfig.Namespace, Name: rsConfig.Spec.SecretRef.Name})

t.Log("Connecting to RootShard")
t.Log("Connecting to RootShard...")
rootShardClient := utils.ConnectWithKubeconfig(t, ctx, client, namespace.Name, rsConfig.Name)

// wait until the 2nd shard has registered itself successfully at the root shard
shardKey := types.NamespacedName{Name: shardName}
t.Log("Waiting for Shard to register itself on the RootShard")
t.Log("Waiting for Shard to register itself on the RootShard...")
utils.WaitForObject(t, ctx, rootShardClient, &kcpcorev1alpha1.Shard{}, shardKey)

// create a kubeconfig to access the shard
Expand All @@ -108,13 +108,13 @@ func TestCreateShard(t *testing.T) {
Groups: []string{"system:masters"},
}

t.Log("Creating kubeconfig for Shard")
t.Log("Creating kubeconfig for Shard...")
if err := client.Create(ctx, &shardConfig); err != nil {
t.Fatal(err)
}
utils.WaitForObject(t, ctx, client, &corev1.Secret{}, types.NamespacedName{Namespace: shardConfig.Namespace, Name: shardConfig.Spec.SecretRef.Name})

t.Log("Connecting to Shard")
t.Log("Connecting to Shard...")
kcpClient := utils.ConnectWithKubeconfig(t, ctx, client, namespace.Name, shardConfig.Name)

// proof of life: list something every logicalcluster in kcp has
Expand Down
10 changes: 5 additions & 5 deletions test/utils/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func DeployEtcd(t *testing.T, name, namespace string) string {

helmChart := os.Getenv("ETCD_HELM_CHART")

t.Logf("Installing etcd %q into %s", name, namespace)
t.Logf("Installing etcd %q into %s...", name, namespace)
args := []string{"install", "--namespace", namespace, "--atomic", name, helmChart}

helmCommand := os.Getenv("HELM_BINARY")
Expand All @@ -46,7 +46,7 @@ func DeployEtcd(t *testing.T, name, namespace string) string {
t.Fatalf("Failed to deploy etcd: %v", err)
}

t.Log("Waiting for etcd to get ready")
t.Log("Waiting for etcd to get ready...")
args = []string{
"wait",
"pods",
Expand Down Expand Up @@ -108,7 +108,7 @@ func DeployShard(ctx context.Context, t *testing.T, client ctrlruntimeclient.Cli
patch(&shard)
}

t.Logf("Creating Shard %s", shard.Name)
t.Logf("Creating Shard %s...", shard.Name)
if err := client.Create(ctx, &shard); err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -180,7 +180,7 @@ func DeployRootShard(ctx context.Context, t *testing.T, client ctrlruntimeclient
patch(&rootShard)
}

t.Logf("Creating RootShard %s", rootShard.Name)
t.Logf("Creating RootShard %s...", rootShard.Name)
if err := client.Create(ctx, &rootShard); err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -233,7 +233,7 @@ func DeployFrontProxy(ctx context.Context, t *testing.T, client ctrlruntimeclien
patch(&frontProxy)
}

t.Logf("Creating FrontProxy %s", frontProxy.Name)
t.Logf("Creating FrontProxy %s...", frontProxy.Name)
if err := client.Create(ctx, &frontProxy); err != nil {
t.Fatal(err)
}
Expand Down
6 changes: 3 additions & 3 deletions test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ func CreateSelfDestructingNamespace(t *testing.T, ctx context.Context, client ct
ns := corev1.Namespace{}
ns.Name = fmt.Sprintf("e2e-%s", name)

t.Logf("Creating namespace %s", name)
t.Logf("Creating namespace %s...", name)
if err := client.Create(ctx, &ns); err != nil {
t.Fatal(err)
}

t.Cleanup(func() {
t.Logf("Deleting namespace %s", name)
t.Logf("Deleting namespace %s...", name)
if err := client.Delete(ctx, &ns); err != nil {
t.Fatal(err)
}
Expand All @@ -137,7 +137,7 @@ func SelfDestuctingPortForward(
fmt.Sprintf("%d:%d", localPort, targetPort),
}

t.Logf("Exposing %s:%d on port %d", target, targetPort, localPort)
t.Logf("Exposing %s:%d on port %d...", target, targetPort, localPort)

localCtx, cancel := context.WithCancel(ctx)

Expand Down
4 changes: 2 additions & 2 deletions test/utils/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
func WaitForPods(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client, listOpts ...ctrlruntimeclient.ListOption) {
t.Helper()

t.Log("Waiting for pods to be available")
t.Log("Waiting for pods to be available...")

err := wait.PollUntilContextTimeout(ctx, 500*time.Millisecond, 5*time.Minute, false, func(ctx context.Context) (done bool, err error) {
pods := corev1.PodList{}
Expand Down Expand Up @@ -69,7 +69,7 @@ func podIsReady(pod corev1.Pod) bool {

func WaitForObject(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client, obj ctrlruntimeclient.Object, key types.NamespacedName) {
t.Helper()
t.Logf("Waiting for %T to be available", obj)
t.Logf("Waiting for %T to be available...", obj)

err := wait.PollUntilContextTimeout(ctx, 500*time.Millisecond, 3*time.Minute, false, func(ctx context.Context) (done bool, err error) {
err = client.Get(ctx, key, obj)
Expand Down