Skip to content

Commit b52392a

Browse files
committed
Use build-time version
Signed-off-by: Nolan Brubaker <nolan@nbrubaker.com>
1 parent a2ef19c commit b52392a

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

cmd/machineset/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
osconfigv1 "github.com/openshift/api/config/v1"
3030
apifeatures "github.com/openshift/api/features"
3131
machinev1 "github.com/openshift/api/machine/v1beta1"
32+
"github.com/openshift/machine-api-operator/pkg/version"
3233
mapiwebhooks "github.com/openshift/machine-api-operator/pkg/webhooks"
3334

3435
"k8s.io/apiserver/pkg/util/feature"
@@ -110,9 +111,15 @@ func main() {
110111
fmt.Sprintf("The duration that non-leader candidates will wait after observing a leadership renewal until attempting to acquire leadership of a led but unrenewed leader slot. This is effectively the maximum duration that a leader can be stopped before it is replaced by another candidate. This is only applicable if leader election is enabled. Default: (%s)", defaultLeaderElectionValues.LeaseDuration.Duration),
111112
)
112113

114+
majorVersion := version.Version.Major
115+
116+
if majorVersion == 0 {
117+
majorVersion = 4
118+
}
119+
113120
// Sets up feature gates
114121
defaultMutableGate := feature.DefaultMutableFeatureGate
115-
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, 4, apifeatures.SelfManaged, apifeatures.FeatureGateMachineAPIMigration, apifeatures.FeatureGateVSphereHostVMGroupZonal, apifeatures.FeatureGateVSphereMultiDisk)
122+
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, majorVersion, apifeatures.SelfManaged, apifeatures.FeatureGateMachineAPIMigration, apifeatures.FeatureGateVSphereHostVMGroupZonal, apifeatures.FeatureGateVSphereMultiDisk)
116123
if err != nil {
117124
klog.Fatalf("Error setting up feature gates: %v", err)
118125
}

cmd/vsphere/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,15 @@ func main() {
9191
"The address for health checking.",
9292
)
9393

94+
majorVersion := version.Version.Major
95+
96+
if majorVersion == 0 {
97+
majorVersion = 4
98+
}
99+
94100
// Sets up feature gates
95101
defaultMutableGate := feature.DefaultMutableFeatureGate
96-
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, 4, apifeatures.SelfManaged, apifeatures.FeatureGateMachineAPIMigration, apifeatures.FeatureGateVSphereHostVMGroupZonal, apifeatures.FeatureGateVSphereMultiDisk)
102+
gateOpts, err := features.NewFeatureGateOptions(defaultMutableGate, majorVersion, apifeatures.SelfManaged, apifeatures.FeatureGateMachineAPIMigration, apifeatures.FeatureGateVSphereHostVMGroupZonal, apifeatures.FeatureGateVSphereMultiDisk)
97103
if err != nil {
98104
klog.Fatalf("Error setting up feature gates: %v", err)
99105
}

pkg/util/testing/testing.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"time"
66

77
machinev1 "github.com/openshift/api/machine/v1beta1"
8+
"github.com/openshift/machine-api-operator/pkg/version"
89

910
corev1 "k8s.io/api/core/v1"
1011
apierrs "k8s.io/apimachinery/pkg/api/errors"
@@ -168,7 +169,7 @@ func NewMachineHealthCheck(name string) *machinev1.MachineHealthCheck {
168169

169170
func NewDefaultMutableFeatureGate() (featuregate.MutableFeatureGate, error) {
170171
defaultMutableGate := feature.DefaultMutableFeatureGate
171-
_, err := features.NewFeatureGateOptions(defaultMutableGate, 4,
172+
_, err := features.NewFeatureGateOptions(defaultMutableGate, version.Version.Major,
172173
openshiftfeatures.SelfManaged,
173174
openshiftfeatures.FeatureGateMachineAPIMigration,
174175
openshiftfeatures.FeatureGateVSphereHostVMGroupZonal,

0 commit comments

Comments
 (0)