Skip to content

Commit 23e35de

Browse files
committed
WIP
On-behalf-of: @SAP [email protected]
1 parent 36464d7 commit 23e35de

File tree

6 files changed

+32
-7
lines changed

6 files changed

+32
-7
lines changed

Dockerfile.tester

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
FROM docker.io/golang:1.24
1+
FROM docker.io/golang:1.23.7
22

3-
RUN git clone --depth 1 https://github.com/kcp-dev/kcp /apps/kcp
4-
WORKDIR /apps/kcp
3+
ENV HTTEST_VERSION="0.3.0"
4+
RUN curl --fail -LO https://codeberg.org/xrstf/httest/releases/download/v${HTTEST_VERSION}/httest_${HTTEST_VERSION}_linux_$(dpkg --print-architecture).tar.gz && \
5+
tar xzf httest_*.tar.gz && \
6+
mv httest_*/httest /usr/local/bin
57

6-
RUN go build -v ./...
8+
WORKDIR /apps/kcp
9+
RUN git clone --depth 1 https://github.com/kcp-dev/kcp . && \
10+
go build -v ./test/...
711

812
ENV NO_GORUN=1
913

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ KUSTOMIZE_VERSION ?= v5.4.3
1010
CONTROLLER_TOOLS_VERSION ?= v0.16.1
1111
ENVTEST_VERSION ?= release-0.19
1212
GOLANGCI_LINT_VERSION ?= 2.1.6
13+
PROTOKOL_VERSION ?= 0.7.2
1314

1415
# Image URL to use all building/pushing image targets
1516
IMG ?= ghcr.io/kcp-dev/kcp-operator
@@ -151,6 +152,7 @@ KUBECTL ?= $(TOOLS_DIR)/kubectl
151152
KUSTOMIZE ?= $(TOOLS_DIR)/kustomize
152153
ENVTEST ?= $(TOOLS_DIR)/setup-envtest
153154
GOLANGCI_LINT = $(TOOLS_DIR)/golangci-lint
155+
PROTOKOL = $(TOOLS_DIR)/protokol
154156
RECONCILER_GEN := $(TOOLS_DIR)/reconciler-gen
155157
OPENSHIFT_GOIMPORTS := $(TOOLS_DIR)/openshift-goimports
156158

@@ -182,6 +184,13 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
182184
$(GOLANGCI_LINT):
183185
@hack/download-tool.sh https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-$(shell go env GOOS)-$(shell go env GOARCH).tar.gz golangci-lint $(GOLANGCI_LINT_VERSION)
184186

187+
.PHONY: protokol
188+
protokol: $(PROTOKOL) ## Download protokol locally if necessary.
189+
190+
.PHONY: $(PROTOKOL)
191+
$(PROTOKOL):
192+
@hack/download-tool.sh https://codeberg.org/xrstf/protokol/releases/download/v${PROTOKOL_VERSION}/protokol_${PROTOKOL_VERSION}_$(shell go env GOOS)_$(shell go env GOARCH).tar.gz protokol $(PROTOKOL_VERSION)
193+
185194
.PHONY: reconciler-gen
186195
reconciler-gen: $(RECONCILER_GEN) ## Download reconciler-gen locally if necessary.
187196

hack/ci/run-kcp-e2e-tests.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ echo "Creating kind cluster $KIND_CLUSTER_NAME…"
4343
kind create cluster --name "$KIND_CLUSTER_NAME"
4444
chmod 600 "$KUBECONFIG"
4545

46+
# store logs as artifacts
47+
make protokol
48+
_tools/protokol --output "$ARTIFACTS/logs" --namespace 'kcp-*' >/dev/null 2>&1 &
49+
4650
# load the operator image into the kind cluster
4751
image="ghcr.io/kcp-dev/kcp-operator:$IMAGE_TAG"
4852
archive=operator.tar

internal/controller/kubeconfig_controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ func (r *KubeconfigReconciler) Reconcile(ctx context.Context, req ctrl.Request)
7272
return ctrl.Result{}, err
7373
}
7474

75+
rootShard := &operatorv1alpha1.RootShard{}
76+
shard := &operatorv1alpha1.Shard{}
77+
7578
var (
76-
rootShard *operatorv1alpha1.RootShard
77-
shard *operatorv1alpha1.Shard
7879
clientCertIssuer string
7980
serverCA string
8081
)

internal/resources/kubeconfig/secret.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ func KubeconfigSecretReconciler(
8080
}
8181

8282
serverURL := resources.GetShardBaseURL(shard)
83+
defaultURL, err := url.JoinPath(serverURL, "clusters", "root")
84+
if err != nil {
85+
return nil, err
86+
}
8387

84-
addCluster("default", serverURL)
88+
addCluster("default", defaultURL)
8589
addCluster("shard-base", serverURL)
8690
config.CurrentContext = "default"
8791

test/e2e/kcpe2e/kcp_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ func TestKcpTestSuite(t *testing.T) {
143143
ObjectMeta: metav1.ObjectMeta{
144144
Namespace: namespace,
145145
GenerateName: "kcp-e2e-",
146+
Labels: map[string]string{
147+
"test": "kcp-e2e",
148+
},
146149
},
147150
Spec: corev1.PodSpec{
148151
RestartPolicy: corev1.RestartPolicyNever,

0 commit comments

Comments
 (0)