Skip to content

Commit a6a5633

Browse files
committed
Merge remote-tracking branch 'upstream/main' into ENGCP-593-cert-rotation
* upstream/main: chore(e2e-next): Migrate e2e_cli tests (loft-sh#3797) fix(cli): respect admin override for requireTemplate in vcluster platform create (loft-sh#3725) chore(e2e-next): Fix custom linters for fork PRs (loft-sh#3784) chore(e2e-next): Test refactor ENGPLAT-399 Add --secure flag for TLS verification (loft-sh#3781)
2 parents ee4a573 + 08e147b commit a6a5633

75 files changed

Lines changed: 731 additions & 432 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/e2e.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,6 @@ jobs:
403403
echo "======================================================================================================================"
404404
kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=-1 -p || kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c syncer --tail=-1
405405
echo "======================================================================================================================"
406-
if [[ "${{ matrix.test-suite-path }}" = "./test/e2e_plugin" ]]; then
407-
kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c bootstrap-with-deployment --tail=-1 -p || kubectl logs -l app=${{ env.VCLUSTER_SUFFIX }} -n ${{ env.VCLUSTER_NAMESPACE }} -c bootstrap-with-deployment --tail=-1
408-
echo "======================================================================================================================"
409-
fi
410406
kubectl describe pods -n ${{ env.VCLUSTER_NAMESPACE }}
411407
exit 1
412408

.github/workflows/lint.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,19 @@ jobs:
9898
if: github.event.pull_request.head.repo.full_name == github.repository
9999
run: ./tools/golangci-lint run --timeout 15m -- ./...
100100

101+
- name: Generate config without custom linters (fork PRs)
102+
if: github.event.pull_request.head.repo.full_name != github.repository
103+
run: |
104+
# Remove custom plugin definitions and their enable/exclusion entries
105+
# so stock golangci-lint can run without the compiled plugin binary.
106+
CUSTOM_LINTERS=$(yq '.linters.settings.custom | keys | .[]' .golangci.yml)
107+
cp .golangci.yml .golangci-fork.yml
108+
for linter in $CUSTOM_LINTERS; do
109+
yq -i "del(.linters.settings.custom.\"$linter\")" .golangci-fork.yml
110+
yq -i ".linters.enable -= [\"$linter\"]" .golangci-fork.yml
111+
yq -i "del(.linters.exclusions.rules[] | select(.linters[] == \"$linter\"))" .golangci-fork.yml
112+
done
113+
101114
- name: Run golangci-lint (fork PRs, without custom linters)
102115
if: github.event.pull_request.head.repo.full_name != github.repository
103-
run: golangci-lint run --timeout 15m -- ./...
116+
run: golangci-lint run --timeout 15m --config .golangci-fork.yml -- ./...

Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ setup-csi-volume-snapshots:
134134
#e2e-next tests
135135
@dev-e2e label-filter="core" image="ghcr.io/loft-sh/vcluster:dev-next" *ARGS='': \
136136
(setup label-filter image) \
137-
(run-e2e label-filter image) \
137+
(run-e2e label-filter image "false") \
138138
(teardown label-filter)
139139

140140
@run-e2e label-filter="core" image="ghcr.io/loft-sh/vcluster:dev-next" teardown="true":

cmd/vclusterctl/cmd/platform/start.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,21 @@ before running this command:
8282
startCmd.Flags().StringVar(&cmd.ChartRepo, "chart-repo", "https://charts.loft.sh/", "The chart repo to deploy vCluster platform")
8383
startCmd.Flags().StringVar(&cmd.ChartName, "chart-name", "vcluster-platform", "The chart name to deploy vCluster platform")
8484
startCmd.Flags().BoolVar(&cmd.Docker, "docker", false, "If true, vCluster platform will be installed in Docker")
85+
startCmd.Flags().BoolVar(&cmd.Secure, "secure", false, "If true, verify TLS certificates when connecting to the platform (by default, TLS verification is skipped during bootstrap because the platform starts with a self-signed certificate)")
8586

8687
return startCmd
8788
}
8889

