Repository navigation
feat(api): make network.id optional and implement network creation - #34
Open
fabian-schmitt wants to merge 18 commits into
Open
fabian-schmitt wants to merge 18 commits into
fabian-schmitt wants to merge 18 commits into
Conversation
fabian-schmitt
marked this pull request as ready for review
October 22, 2026 10:58
tuunit
requested changes
Oct 23, 2026
Co-authored-by: Jan Larwig <jan.larwig@digits.schwarz>
Co-authored-by: Jan Larwig <jan.larwig@digits.schwarz>
3 tasks
3 tasks
3 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements support for managed network creation in
StackitCluster, resolving #9.Previously,
StackitClusterandStackitMachinerequired a pre-existing STACKIT network ID (.spec.network.id). This PR makes.spec.network.idoptional, introducing two operational modes:Managed Mode (omitted
spec.network.id):/24STACKIT network named<cluster-name>-network.cluster.x-k8s.io/cluster-name,managed-by, etc.).{ id: "<uuid>", managed: true }instatus.network.NetworkInUsecondition and warning event. If status was lost during deletion, falls back to tag-based discovery.Bring-Your-Own (BYO) Mode (provided
spec.network.id):{ id: "<uuid>", managed: false }instatus.network.Key Changes
API & CRDs (
api/v1alpha1/,config/crd/):.spec.networkand.spec.network.idoptional inStackitCluster,StackitMachine, and their templates.Status.Network(StackitNetworkStatus{ id, managed }) toStackitClusterStatus.kubectlprintcolumn forNetwork IDto read from.status.network.id(works for both BYO and managed clusters).Webhook Validation (
webhook/v1alpha1/):.spec.network.idor switching between managed and BYO after creation.Cloud Client & Abstraction (
cloud/):CreateNetworkInput{ Name, IPv4Prefix, Tags }.CreateNetwork,DeleteNetwork,FindNetworkByTags, andListNetworksByTagstocloud.Client,SDKClient, andcloudfake.Client.CreateNetworkto avoid duplicate networks across reconcile retries.cloud.CleanupByTagsto clean up managed networks in E2E environments.Scope & Service Layer (
scope/,cloud/services/):cloud/services/network/network.gofor network input assembly and tag generation.MachineScope.NetworkID()andClusterScope.NetworkID()for encapsulated fallback resolution (Machine Spec -> Cluster Spec -> Cluster Status).*scope.ClusterScopeand resolve the network ID viaclusterScope.NetworkID().Reconciliation & Teardown (
controller/):ensureNetwork,ensureManagedNetwork, andgetUnmanagedNetwork.reconcileNormalto ensure network readiness and setClusterNetworkReadyCondition.reconcileDeleteto delete managed networks, handling 409 Conflict requeues gracefully.Tests & Documentation (
*_test.go,docs/):docs/src/getting-started/cloud-resources.mdwith guidelines on managed network usage and STACKIT CCM configuration.Testing
make testmake lint-fix
ToDo or FollowUp:
Cluster-template changes: Should we now default to empty network?
Answer: Kept as BYO for now.
Follow-up issue opened: Cluster templates work out-of-the-box with managed networks (without provided network_id) #37
LoadBalancer NetworkID:
@ templates/cluster-template.yaml#L288-294
How to handle the STACKIT_NETWORK_ID in the cloud.yaml in the generated secret?
Should a controller patch or generate the value after the network is generated?
Answer: Addressed via follow-up issue #37