Skip to content

Commit

Permalink
pass conformance
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo committed Feb 21, 2025
1 parent 0d84b2c commit cdb64be
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ download.shellcheck: mise yq ## Download shellcheck locally if necessary.
@$(MISE) plugin install --yes -q shellcheck
@$(MISE) install -q shellcheck@$(SHELLCHECK_VERSION)

.PHONY: download.telepresence
download.telepresence: ## Download telepresence locally if necessary.
curl -L https://github.com/telepresenceio/telepresence/releases/download/v2.21.3/telepresence-linux-amd64 -o ./bin/telepresence
chmod +x ./bin/telepresence

.PHONY: use-setup-envtest
use-setup-envtest:
$(SETUP_ENVTEST) use
Expand Down Expand Up @@ -440,7 +445,8 @@ NCPU := $(shell getconf _NPROCESSORS_ONLN)
PARALLEL := $(if $(PARALLEL),$(PARALLEL),$(NCPU))

.PHONY: _test.conformance
_test.conformance: gotestsum
_test.conformance: gotestsum download.telepresence
PATH=$(PROJECT_DIR)/bin:$(PATH) \
GOTESTSUM_FORMAT=$(GOTESTSUM_FORMAT) \
$(GOTESTSUM) -- $(GOTESTFLAGS) \
-timeout $(CONFORMANCE_TEST_TIMEOUT) \
Expand Down
5 changes: 5 additions & 0 deletions controller/controlplane/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
log.Debug(logger, "DataPlane not set, deployment for ControlPlane will remain dormant")
}

// TODO: before creating a manager, verify that the Admin API service has endpoints OR
// handle more gracefully:
//

log.Trace(logger, "checking readiness of ControlPlane instance")
if err := r.InstancesManager.IsInstanceReady(mgrID); err != nil {
log.Trace(logger, "control plane instance not ready yet", "error", err)
Expand Down Expand Up @@ -254,6 +258,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
Namespace: cp.Namespace,
Name: dataplaneIngressServiceName,
}),
WithMetricsServerOff(),
)
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to create manager config: %w", err)
Expand Down
6 changes: 6 additions & 0 deletions controller/controlplane/manager_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,9 @@ func WithPublishService(service types.NamespacedName) managercfg.Opt {
c.PublishService = mo.Some(service)
}
}

func WithMetricsServerOff() managercfg.Opt {
return func(c *managercfg.Config) {
c.MetricsAddr = "0" // 0 disables metrics server
}
}
4 changes: 2 additions & 2 deletions pkg/utils/kubernetes/resources/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ func GenerateNewAdminServiceForDataPlane(dataplane *operatorv1beta1.DataPlane, o
},
},
Spec: corev1.ServiceSpec{
Type: corev1.ServiceTypeClusterIP,
ClusterIP: corev1.ClusterIPNone,
Type: corev1.ServiceTypeLoadBalancer,
// ClusterIP: corev1.ClusterIPNone,
Selector: map[string]string{
"app": dataplane.Name,
},
Expand Down
23 changes: 23 additions & 0 deletions test/conformance/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"os"
"os/exec"
"path"
"runtime/debug"
"testing"
Expand Down Expand Up @@ -112,6 +113,28 @@ func TestMain(m *testing.M) {
fmt.Println("INFO: deploying CRDs to test cluster")
exitOnErr(testutils.DeployCRDs(ctx, path.Join(configPath, "/crd"), clients.OperatorClient, env.Cluster()))

fmt.Println("INFO: installing telepresence traffic manager in the cluster")
out, err := exec.CommandContext(ctx, "telepresence", "helm", "install").CombinedOutput()
if err != nil {
fmt.Printf("ERROR: failed to install telepresence traffic manager: %s\n", string(out))
exitOnErr(err)
}

fmt.Println("INFO: connecting to the cluster with telepresence")
out, err = exec.CommandContext(ctx, "telepresence", "connect").CombinedOutput()
if err != nil {
fmt.Printf("ERROR: failed to connect to the cluster with telepresence: %s\n", string(out))
exitOnErr(err)
}

defer func() {
fmt.Println("INFO: quitting telepresence daemons")
out, err := exec.CommandContext(ctx, "telepresence", "quit").CombinedOutput()
if err != nil {
fmt.Printf("ERROR: failed to quit telepresence daemons: %s\n", string(out))
}
}()

fmt.Println("INFO: starting the operator's controller manager")
// startControllerManager will spawn the controller manager in a separate
// goroutine and will report whether that succeeded.
Expand Down

0 comments on commit cdb64be

Please sign in to comment.