Commit Graph
521 Commits
Author SHA1 Message Date
copilot-swe-agent[bot]andGitHub e64e8c3093 ci: bump checkout action in hcp conformance workflow 2026-07-22 19:30:48 +00:00
d9219da469 Fix cluster delete for missing clusters (#1051)
* Fix cluster delete for missing clusters

Signed-off-by: nightcityblade <nightcityblade@gmail.com>

* Adjust missing cluster error message

---------

Signed-off-by: nightcityblade <nightcityblade@gmail.com>
Co-authored-by: nightcityblade <nightcityblade@gmail.com>
2026-07-22 20:58:52 +02:00
Enrico CandinoandGitHub 3a89a4d53b Refactor E2E tests to use a matrix strategy (#1061)
* Refactor E2E tests to use a matrix strategy and update labels for better organization

* Enhance E2E test labels for better categorization and clarity

* Refactor E2E test labels for improved clarity and organization
2026-07-22 18:52:33 +02:00
Enrico CandinoandGitHub 22f0b9c699 Add completion to --namespace flag (#1049)
* Add completion to `--namespace` flag

* Add namespace completion to policy create command

* Refactor namespace completion functions for consistency across commands

* addressed some comments
2026-07-22 17:11:17 +02:00
Enrico CandinoandGitHub b6855c1636 Bump google.golang.org/grpc to v1.82.1 (#1060) 2026-07-22 16:01:12 +02:00
5ef3f38571 Update GitHub Actions (#1054)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-22 10:33:40 +02:00
Enrico CandinoandGitHub a26d37f654 Bump charts to v1.2.0-rc1 (#1043) chart-1.2.0-rc1 2026-07-17 16:54:04 +02:00
1ebeee28de Update GitHub Actions (#1039)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
v1.2.0-rc1
2026-07-17 15:52:00 +02:00
Enrico CandinoandGitHub 7d2105ecf5 Update golang.org/x/text to v0.39.0 (#1038)
* Update `golang.org/x/text` to `v0.39.0`

* align dependencies
2026-07-16 17:00:16 +02:00
e1ae07c836 Isolate only virtual cluster workload Pods (#989)
* Enhance network policy to isolate synced workload pods and improve cross-cluster pod isolation handling

* Add test for label update on synced Pod to ensure isolation label persistence

* Derive host pod CIDRs dynamically for the isolation NetworkPolicy

Compute the egress-exclude CIDRs from the --cluster-cidr flag or the live
Node PodCIDR(s) via FindPodCIDRs, instead of a hardcoded guess, so cross-cluster
pod isolation is enforced against the host's real pod network. Adds unit,
integration, and e2e coverage.

* update comment

* Sort CIDR list in FindPodCIDRs function to ensure consistent order for egress rules

* Use `t.Context()` instead of `context.Background()`

Co-authored-by: Kevin McDermott <bigkevmcd@gmail.com>

* Use Ginkgo provided context

* Refactor FindPodCIDRs to use sets for CIDR collection and simplify logic

* fix lint

---------

Co-authored-by: Kevin McDermott <bigkevmcd@gmail.com>
2026-07-16 15:18:04 +02:00
10a0b42c6a Move pkg/apis to its own package (#1026)
* move apis to seperate package

* move github.com/rancher/k3k/pkg/apis in go.mod

---------

Co-authored-by: Enrico Candino <enrico.candino@suse.com>
2026-07-16 11:35:43 +02:00
d19016fa9c Update module go.etcd.io/etcd/client/v3 to v3.7.0 (#1007)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-16 10:37:40 +02:00
98119e764a Update rancher/renovate-config digest to 573ec77 (#1015)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-16 10:33:40 +02:00
Enrico CandinoandGitHub 3a4d93f5fb Fix dangling Pods (#1021)
* Add tests asserting GetPods is scoped to the node's own Pods

Adds a unit test (fake host + virtual clients, Pods across multiple nodes plus
a dangling one) and a multi-node e2e test (a Deployment with one nginx Pod per
node via required anti-affinity; restart every k3k-kubelet agent Pod; assert no
workload Pod is deleted from the host or virtual cluster). Both pin the intended
behavior and fail against the current code; the fix follows in the next commit.

* Scope Provider.GetPods to the node's own Pods to prevent cross-node dangling-pod deletion

GetPods() listed host Pods cluster-wide (by the k3k.io/clusterName label only).
The vendored virtual-kubelet library's deleteDanglingPods reconciliation deletes
any Pod returned here that is missing from this instance's virtual Pod lister,
which is scoped to spec.nodeName == agentHostname. On a multi-node host cluster,
every restarting k3k-kubelet instance therefore saw Pods owned by other nodes as
'dangling' and deleted them from the host (and, in turn, the virtual cluster).

Scope GetPods by the *virtual* Pod's spec.nodeName -- the same ownership signal
the framework uses -- excluding Pods owned by other nodes while still returning
own-node Pods and genuinely dangling ones. The host Pod's physical node is not a
reliable owner (it is scheduled with only a soft, sometimes-absent affinity), so
it must not be used. Virtual Pods are read live to avoid a startup cache-sync
race. Makes the previous commit's tests pass.

* Refactor GetPods to scope to the cluster namespace and update tests accordingly

* Add AgentNameLabel to track Pods synced by the k3k-kubelet agent and update tests accordingly

* Add failing test for updatePod
2026-07-15 17:02:30 +02:00
Enrico CandinoandGitHub 3f25eabe38 feat: Enhance GitHub Actions workflows and add YAML linting (#1020)
- Updated action descriptions for clarity in provision-k3s-vm-workers.
- Refactored steps in provision-k3s-vm-workers for improved readability.
- Adjusted permissions formatting in multiple workflows for consistency.
- Added YAML linting step in validate workflow to ensure YAML file quality.
- Introduced .yamllint configuration file for GitHub Actions YAML files.
- Enhanced Makefile to include a target for linting YAML files.
2026-07-14 16:51:08 +02:00
Kevin McDermottandGitHub ddf6bace3f Merge pull request #1019 from bigkevmcd/fix-event-logging
Fix logged events in syncer - ensure the name/namespace are correct.
2026-07-14 13:11:30 +01:00
Enrico CandinoandGitHub 07cfe77318 Move e2e tests to a multi-node cluster, add kubelet restart test (#1010)
* Add E2E tests for multi-node setup and kubelet restart scenarios

* Update Kubernetes version options in conformance tests workflow

* Enhance VM provisioning action to support dynamic bridge CIDR prefix and pin package versions
2026-07-14 11:21:17 +02:00
be742939c6 Update rancher/renovate-config digest to c1117a0 (#1006)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-13 17:39:25 +02:00
13532286cc Update module go.etcd.io/etcd/api/v3 to v3.6.13 (#1004)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-13 17:38:34 +02:00
bcraftandGitHub 120d964281 set machine id on server pod if not exists (#1011) 2026-07-10 12:58:37 +02:00
bcraftandGitHub b6867919c8 update docs for kata-deploy (#960) 2026-07-10 12:13:22 +02:00
808bba15c6 Update go module directive to v1.26.5 (#1003)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-09 11:28:40 +02:00
1cbed90674 Update github/codeql-action digest to 99df26d (#999)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-09 10:36:39 +02:00
Enrico CandinoandGitHub 3d0438edc9 Update k8s dependencies to v1.36 (main) (#979)
* Update k3s version in test suites to v1.36.2-k3s1

- Updated the k3sVersion and k3sOldVersion constants in both cli and e2e test suites to reflect the new version v1.36.2-k3s1 and the previous version v1.36.0-k3s1.

* updated README.md
2026-07-08 15:58:06 +02:00
9c82b68440 Update GitHub Actions (#994)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-08 11:33:02 +02:00
2e1781f022 Update golangci/golangci-lint-action action to v9.3.0 (#990)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-07 22:53:51 +02:00
39cc69f3e3 Added HCP (Hosted Control Plane) mode (#876)
* Add HCP (Hosted Control Plane) support

Introduce hosted control plane mode for k3k virtual clusters, including
API types, controller logic, server endpoint handling, CLI flags,
CRD updates, kubeconfig generation, and examples.

Co-Authored-By: RuFlo <ruv@ruv.net>

* removed hcpRegitration command

added HCP conformance tests

warning for hcp

fix multi-VM HCP conformance test networking

  Both QEMU workers booted with `-net user` and ended up registering the
  same InternalIP (10.0.2.15) because each VM gets its own isolated NAT
  slirp. Flannel propagated this to `public-ip` on both nodes, so VXLAN
  could not tunnel between workers and any cross-node pod traffic broke
  (89 failed / 335 passed of 424 conformance specs).

  Replace user-mode networking with a Linux bridge (k3kbr0,
  192.168.100.0/24) and one TAP device per VM, so the two workers share
  an L2 segment with unique routable IPs. NAT outbound from the bridge
  keeps internet access working for image pulls.

  Also set unique hostnames via cloud-init (worker-1/worker-2) and drop
  the `--node-name` flag from INSTALL_K3S_EXEC, since k3s now picks the
  correct node name from the OS hostname on its own.

  Bump hydrophone back to `--parallel 4` to match the single-VM job
  (parallelism was reduced earlier when the failure was thought to be
  resource-related).

added HCP print command

updated crds

adding e2e tests

Refactor selectNonLoopbackSAN function to accept SANs directly and update related logic in ensureHCPRegistration

* Update agent flag validation and enhance ingress host check with a warning log

Refactor descriptions for cluster provisioning mode and role in CRDs and documentation

Refactor logging in ServerURL function to use controller-runtime logger

Rename selectNonLoopbackSAN to findNonLoopbackSAN for clarity and update references

Refactor ServerURL function and related code to remove unused parameters and improve clarity

Remove unused imports from kubeconfig.go to improve code clarity

* suggested changes

* fix comment

* fix test

---------

Co-authored-by: jpgouin <jeanphilippe.gouin@suse.com>
Co-authored-by: RuFlo <ruv@ruv.net>
2026-07-07 14:12:19 +02:00
Kevin McDermottandGitHub 33216d49ae Merge pull request #950 from bigkevmcd/expose-service-annotations
Support annotations on exposed Services
2026-07-07 10:17:12 +01:00
88122905c9 Update GitHub Actions (#986)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-06 14:09:58 +02:00
Kevin McDermott 4cd5bd85d0 Refactor the service tests. 2026-07-06 08:42:20 +01:00
Kevin McDermott f1dbf33435 Support annotations on exposed Services
This adds a new .spec.expose.annotations field which is applied to the
service when it's created.
2026-07-06 08:19:30 +01:00
d94b9d685e Update GitHub Actions (#969)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-07-03 17:49:16 +02:00
7f2cf6fe98 Add --tls-sans flag to k3kcli (#925)
* Add --tls-sans flag to k3kcli cluster create

* Refine --tls-sans flag description in k3kcli documentation

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix TLS SANs handling in cluster creation by using hostname directly

* Implement extractHost function and update TLS SAN handling in cluster creation

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-02 13:23:13 +02:00
7879a7679d Update ginkgo and gomega (main) (#956)
* Update ginkgo and gomega

* Update Ginkgo to version 2.32.0 in workflows and Makefile

---------

Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
Co-authored-by: Enrico Candino <enrico.candino@suse.com>
2026-07-02 12:34:00 +02:00
Enrico CandinoandGitHub 11953e315d Enhance command flag handling and completion for cluster and policy creation (#933)
- Refactor createFlags function to return an error for better error handling.
- Add flag completion functions for cluster mode and persistence type.
- Implement disableFileCompletion to prevent default filename completions.
- Register flag completion for mode in NewPolicyCreateCmd.
2026-07-02 10:11:22 +02:00
Enrico CandinoandGitHub 3db4cc0652 Refactor test suite to remove K3s container dependency (#971)
- Removed K3s container setup and teardown logic from CLI and E2E test suites.
- Simplified Kubernetes client initialization by eliminating the need for K3s container.
- Updated InitFromKubeconfig function to no longer require K3s container as a parameter.
- Deleted unused HelmInstaller and RESTClientGetter implementations.
- Cleaned up logging functions related to K3s and Helm operations.
2026-07-02 10:10:48 +02:00
fa16898689 fix EXTRA_ARGS parsing in the startup command (#951)
* fix EXTRA_ARGS parsing in the startup command and add multi server args test

* fix lint

* Refactor server config tests to improve readability and maintainability

---------

Co-authored-by: Enrico Candino <enrico.candino@suse.com>
2026-07-01 18:17:58 +02:00
Enrico CandinoandGitHub ed3e901229 Add K3K prefix to k3kcli env vars, align cli test, add failCount (#962)
* align test-cli

* test context

* increase timeout

* Enhance cluster readiness check with failure count limit
Add prefix K3K to env vars
2026-07-01 11:14:37 +02:00
Hussein GalalandGitHub 3abffae92d External datastore support (#879)
* Adding new k3s function to get the config
* Adding a new way to get the bootstrap data directly from the server Pod
* Gate the bootstrap fetch if external datastore is in use
---------

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2026-06-26 17:22:00 +03:00
Enrico CandinoandGitHub 244011e68d Refactor kubeconfig URL generation (#938)
* Refactor kubeconfig generation to remove unused port parameter and update related functions

* Refactor kubeconfig generation to streamline error handling and remove unused imports

* Refactor kubeconfig URL generation functions and deprecate old implementation

* restore old behavior

* Add 'k3kcli kubeconfig get' command and update documentation

* Refactor URL generation by removing deprecated getURLFromService function and updating tests to use new implementation

* Fix expected URL for LoadBalancer test case to include hostname

* Refactor kubeconfig test documentation to clarify URL generation behavior for ClusterIP, NodePort, and LoadBalancer service types

* Refactor kubeconfig URL generation functions to improve clarity and maintainability

* Remove deprecated 'k3kcli kubeconfig get' command and update related documentation

* Set logger to discard in NewRootCmd for improved logging control

* Refactor getURLFromService to streamline ingress key retrieval
2026-06-26 11:16:54 +02:00
Enrico CandinoandGitHub d008deded7 Update indirect dependencies in go.mod and go.sum to latest versions (#944) 2026-06-25 19:53:56 +02:00
d75c0346da Update ginkgo and gomega (main) (#922)
* Update ginkgo and gomega

* Update Ginkgo version to v2.31.0 in workflows and Makefile

---------

Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
Co-authored-by: Enrico Candino <enrico.candino@suse.com>
2026-06-25 19:44:06 +02:00
5dcc97736f Update actions/setup-go digest to 924ae3a (#934)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-06-25 17:47:19 +02:00
Enrico CandinoandGitHub 1e23fdb4fa Add unit tests for URL generation across service types in kubeconfig (#939)
* Add unit tests for URL generation across service types in kubeconfig

* addressed comments for SchemeBuilder and Context

* Refactor client creation and REST config loading in NewRootCmd

* Refactor scheme and schemeBuilder initialization

* use t.Helper in helper funcs
2026-06-25 14:44:19 +02:00
4526ba8962 Update rancher/renovate-config digest to fc79cf4 (#935)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-06-25 11:07:09 +02:00
22b4e1d37a Update codecov/codecov-action action to v7 (#936)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-06-25 10:56:53 +02:00
667946e898 Update actions/checkout action to v7 (#940)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-06-25 10:47:40 +02:00
f28666692c Update rancher/renovate-config digest to af4fff4 (#919)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-06-19 12:13:45 +02:00
00e50127b2 Update golangci/golangci-lint-action action to v9.2.1 (#921)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-06-19 12:12:56 +02:00
a8be7b888d Update rancher/renovate-config digest to 206454e (#911)
Co-authored-by: renovate-rancher[bot] <119870437+renovate-rancher[bot]@users.noreply.github.com>
2026-06-16 09:33:26 +02:00