Skip to content

Commit b150bdc

Browse files
author
shiftstack-merge-bot
committed
2 parents c4c0495 + b872d66 commit b150bdc

File tree

14 files changed

+247
-77
lines changed

14 files changed

+247
-77
lines changed

api/v1beta1/openstackmachine_types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ type OpenStackMachineStatus struct {
199199
Addresses []corev1.NodeAddress `json:"addresses,omitempty"`
200200

201201
// InstanceState is the state of the OpenStack instance for this machine.
202+
// This field is not set anymore by the OpenStackMachine controller.
203+
// Instead, it's set by the OpenStackServer controller.
202204
// +optional
203205
InstanceState *InstanceState `json:"instanceState,omitempty"`
204206

@@ -241,7 +243,6 @@ type OpenStackMachineStatus struct {
241243
// +kubebuilder:resource:path=openstackmachines,scope=Namespaced,categories=cluster-api,shortName=osm
242244
// +kubebuilder:subresource:status
243245
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this OpenStackMachine belongs"
244-
// +kubebuilder:printcolumn:name="InstanceState",type="string",JSONPath=".status.instanceState",description="OpenStack instance state"
245246
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Machine ready status"
246247
// +kubebuilder:printcolumn:name="ProviderID",type="string",JSONPath=".spec.providerID",description="OpenStack instance ID"
247248
// +kubebuilder:printcolumn:name="Machine",type="string",JSONPath=".metadata.ownerReferences[?(@.kind==\"Machine\")].name",description="Machine object which owns with this OpenStackMachine"

cmd/models-schema/zz_generated.openapi.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackmachines.yaml

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controllers/openstackserver_controller.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,7 @@ func getOrCreateServerPorts(openStackServer *infrav1alpha1.OpenStackServer, netw
419419
}
420420
desiredPorts := resolved.Ports
421421

422-
if len(desiredPorts) == len(resources.Ports) {
423-
return nil
424-
}
425-
426-
if err := networkingService.CreatePorts(openStackServer, desiredPorts, resources); err != nil {
422+
if err := networkingService.EnsurePorts(openStackServer, desiredPorts, resources); err != nil {
427423
return fmt.Errorf("creating ports: %w", err)
428424
}
429425

controllers/openstackserver_controller_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ var listDefaultPorts = func(r *recorders) {
114114
}, nil)
115115
}
116116

117+
var listDefaultPortsWithID = func(r *recorders) {
118+
r.network.ListPort(ports.ListOpts{
119+
Name: openStackServerName + "-0",
120+
ID: portUUID,
121+
NetworkID: networkUUID,
122+
}).Return([]ports.Port{
123+
{
124+
ID: portUUID,
125+
},
126+
}, nil)
127+
}
128+
117129
var listDefaultPortsNotFound = func(r *recorders) {
118130
r.network.ListPort(ports.ListOpts{
119131
Name: openStackServerName + "-0",
@@ -479,6 +491,7 @@ func Test_OpenStackServerReconcileCreate(t *testing.T) {
479491
listDefaultPortsNotFound(r)
480492
createDefaultPort(r)
481493
listDefaultServerNotFound(r)
494+
listDefaultPortsNotFound(r)
482495
createDefaultServer(r)
483496
},
484497
},
@@ -500,6 +513,7 @@ func Test_OpenStackServerReconcileCreate(t *testing.T) {
500513
},
501514
expect: func(r *recorders) {
502515
listDefaultPorts(r)
516+
listDefaultPortsWithID(r)
503517
listDefaultServerFound(r)
504518
},
505519
},

docs/book/src/api/v1beta1/api.md

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module sigs.k8s.io/cluster-api-provider-openstack
22

3-
go 1.23.4
3+
go 1.23.0
44

55
require (
66
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
@@ -15,7 +15,7 @@ require (
1515
github.com/onsi/ginkgo/v2 v2.22.2
1616
github.com/onsi/gomega v1.36.2
1717
github.com/prometheus/client_golang v1.20.5
18-
github.com/spf13/pflag v1.0.5
18+
github.com/spf13/pflag v1.0.6
1919
go.uber.org/mock v0.5.0
2020
golang.org/x/crypto v0.32.0
2121
golang.org/x/text v0.21.0
@@ -31,7 +31,7 @@ require (
3131
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
3232
sigs.k8s.io/cluster-api v1.9.4
3333
sigs.k8s.io/cluster-api/test v1.9.4
34-
sigs.k8s.io/controller-runtime v0.19.4
34+
sigs.k8s.io/controller-runtime v0.19.5
3535
sigs.k8s.io/structured-merge-diff/v4 v4.4.1
3636
sigs.k8s.io/yaml v1.4.0
3737
)

go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,9 @@ github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w=
252252
github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
253253
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
254254
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
255-
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
256255
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
256+
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
257+
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
257258
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
258259
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
259260
github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs=
@@ -443,8 +444,8 @@ sigs.k8s.io/cluster-api v1.9.4 h1:pa2Ho50F9Js/Vv/Jy11TcpmGiqY2ukXCoDj/dY25Y7M=
443444
sigs.k8s.io/cluster-api v1.9.4/go.mod h1:9DjpPCxJJo7/mH+KceINNJHr9c5X9S9HEp2B8JG3Uv8=
444445
sigs.k8s.io/cluster-api/test v1.9.4 h1:ZZ+IPK/lfyc4d/QPtompt+cxXYC6tGJ4kTHhhocgbIM=
445446
sigs.k8s.io/cluster-api/test v1.9.4/go.mod h1:dHLUcNc9vBNyQyY6NTcqcfpFvIiXmcL5Iqe2sETFD1c=
446-
sigs.k8s.io/controller-runtime v0.19.4 h1:SUmheabttt0nx8uJtoII4oIP27BVVvAKFvdvGFwV/Qo=
447-
sigs.k8s.io/controller-runtime v0.19.4/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4=
447+
sigs.k8s.io/controller-runtime v0.19.5 h1:rsE2cRYe0hK/rAAwiS1bwqgEcgCxTz9lavs3FMgLW0c=
448+
sigs.k8s.io/controller-runtime v0.19.5/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4=
448449
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
449450
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
450451
sigs.k8s.io/kind v0.25.0 h1:ugUvgesHKKA0yKmD6QtYTiEev+kPUpGxdTPbMGf8VTU=

hack/tools/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module sigs.k8s.io/cluster-api-provider-openstack/hack/tools
22

3-
go 1.23.4
3+
go 1.23.0
44

55
require (
66
github.com/a8m/envsubst v1.4.2
@@ -84,7 +84,7 @@ require (
8484
github.com/sergi/go-diff v1.2.0 // indirect
8585
github.com/spf13/afero v1.11.0 // indirect
8686
github.com/spf13/cobra v1.8.1 // indirect
87-
github.com/spf13/pflag v1.0.5 // indirect
87+
github.com/spf13/pflag v1.0.6 // indirect
8888
github.com/stoewer/go-strcase v1.3.0 // indirect
8989
github.com/x448/float16 v0.8.4 // indirect
9090
github.com/xlab/treeprint v1.2.0 // indirect
@@ -133,7 +133,7 @@ require (
133133
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
134134
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect
135135
sigs.k8s.io/cluster-api v1.9.4 // indirect
136-
sigs.k8s.io/controller-runtime v0.19.4 // indirect
136+
sigs.k8s.io/controller-runtime v0.19.5 // indirect
137137
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
138138
sigs.k8s.io/kubebuilder/docs/book/utils v0.0.0-20211028165026-57688c578b5d // indirect
139139
sigs.k8s.io/kustomize/api v0.19.0 // indirect

hack/tools/go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,9 @@ github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w=
272272
github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
273273
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
274274
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
275-
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
276275
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
276+
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
277+
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
277278
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
278279
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
279280
github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs=
@@ -470,8 +471,8 @@ sigs.k8s.io/cluster-api/hack/tools v0.0.0-20221129083400-679ae3e9e6b6 h1:YF+g/Mr
470471
sigs.k8s.io/cluster-api/hack/tools v0.0.0-20221129083400-679ae3e9e6b6/go.mod h1:7luenhlsUTb9obnAferuDFEvhtITw7JjHpXkiDmCmKY=
471472
sigs.k8s.io/cluster-api/test v1.9.4 h1:ZZ+IPK/lfyc4d/QPtompt+cxXYC6tGJ4kTHhhocgbIM=
472473
sigs.k8s.io/cluster-api/test v1.9.4/go.mod h1:dHLUcNc9vBNyQyY6NTcqcfpFvIiXmcL5Iqe2sETFD1c=
473-
sigs.k8s.io/controller-runtime v0.19.4 h1:SUmheabttt0nx8uJtoII4oIP27BVVvAKFvdvGFwV/Qo=
474-
sigs.k8s.io/controller-runtime v0.19.4/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4=
474+
sigs.k8s.io/controller-runtime v0.19.5 h1:rsE2cRYe0hK/rAAwiS1bwqgEcgCxTz9lavs3FMgLW0c=
475+
sigs.k8s.io/controller-runtime v0.19.5/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4=
475476
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20230926180527-c93e2abcb28e h1:xYNzzoK+cwgBnaRqrYFLQCSwMAYcR6a06gf3FJ369Kw=
476477
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20230926180527-c93e2abcb28e/go.mod h1:B6HLcvOy2S1qq2eWOFm9xepiKPMIc8Z9OXSPsnUDaR4=
477478
sigs.k8s.io/controller-tools v0.16.5 h1:5k9FNRqziBPwqr17AMEPPV/En39ZBplLAdOwwQHruP4=

0 commit comments

Comments
 (0)