Skip to content

Commit ea1636d

Browse files
Merge pull request #1285 from jcpowermac/hostvmgroupzones
SPLAT-1800: Add support for vSphere host and vm group based zonal
2 parents d27262c + 9b838c3 commit ea1636d

File tree

784 files changed

+9694
-12004
lines changed

Some content is hidden

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

784 files changed

+9694
-12004
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea
2+
.run
23
# Binaries for programs and plugins
34
*.exe
45
*.exe~

cmd/machine-api-operator/start.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ import (
99
"os"
1010
"strconv"
1111

12-
osconfigv1 "github.com/openshift/api/config/v1"
13-
"github.com/openshift/library-go/pkg/operator/events"
14-
"github.com/openshift/machine-api-operator/pkg/metrics"
15-
"github.com/openshift/machine-api-operator/pkg/operator"
16-
"github.com/openshift/machine-api-operator/pkg/util"
17-
"github.com/openshift/machine-api-operator/pkg/version"
1812
"github.com/prometheus/client_golang/prometheus"
1913
"github.com/prometheus/client_golang/prometheus/promhttp"
2014
"github.com/spf13/cobra"
@@ -27,6 +21,14 @@ import (
2721
"k8s.io/client-go/tools/leaderelection"
2822
"k8s.io/client-go/tools/record"
2923
"k8s.io/klog/v2"
24+
"k8s.io/utils/clock"
25+
26+
osconfigv1 "github.com/openshift/api/config/v1"
27+
"github.com/openshift/library-go/pkg/operator/events"
28+
"github.com/openshift/machine-api-operator/pkg/metrics"
29+
"github.com/openshift/machine-api-operator/pkg/operator"
30+
"github.com/openshift/machine-api-operator/pkg/util"
31+
"github.com/openshift/machine-api-operator/pkg/version"
3032
)
3133

3234
const (
@@ -137,7 +139,7 @@ func initRecorder(kubeClient kubernetes.Interface) (events.Recorder, error) {
137139
if err != nil {
138140
return nil, fmt.Errorf("failed to create controller ref for recorder: %v", err)
139141
}
140-
recorder := events.NewKubeRecorder(kubeClient.CoreV1().Events(componentNamespace), "machineapioperator", controllerRef)
142+
recorder := events.NewKubeRecorder(kubeClient.CoreV1().Events(componentNamespace), "machineapioperator", controllerRef, clock.RealClock{})
141143
return recorder, nil
142144
}
143145

cmd/machineset/main.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,14 @@ import (
2323
"strings"
2424
"time"
2525

26+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
27+
ctrl "sigs.k8s.io/controller-runtime"
28+
2629
osconfigv1 "github.com/openshift/api/config/v1"
2730
apifeatures "github.com/openshift/api/features"
2831
machinev1 "github.com/openshift/api/machine/v1beta1"
2932
mapiwebhooks "github.com/openshift/machine-api-operator/pkg/webhooks"
30-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
31-
ctrl "sigs.k8s.io/controller-runtime"
3233

33-
"github.com/openshift/library-go/pkg/config/leaderelection"
34-
"github.com/openshift/library-go/pkg/features"
35-
"github.com/openshift/machine-api-operator/pkg/controller"
36-
"github.com/openshift/machine-api-operator/pkg/controller/machineset"
37-
"github.com/openshift/machine-api-operator/pkg/metrics"
38-
"github.com/openshift/machine-api-operator/pkg/operator"
39-
"github.com/openshift/machine-api-operator/pkg/util"
4034
"k8s.io/apiserver/pkg/util/feature"
4135
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
4236
"k8s.io/component-base/featuregate"
@@ -48,6 +42,14 @@ import (
4842
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
4943
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
5044
"sigs.k8s.io/controller-runtime/pkg/webhook"
45+
46+
"github.com/openshift/library-go/pkg/config/leaderelection"
47+
"github.com/openshift/library-go/pkg/features"
48+
"github.com/openshift/machine-api-operator/pkg/controller"
49+
"github.com/openshift/machine-api-operator/pkg/controller/machineset"
50+
"github.com/openshift/machine-api-operator/pkg/metrics"
51+
"github.com/openshift/machine-api-operator/pkg/operator"
52+
"github.com/openshift/machine-api-operator/pkg/util"
5153
)
5254

5355
const (
@@ -110,7 +112,7 @@ func main() {
110112

111113
// Sets up feature gates
112114
defaultMutableGate := feature.DefaultMutableFeatureGate
113-
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, apifeatures.SelfManaged, apifeatures.FeatureGateVSphereStaticIPs, apifeatures.FeatureGateMachineAPIMigration)
115+
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, apifeatures.SelfManaged, apifeatures.FeatureGateVSphereStaticIPs, apifeatures.FeatureGateMachineAPIMigration, apifeatures.FeatureGateVSphereHostVMGroupZonal)
114116
if err != nil {
115117
klog.Fatalf("Error setting up feature gates: %v", err)
116118
}

cmd/vsphere/main.go

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@ import (
77
"strings"
88
"time"
99

10-
configv1 "github.com/openshift/api/config/v1"
11-
apifeatures "github.com/openshift/api/features"
12-
machinev1 "github.com/openshift/api/machine/v1beta1"
13-
"github.com/openshift/library-go/pkg/config/leaderelection"
14-
"github.com/openshift/library-go/pkg/features"
15-
capimachine "github.com/openshift/machine-api-operator/pkg/controller/machine"
16-
"github.com/openshift/machine-api-operator/pkg/controller/vsphere"
17-
machine "github.com/openshift/machine-api-operator/pkg/controller/vsphere"
18-
machinesetcontroller "github.com/openshift/machine-api-operator/pkg/controller/vsphere/machineset"
19-
"github.com/openshift/machine-api-operator/pkg/metrics"
20-
"github.com/openshift/machine-api-operator/pkg/util"
21-
"github.com/openshift/machine-api-operator/pkg/version"
2210
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2311
"k8s.io/apiserver/pkg/util/feature"
2412
"k8s.io/component-base/featuregate"
@@ -31,6 +19,19 @@ import (
3119
"sigs.k8s.io/controller-runtime/pkg/healthz"
3220
"sigs.k8s.io/controller-runtime/pkg/manager"
3321
"sigs.k8s.io/controller-runtime/pkg/metrics/server"
22+
23+
configv1 "github.com/openshift/api/config/v1"
24+
apifeatures "github.com/openshift/api/features"
25+
machinev1 "github.com/openshift/api/machine/v1beta1"
26+
"github.com/openshift/library-go/pkg/config/leaderelection"
27+
"github.com/openshift/library-go/pkg/features"
28+
capimachine "github.com/openshift/machine-api-operator/pkg/controller/machine"
29+
"github.com/openshift/machine-api-operator/pkg/controller/vsphere"
30+
machine "github.com/openshift/machine-api-operator/pkg/controller/vsphere"
31+
machinesetcontroller "github.com/openshift/machine-api-operator/pkg/controller/vsphere/machineset"
32+
"github.com/openshift/machine-api-operator/pkg/metrics"
33+
"github.com/openshift/machine-api-operator/pkg/util"
34+
"github.com/openshift/machine-api-operator/pkg/version"
3435
)
3536

3637
const timeout = 10 * time.Minute
@@ -92,7 +93,7 @@ func main() {
9293

9394
// Sets up feature gates
9495
defaultMutableGate := feature.DefaultMutableFeatureGate
95-
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, apifeatures.SelfManaged, apifeatures.FeatureGateVSphereStaticIPs, apifeatures.FeatureGateMachineAPIMigration)
96+
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, apifeatures.SelfManaged, apifeatures.FeatureGateVSphereStaticIPs, apifeatures.FeatureGateMachineAPIMigration, apifeatures.FeatureGateVSphereHostVMGroupZonal)
9697
if err != nil {
9798
klog.Fatalf("Error setting up feature gates: %v", err)
9899
}
@@ -152,6 +153,8 @@ func main() {
152153

153154
staticIPFeatureGateEnabled := defaultMutableGate.Enabled(featuregate.Feature(apifeatures.FeatureGateVSphereStaticIPs))
154155
klog.Infof("FeatureGateVSphereStaticIPs initialised: %t", staticIPFeatureGateEnabled)
156+
hostVMGroupZonalFeatureGateEnabled := defaultMutableGate.Enabled(featuregate.Feature(apifeatures.FeatureGateVSphereHostVMGroupZonal))
157+
klog.Infof("FeatureGateVSphereHostVMGroupZonal initialised %t", hostVMGroupZonalFeatureGateEnabled)
155158

156159
// Setup a Manager
157160
mgr, err := manager.New(cfg, opts)

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ require (
1111
github.com/google/uuid v1.6.0
1212
github.com/onsi/ginkgo/v2 v2.20.2
1313
github.com/onsi/gomega v1.34.2
14-
github.com/openshift/api v0.0.0-20241118215836-09b63162bb15
15-
github.com/openshift/client-go v0.0.0-20240918182115-6a8ead8397fd
14+
github.com/openshift/api v0.0.0-20241210144725-fa836ae33dad
15+
github.com/openshift/client-go v0.0.0-20241203091221-452dfb8fa071
1616
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20241007145816-7038c320d36c
1717
github.com/openshift/cluster-control-plane-machine-set-operator v0.0.0-20240909043600-373ac49835bf
18-
github.com/openshift/library-go v0.0.0-20240919205913-c96b82b3762b
18+
github.com/openshift/library-go v0.0.0-20241210151741-8d0b2ce3fb30
1919
github.com/prometheus/client_golang v1.20.5
2020
github.com/spf13/cobra v1.8.1
2121
github.com/spf13/pflag v1.0.5
@@ -32,7 +32,7 @@ require (
3232
k8s.io/component-base v0.31.1
3333
k8s.io/klog/v2 v2.130.1
3434
k8s.io/kubectl v0.31.1
35-
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8
35+
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6
3636
sigs.k8s.io/cluster-api v1.6.1
3737
sigs.k8s.io/controller-runtime v0.19.0
3838
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20240923090159-236e448db12c
@@ -266,9 +266,9 @@ require (
266266
gopkg.in/yaml.v2 v2.4.0 // indirect
267267
gopkg.in/yaml.v3 v3.0.1 // indirect
268268
honnef.co/go/tools v0.5.1 // indirect
269-
k8s.io/apiextensions-apiserver v0.31.0 // indirect
269+
k8s.io/apiextensions-apiserver v0.31.1 // indirect
270270
k8s.io/cli-runtime v0.31.1 // indirect
271-
k8s.io/kube-aggregator v0.30.1 // indirect
271+
k8s.io/kube-aggregator v0.31.1 // indirect
272272
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
273273
mvdan.cc/gofumpt v0.7.0 // indirect
274274
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect

go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,16 @@ github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4
371371
github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag=
372372
github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8=
373373
github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc=
374-
github.com/openshift/api v0.0.0-20241118215836-09b63162bb15 h1:5bt8CBbXv1iSmBNCBXugsIT04NgHFCSkM1mOyuE8s2Q=
375-
github.com/openshift/api v0.0.0-20241118215836-09b63162bb15/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
376-
github.com/openshift/client-go v0.0.0-20240918182115-6a8ead8397fd h1:Gd0+bYdcfGIsDOJ8BwTJJjQeXoziyIsTwqp/s38rKyM=
377-
github.com/openshift/client-go v0.0.0-20240918182115-6a8ead8397fd/go.mod h1:EB7GeA/vpf9AHklMgnnT0+uG6l/3f8cChtCFbJFrk4g=
374+
github.com/openshift/api v0.0.0-20241210144725-fa836ae33dad h1:AehKFLGZosHv1+stPXervUQQkd6/D/TdTprv1CgMpmU=
375+
github.com/openshift/api v0.0.0-20241210144725-fa836ae33dad/go.mod h1:Shkl4HanLwDiiBzakv+con/aMGnVE2MAGvoKp5oyYUo=
376+
github.com/openshift/client-go v0.0.0-20241203091221-452dfb8fa071 h1:l0++HnGVKBcs8kXFL/1yeozxioxPGNpp0PYe3Y+0sq4=
377+
github.com/openshift/client-go v0.0.0-20241203091221-452dfb8fa071/go.mod h1:gL0laCCiIaNTNw1ZsMQZXBVu2NeQFpNWm9bLtYO9+ZU=
378378
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20241007145816-7038c320d36c h1:9A/0QoTZo2xh5j6nmh5CGNVBG8Ql1RmXmCcrikBnG+w=
379379
github.com/openshift/cluster-api-actuator-pkg/testutils v0.0.0-20241007145816-7038c320d36c/go.mod h1:EN1Sv7kcVtaLUiXpZ8V0iSiJxNPPz1H3ZhCmNRpJWZM=
380380
github.com/openshift/cluster-control-plane-machine-set-operator v0.0.0-20240909043600-373ac49835bf h1:mfMmaD9+vZIZQq3MGXsS/AGHXekj4wIn3zc1Cs1EY8M=
381381
github.com/openshift/cluster-control-plane-machine-set-operator v0.0.0-20240909043600-373ac49835bf/go.mod h1:2fZsjZ3QSPkoMUc8QntXfeBb8AnvW+WIYwwQX8vmgvQ=
382-
github.com/openshift/library-go v0.0.0-20240919205913-c96b82b3762b h1:y2DduJug7UZqTu0QTkRPAu73nskuUbFA66fmgxVf/fI=
383-
github.com/openshift/library-go v0.0.0-20240919205913-c96b82b3762b/go.mod h1:f8QcnrooSwGa96xI4UaKbKGJZskhTCGeimXKyc4t/ZU=
382+
github.com/openshift/library-go v0.0.0-20241210151741-8d0b2ce3fb30 h1:GgQjncgAS++/7mTB6p5vCQGof46gdeY74WXn21Rz7CE=
383+
github.com/openshift/library-go v0.0.0-20241210151741-8d0b2ce3fb30/go.mod h1:eGSI6tp7yUVr4V2d0WrVt2l5s3iCwAh8Hi0RC9Fo16U=
384384
github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw=
385385
github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU=
386386
github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w=
@@ -745,8 +745,8 @@ honnef.co/go/tools v0.5.1 h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I=
745745
honnef.co/go/tools v0.5.1/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs=
746746
k8s.io/api v0.31.1 h1:Xe1hX/fPW3PXYYv8BlozYqw63ytA92snr96zMW9gWTU=
747747
k8s.io/api v0.31.1/go.mod h1:sbN1g6eY6XVLeqNsZGLnI5FwVseTrZX7Fv3O26rhAaI=
748-
k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk=
749-
k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk=
748+
k8s.io/apiextensions-apiserver v0.31.1 h1:L+hwULvXx+nvTYX/MKM3kKMZyei+UiSXQWciX/N6E40=
749+
k8s.io/apiextensions-apiserver v0.31.1/go.mod h1:tWMPR3sgW+jsl2xm9v7lAyRF1rYEK71i9G5dRtkknoQ=
750750
k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U=
751751
k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo=
752752
k8s.io/apiserver v0.31.1 h1:Sars5ejQDCRBY5f7R3QFHdqN3s61nhkpaX8/k1iEw1c=
@@ -761,14 +761,14 @@ k8s.io/component-base v0.31.1 h1:UpOepcrX3rQ3ab5NB6g5iP0tvsgJWzxTyAo20sgYSy8=
761761
k8s.io/component-base v0.31.1/go.mod h1:WGeaw7t/kTsqpVTaCoVEtillbqAhF2/JgvO0LDOMa0w=
762762
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
763763
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
764-
k8s.io/kube-aggregator v0.30.1 h1:ymR2BsxDacTKwzKTuNhGZttuk009c+oZbSeD+IPX5q4=
765-
k8s.io/kube-aggregator v0.30.1/go.mod h1:SFbqWsM6ea8dHd3mPLsZFzJHbjBOS5ykIgJh4znZ5iQ=
764+
k8s.io/kube-aggregator v0.31.1 h1:vrYBTTs3xMrpiEsmBjsLETZE9uuX67oQ8B3i1BFfMPw=
765+
k8s.io/kube-aggregator v0.31.1/go.mod h1:+aW4NX50uneozN+BtoCxI4g7ND922p8Wy3tWKFDiWVk=
766766
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag=
767767
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
768768
k8s.io/kubectl v0.31.1 h1:ih4JQJHxsEggFqDJEHSOdJ69ZxZftgeZvYo7M/cpp24=
769769
k8s.io/kubectl v0.31.1/go.mod h1:aNuQoR43W6MLAtXQ/Bu4GDmoHlbhHKuyD49lmTC8eJM=
770-
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
771-
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
770+
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY9mD9fNT47QO6HI=
771+
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
772772
mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=
773773
mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo=
774774
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U=

0 commit comments

Comments
 (0)