8990
func (cmd *StartCmd) Run(ctx context.Context) error {
90-
// automatically use docker mode if the driver is set to docker
9191
cfg := cmd.LoadedConfig(cmd.Log)
92+
93+
// Bootstrap defaults to insecure because the platform starts with a
94+
// self-signed certificate. Pass --secure to enforce TLS verification.
95+
if !cmd.Secure {
96+
cfg.Platform.Insecure = true
97+
}
98+
99+
// automatically use docker mode if the driver is set to docker
92100
if cfg.Driver.Type == config.DockerDriver && !cmd.Docker {
93101
cmd.Log.Info("Automatically using --docker flag because driver is set to 'docker'")
94102
cmd.Docker = true

cmd/vclusterctl/cmd/platform/start_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ import (
88
"github.com/loft-sh/vcluster/pkg/cli/start"
99
)
1010

11+
func TestNewStartCmd_SecureFlag(t *testing.T) {
12+
globalFlags := &flags.GlobalFlags{}
13+
cmd := NewStartCmd(globalFlags)
14+
15+
// Verify --secure flag exists and defaults to false (insecure by default).
16+
f := cmd.Flags().Lookup("secure")
17+
if f == nil {
18+
t.Fatal("--secure flag not registered on start command")
19+
}
20+
if f.DefValue != "false" {
21+
t.Errorf("expected --secure default to be 'false', got %q", f.DefValue)
22+
}
23+
24+
// Simulate passing --secure on the command line.
25+
if err := cmd.Flags().Set("secure", "true"); err != nil {
26+
t.Fatalf("failed to set --secure flag: %v", err)
27+
}
28+
if f.Value.String() != "true" {
29+
t.Errorf("expected --secure value to be 'true' after set, got %q", f.Value.String())
30+
}
31+
}
32+
1133
func TestPlatformUsesNewActivationFlow(t *testing.T) {
1234
testCases := []struct {
1335
version string

e2e-next/clusters/cli.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package clusters
2+
3+
import _ "embed"
4+
5+
// CLIVCluster is a dedicated vCluster for CLI connect tests.
6+
// Separate from CommonVCluster because connect operations create port-forward
7+
// processes that can disrupt the shared background proxy used by sync tests.
8+
9+
//go:embed vcluster-cli.yaml
10+
var cliVClusterYAML string
11+
12+
var (
13+
CLIVClusterName = "cli-vcluster"
14+
CLIVCluster = register(CLIVClusterName, cliVClusterYAML)
15+
)

e2e-next/clusters/default.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ var (
1313
CommonVCluster = register(CommonVClusterName, defaultVClusterYAML)
1414
)
1515

16-
// Aliases for backward compatibility - all point to CommonVCluster.
16+
// Aliases for backward compatibility.
17+
// These existed as separate cluster definitions before consolidation into CommonVCluster.
18+
// Tests in other repos (vcluster-pro) may reference them by name.
1719
var (
1820
K8sDefaultEndpointVCluster = CommonVCluster
1921
K8sDefaultEndpointVClusterName = CommonVClusterName

e2e-next/clusters/plugin.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package clusters
2+
3+
import _ "embed"
4+
5+
// PluginVCluster runs legacy v1/v2 plugin tests (bootstrap-with-deployment, hooks, import-secrets).
6+
// Plugin example images must be multi-arch (amd64 + arm64) for local testing on macOS ARM.
7+
// If a plugin image is amd64-only, Kind on Apple Silicon will fail with "exec format error".
8+
9+
//go:embed vcluster-plugin.yaml
10+
var pluginVClusterYAML string
11+
12+
var (
13+
PluginVClusterName = "plugin-vcluster"
14+
PluginVCluster = register(PluginVClusterName, pluginVClusterYAML)
15+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
controlPlane:
2+
statefulSet:
3+
image:
4+
registry: ""
5+
repository: {{.Repository}}
6+
tag: {{.Tag}}
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
# Plugin Definition below. This is essentially a valid helm values file that will be merged
2-
# with the other vcluster values during vcluster create or helm install.
1+
controlPlane:
2+
statefulSet:
3+
image:
4+
registry: ""
5+
repository: {{.Repository}}
6+
tag: {{.Tag}}
7+
38
plugin:
49
bootstrap-with-deployment:
10+
# NOTE: v2 is amd64-only; plugin tests require Linux CI or amd64 Kind cluster.
11+
# v4 is multi-arch but uses a newer plugin protocol incompatible with the current syncer.
512
image: ghcr.io/loft-sh/vcluster-example-bootstrap-with-deployment:v2
613
imagePullPolicy: IfNotPresent
714
import-secrets:
@@ -13,4 +20,3 @@ plugins:
1320
hooks:
1421
image: ghcr.io/loft-sh/vcluster-example-hooks:v1
1522
imagePullPolicy: IfNotPresent
16-

0 commit comments

Comments
 (0)