Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Test changing subnet CIDRs #5326

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion azure/services/subnets/subnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"sigs.k8s.io/cluster-api-provider-azure/azure/converters"
"sigs.k8s.io/cluster-api-provider-azure/azure/services/aso"
"sigs.k8s.io/cluster-api-provider-azure/util/slice"
"sigs.k8s.io/cluster-api-provider-azure/util/tele"
)

const serviceName = "subnets"
Expand All @@ -50,14 +51,20 @@
return svc
}

func postCreateOrUpdateResourceHook(_ context.Context, scope SubnetScope, subnet *asonetworkv1.VirtualNetworksSubnet, err error) error {
func postCreateOrUpdateResourceHook(ctx context.Context, scope SubnetScope, subnet *asonetworkv1.VirtualNetworksSubnet, err error) error {
ctx, log, done := tele.StartSpanWithLogger(ctx, "subnets.Service.postCreateOrUpdateResourceHook")

Check failure on line 55 in azure/services/subnets/subnets.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to ctx (ineffassign)
defer done()

if err != nil {
return err
}

name := subnet.AzureName()
log.Info("Got subnet", "name", name, "subnet", subnet)
scope.UpdateSubnetID(name, ptr.Deref(subnet.Status.Id, ""))
log.Info("Subnet ID is updated", "name", name, "id", ptr.Deref(subnet.Status.Id, ""))
scope.UpdateSubnetCIDRs(name, converters.GetSubnetAddresses(*subnet))
log.Info("Subnet CIDRs are updated", "name", name, "cidrs", converters.GetSubnetAddresses(*subnet))

return nil
}
Expand Down
10 changes: 8 additions & 2 deletions templates/cluster-template-aad.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template-azure-bastion.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template-azure-cni-v1.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions templates/cluster-template-edgezone.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template-ephemeral.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template-flatcar-sysext.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template-flatcar.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template-machinepool-windows.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template-machinepool.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template-nvidia-gpu.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template-private.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template-windows.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/cluster-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ spec:
dnsName: ${CLUSTER_NAME}-${APISERVER_LB_DNS_SUFFIX}.${AZURE_LOCATION}.cloudapp.azure.com
name: ${CLUSTER_NAME}-api-lb
subnets:
- name: control-plane-subnet
- cidrBlocks:
- 10.0.0.0/20
name: control-plane-subnet
role: control-plane
- name: node-subnet
- cidrBlocks:
- 10.0.16.0/20
name: node-subnet
role: node
vnet:
cidrBlocks:
- 10.0.0.0/16
name: ${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet}
resourceGroup: ${AZURE_RESOURCE_GROUP:=${CLUSTER_NAME}}
subscriptionID: ${AZURE_SUBSCRIPTION_ID}
Expand Down
6 changes: 6 additions & 0 deletions templates/flavors/base/cluster-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ spec:
networkSpec:
vnet:
name: "${AZURE_VNET_NAME:=${CLUSTER_NAME}-vnet}"
cidrBlocks:
- 10.0.0.0/16
subnets:
- name: control-plane-subnet
role: control-plane
cidrBlocks:
- 10.0.0.0/20
- name: node-subnet
role: node
cidrBlocks:
- 10.0.16.0/20
---
kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
Expand Down
10 changes: 8 additions & 2 deletions templates/test/ci/cluster-template-prow-azure-cni-v1.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/test/ci/cluster-template-prow-ci-version-dra.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/test/ci/cluster-template-prow-ci-version.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions templates/test/ci/cluster-template-prow-custom-vnet.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions templates/test/ci/cluster-template-prow-edgezone.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions templates/test/ci/cluster-template-prow-flatcar-sysext.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading