diff --git a/controllers/windowsmachine_controller.go b/controllers/windowsmachine_controller.go index 92e1bcaa47..1d7ac56561 100644 --- a/controllers/windowsmachine_controller.go +++ b/controllers/windowsmachine_controller.go @@ -6,6 +6,7 @@ import ( "fmt" "net" "strings" + "time" oconfig "github.com/openshift/api/config/v1" mapi "github.com/openshift/api/machine/v1beta1" @@ -54,13 +55,20 @@ const ( WindowsMachineController = "windowsmachine" // IgnoreLabel is a label that will cause machines to be ignored by the Windows Machine controller IgnoreLabel = "windowsmachineconfig.openshift.io/ignore" + // machineDeletionRestrictedRequeueInterval is the amount of time to wait before re-checking whether a Machine + // whose deletion was restricted by maxUnhealthyCount is now allowed to be deleted. Using a backoff here (instead + // of an immediate requeue) avoids a tight reconcile loop and event/log spam while a sibling Machine's + // remediation is still in progress. + machineDeletionRestrictedRequeueInterval = 30 * time.Second ) // WindowsMachineReconciler is used to create a controller which manages Windows Machine objects type WindowsMachineReconciler struct { instanceReconciler // machineClient holds the information for machine client - machineClient *mclient.MachineV1beta1Client + // This is typed as the interface (rather than the concrete *mclient.MachineV1beta1Client) so that it can be + // substituted with a fake implementation in unit tests. + machineClient mclient.MachineV1beta1Interface } // NewWindowsMachineReconciler returns a pointer to a WindowsMachineReconciler @@ -281,18 +289,7 @@ func (r *WindowsMachineReconciler) Reconcile(ctx context.Context, if node.Annotations[nodeconfig.PubKeyHashAnnotation] != nodeconfig.CreatePubKeyHashAnnotation(r.signer.PublicKey()) { log.Info("deleting machine") - deletionAllowed, err := r.isAllowedDeletion(ctx, machine) - if err != nil { - return ctrl.Result{}, fmt.Errorf("unable to determine if Machine can be deleted: %w", err) - } - if !deletionAllowed { - log.Info("machine deletion restricted", "maxUnhealthyCount", maxUnhealthyCount) - r.recorder.Eventf(machine, core.EventTypeWarning, "MachineDeletionRestricted", - "Machine %v deletion restricted as the maximum unhealthy machines can`t exceed %v count", - machine.Name, maxUnhealthyCount) - return ctrl.Result{Requeue: true}, nil - } - return ctrl.Result{}, r.deleteMachine(ctx, machine) + return r.deleteMachineIfAllowed(ctx, machine, "private key out of date") } if node.Annotations[metadata.VersionAnnotation] == version.Get() { // version annotation exists with a valid value, node is fully configured. @@ -339,7 +336,7 @@ func (r *WindowsMachineReconciler) Reconcile(ctx context.Context, // re-provisioned. r.recorder.Eventf(machine, core.EventTypeWarning, "MachineSetupFailure", "Machine %s authentication failure", machine.Name) - return ctrl.Result{}, r.deleteMachine(ctx, machine) + return r.deleteMachineIfAllowed(ctx, machine, "authentication failure") } r.recorder.Eventf(machine, core.EventTypeWarning, "MachineSetupFailure", "Machine %s configuration failure", machine.Name) @@ -350,6 +347,30 @@ func (r *WindowsMachineReconciler) Reconcile(ctx context.Context, return ctrl.Result{}, nil } +// deleteMachineIfAllowed deletes the given Machine if doing so would not cause the number of unhealthy Machines +// in its MachineSet to reach or exceed maxUnhealthyCount. This is the single safety gate used by every Machine +// remediation path (e.g. authentication failure, stale private key), ensuring they are all bound by the same +// disruption budget rather than some paths being gated and others deleting unconditionally. +// reason is a short human-readable description of why deletion is being attempted, used for logging/events. +func (r *WindowsMachineReconciler) deleteMachineIfAllowed(ctx context.Context, machine *mapi.Machine, + reason string) (ctrl.Result, error) { + deletionAllowed, err := r.isAllowedDeletion(ctx, machine) + if err != nil { + return ctrl.Result{}, fmt.Errorf("unable to determine if Machine can be deleted: %w", err) + } + if !deletionAllowed { + r.log.Info("machine deletion restricted", "name", machine.GetName(), "reason", reason, + "maxUnhealthyCount", maxUnhealthyCount) + r.recorder.Eventf(machine, core.EventTypeWarning, "MachineDeletionRestricted", + "Machine %v deletion restricted (%s) as the maximum unhealthy machines can`t exceed %v count", + machine.Name, reason, maxUnhealthyCount) + // Requeue with a backoff rather than immediately, to avoid a tight reconcile loop and event spam while + // waiting for a sibling Machine's remediation to complete. + return ctrl.Result{RequeueAfter: machineDeletionRestrictedRequeueInterval}, nil + } + return ctrl.Result{}, r.deleteMachine(ctx, machine) +} + // deleteMachine deletes the specified Machine func (r *WindowsMachineReconciler) deleteMachine(ctx context.Context, machine *mapi.Machine) error { if !machine.GetDeletionTimestamp().IsZero() { @@ -470,6 +491,9 @@ func (r *WindowsMachineReconciler) isAllowedDeletion(ctx context.Context, machin for _, ma := range machines.Items { // Increment the count if the machine is identified as healthy and is a part of given Windows MachineSet and // on which deletion is not already initiated. + // Note: `len(machine.OwnerReferences) != 0` here refers to the outer `machine` parameter (already validated + // non-empty at the top of this function), not the loop variable `ma`. It is redundant but kept for + // clarity/safety in case this function is refactored again in the future. if len(machine.OwnerReferences) != 0 && ma.OwnerReferences[0].Name == machinesetName && r.isWindowsMachineHealthy(ctx, &ma) && ma.DeletionTimestamp.IsZero() { totalHealthy += 1 @@ -489,14 +513,18 @@ func (r *WindowsMachineReconciler) isAllowedDeletion(ctx context.Context, machin // 2. Machine is not associated with a Node object // 3. Associated Node object doesn't have a Version annotation func (r *WindowsMachineReconciler) isWindowsMachineHealthy(ctx context.Context, machine *mapi.Machine) bool { - if (machine.Status.Phase == nil || *machine.Status.Phase != "Running") && - machine.Status.NodeRef == nil { + // Note: these conditions must be OR'd, not AND'd. A previous version of this check used `&&`, which meant a + // Machine reporting phase "Running" with a nil NodeRef would fall through to the NodeRef.Name dereference + // below and panic, instead of correctly being treated as unhealthy. + if machine.Status.Phase == nil || *machine.Status.Phase != "Running" || machine.Status.NodeRef == nil { return false } - // Get node associated with the machine - node, err := r.k8sclientset.CoreV1().Nodes().Get(ctx, machine.Status.NodeRef.Name, meta.GetOptions{}) - if err != nil { + // Get node associated with the machine. Use the cached controller-runtime client (consistent with how the + // Node is fetched in Reconcile) rather than k8sclientset, so this function can be exercised in unit tests + // against a fake client. + node := &core.Node{} + if err := r.client.Get(ctx, kubeTypes.NamespacedName{Name: machine.Status.NodeRef.Name}, node); err != nil { return false } _, present := node.Annotations[metadata.VersionAnnotation] diff --git a/controllers/windowsmachine_controller_deletion_test.go b/controllers/windowsmachine_controller_deletion_test.go new file mode 100644 index 0000000000..7bc795ae8e --- /dev/null +++ b/controllers/windowsmachine_controller_deletion_test.go @@ -0,0 +1,317 @@ +package controllers + +import ( + "context" + "testing" + "time" + + mapi "github.com/openshift/api/machine/v1beta1" + mclientfake "github.com/openshift/client-go/machine/clientset/versioned/fake" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + core "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/tools/record" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + fakeclient "sigs.k8s.io/controller-runtime/pkg/client/fake" + logf "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/openshift/windows-machine-config-operator/pkg/cluster" + "github.com/openshift/windows-machine-config-operator/pkg/metadata" +) + +// runningPhase and machineSetKind are convenience values used to build test fixtures below. +const ( + testRunningPhase = "Running" + testMachineSetKind = "MachineSet" + testMachineSetName = "windows-machineset" +) + +// newTestMachine returns a Windows Machine owned by testMachineSetName, with the given name, phase, and (optional) +// associated Node name. If deleting is true, a non-zero DeletionTimestamp is set on the Machine, simulating a +// delete already being in progress. +func newTestMachine(name, phase, nodeName string, deleting bool) *mapi.Machine { + m := &mapi.Machine{ + TypeMeta: meta.TypeMeta{Kind: "Machine"}, + ObjectMeta: meta.ObjectMeta{ + Name: name, + Namespace: cluster.MachineAPINamespace, + Labels: map[string]string{MachineOSLabel: "Windows"}, + OwnerReferences: []meta.OwnerReference{ + {Kind: testMachineSetKind, Name: testMachineSetName}, + }, + }, + } + if phase != "" { + m.Status.Phase = &phase + } + if nodeName != "" { + m.Status.NodeRef = &core.ObjectReference{Name: nodeName} + } + if deleting { + now := meta.Now() + m.DeletionTimestamp = &now + // A finalizer is required for the fake client to retain the object with a DeletionTimestamp instead of + // removing it outright. + m.Finalizers = []string{"windowsmachineconfig.openshift.io/test-finalizer"} + } + return m +} + +// newTestMachineSet returns a MachineSet named testMachineSetName with the given replica count. +func newTestMachineSet(replicas int32) *mapi.MachineSet { + return &mapi.MachineSet{ + TypeMeta: meta.TypeMeta{Kind: "MachineSet"}, + ObjectMeta: meta.ObjectMeta{ + Name: testMachineSetName, + Namespace: cluster.MachineAPINamespace, + }, + Spec: mapi.MachineSetSpec{ + Replicas: &replicas, + }, + } +} + +// newTestNode returns a Node with the given name. If configured is true, the Node carries the VersionAnnotation +// that marks it as fully configured, a precondition for being considered healthy. +func newTestNode(name string, configured bool) *core.Node { + n := &core.Node{ + ObjectMeta: meta.ObjectMeta{ + Name: name, + }, + } + if configured { + n.Annotations = map[string]string{metadata.VersionAnnotation: "test-version"} + } + return n +} + +// newDeletionTestReconciler returns a WindowsMachineReconciler backed by: +// - a fake typed Machine clientset (seeded with machines and machineSet), used by isAllowedDeletion's +// List/Get calls, matching how the real machineClient field is used in production. +// - a fake controller-runtime client (seeded with machines and nodes), used for Node lookups +// (isWindowsMachineHealthy) and for the Delete call in deleteMachine, matching how r.client is used in +// production. +// +// It also returns the FakeRecorder so tests can assert on emitted events. +func newDeletionTestReconciler(t *testing.T, machines []*mapi.Machine, machineSet *mapi.MachineSet, + nodes []*core.Node) (*WindowsMachineReconciler, *record.FakeRecorder) { + t.Helper() + + scheme := runtime.NewScheme() + require.NoError(t, core.AddToScheme(scheme)) + require.NoError(t, mapi.AddToScheme(scheme)) + + clientObjs := make([]client.Object, 0, len(machines)+len(nodes)) + machineClientObjs := make([]runtime.Object, 0, len(machines)+1) + for _, m := range machines { + clientObjs = append(clientObjs, m) + machineClientObjs = append(machineClientObjs, m) + } + for _, n := range nodes { + clientObjs = append(clientObjs, n) + } + if machineSet != nil { + machineClientObjs = append(machineClientObjs, machineSet) + } + + fc := fakeclient.NewClientBuilder().WithScheme(scheme).WithObjects(clientObjs...).Build() + mc := mclientfake.NewSimpleClientset(machineClientObjs...) + recorder := record.NewFakeRecorder(20) + + r := &WindowsMachineReconciler{ + instanceReconciler: instanceReconciler{ + client: fc, + log: logf.Log.WithName("test"), + recorder: recorder, + }, + machineClient: mc.MachineV1beta1(), + } + return r, recorder +} + +// TestIsAllowedDeletion covers the deletion-gate matrix described in the WMCO private-key-rotation fix plan: +// it verifies that isAllowedDeletion consistently enforces maxUnhealthyCount regardless of which remediation +// path (authentication failure vs. stale private key) triggered the check. +func TestIsAllowedDeletion(t *testing.T) { + ctx := context.Background() + + t.Run("2 replicas, 1 unhealthy, target still healthy -> restricted", func(t *testing.T) { + // Reproduces the exact bug scenario: one Machine (siblingUnhealthy) never finished configuring and is + // unhealthy; the target Machine is still healthy (its Node hasn't been touched yet) but is the one being + // evaluated for deletion. maxUnhealthyCount(1) should block this second deletion. + target := newTestMachine("target", testRunningPhase, "target-node", false) + siblingUnhealthy := newTestMachine("sibling-unhealthy", "Provisioning", "", false) + machineSet := newTestMachineSet(2) + nodes := []*core.Node{newTestNode("target-node", true)} + + r, _ := newDeletionTestReconciler(t, []*mapi.Machine{target, siblingUnhealthy}, machineSet, nodes) + + allowed, err := r.isAllowedDeletion(ctx, target) + require.NoError(t, err) + assert.False(t, allowed, "deletion should be restricted when a sibling Machine is already unhealthy") + }) + + t.Run("2 replicas, both healthy -> allowed", func(t *testing.T) { + target := newTestMachine("target", testRunningPhase, "target-node", false) + siblingHealthy := newTestMachine("sibling-healthy", testRunningPhase, "sibling-node", false) + machineSet := newTestMachineSet(2) + nodes := []*core.Node{newTestNode("target-node", true), newTestNode("sibling-node", true)} + + r, _ := newDeletionTestReconciler(t, []*mapi.Machine{target, siblingHealthy}, machineSet, nodes) + + allowed, err := r.isAllowedDeletion(ctx, target) + require.NoError(t, err) + assert.True(t, allowed, "deletion should be allowed when unhealthy count is 0") + }) + + t.Run("1 replica MachineSet -> always allowed", func(t *testing.T) { + // Special case: when maxUnhealthyCount == totalWindowsMachineCount (a MachineSet of size 1), deletion must + // always be allowed, since there can never be a "healthy" sibling to wait for. + target := newTestMachine("target", "Provisioning", "", false) // deliberately unhealthy + machineSet := newTestMachineSet(1) + + r, _ := newDeletionTestReconciler(t, []*mapi.Machine{target}, machineSet, nil) + + allowed, err := r.isAllowedDeletion(ctx, target) + require.NoError(t, err) + assert.True(t, allowed, "deletion must always be allowed for a MachineSet of size 1") + }) + + t.Run("3 replicas, 1 already unhealthy, target healthy -> restricted at boundary", func(t *testing.T) { + target := newTestMachine("target", testRunningPhase, "target-node", false) + siblingHealthy := newTestMachine("sibling-healthy", testRunningPhase, "sibling-node", false) + siblingUnhealthy := newTestMachine("sibling-unhealthy", "Provisioning", "", false) + machineSet := newTestMachineSet(3) + nodes := []*core.Node{newTestNode("target-node", true), newTestNode("sibling-node", true)} + + r, _ := newDeletionTestReconciler(t, + []*mapi.Machine{target, siblingHealthy, siblingUnhealthy}, machineSet, nodes) + + allowed, err := r.isAllowedDeletion(ctx, target) + require.NoError(t, err) + assert.False(t, allowed, "deletion should be restricted: unhealthy count (1) already meets maxUnhealthyCount") + }) + + t.Run("sibling already being deleted is excluded from healthy count -> restricted", func(t *testing.T) { + // A Machine with a non-zero DeletionTimestamp must not count as healthy, even if its Node still looks + // fully configured (deletion may not have propagated to the Node yet). + target := newTestMachine("target", testRunningPhase, "target-node", false) + siblingDeleting := newTestMachine("sibling-deleting", testRunningPhase, "sibling-node", true) + machineSet := newTestMachineSet(2) + nodes := []*core.Node{newTestNode("target-node", true), newTestNode("sibling-node", true)} + + r, _ := newDeletionTestReconciler(t, []*mapi.Machine{target, siblingDeleting}, machineSet, nodes) + + allowed, err := r.isAllowedDeletion(ctx, target) + require.NoError(t, err) + assert.False(t, allowed, + "deletion should be restricted: a Machine already being deleted must not count as healthy") + }) +} + +// TestDeleteMachine_AlreadyDeleting verifies that deleteMachine is a no-op (does not error and does not attempt a +// second delete) when the Machine already has a DeletionTimestamp set, i.e. its deletion was already initiated. +func TestDeleteMachine_AlreadyDeleting(t *testing.T) { + ctx := context.Background() + m := newTestMachine("already-deleting", testRunningPhase, "some-node", true) + r, recorder := newDeletionTestReconciler(t, []*mapi.Machine{m}, newTestMachineSet(2), nil) + + err := r.deleteMachine(ctx, m) + require.NoError(t, err) + + select { + case e := <-recorder.Events: + t.Fatalf("expected no event to be emitted for a Machine already being deleted, got: %s", e) + default: + // expected: no event emitted, since deleteMachine returns early + } +} + +// TestDeleteMachineIfAllowed verifies the shared gate helper used by both the authentication-failure and +// stale-private-key remediation paths: it must delete the Machine when allowed, and must restrict + requeue with +// backoff (emitting a MachineDeletionRestricted event) when not allowed - regardless of the "reason" passed in, +// confirming both former code paths now behave consistently. +func TestDeleteMachineIfAllowed(t *testing.T) { + ctx := context.Background() + + for _, reason := range []string{"authentication failure", "private key out of date"} { + t.Run(reason+"/allowed", func(t *testing.T) { + target := newTestMachine("target", testRunningPhase, "target-node", false) + siblingHealthy := newTestMachine("sibling-healthy", testRunningPhase, "sibling-node", false) + machineSet := newTestMachineSet(2) + nodes := []*core.Node{newTestNode("target-node", true), newTestNode("sibling-node", true)} + r, recorder := newDeletionTestReconciler(t, []*mapi.Machine{target, siblingHealthy}, machineSet, nodes) + + result, err := r.deleteMachineIfAllowed(ctx, target, reason) + require.NoError(t, err) + assert.Equal(t, ctrl.Result{}, result, "no requeue expected when deletion proceeds") + + // The Machine should have been deleted from the fake client. + err = r.client.Get(ctx, client.ObjectKey{Namespace: target.Namespace, Name: target.Name}, + &mapi.Machine{}) + assert.True(t, apierrors.IsNotFound(err), "expected Machine to have been deleted") + + assertNoEventWithReason(t, recorder, "MachineDeletionRestricted") + }) + + t.Run(reason+"/restricted", func(t *testing.T) { + target := newTestMachine("target", testRunningPhase, "target-node", false) + siblingUnhealthy := newTestMachine("sibling-unhealthy", "Provisioning", "", false) + machineSet := newTestMachineSet(2) + nodes := []*core.Node{newTestNode("target-node", true)} + r, recorder := newDeletionTestReconciler(t, []*mapi.Machine{target, siblingUnhealthy}, machineSet, nodes) + + result, err := r.deleteMachineIfAllowed(ctx, target, reason) + require.NoError(t, err) + assert.Zero(t, result.Requeue, "should use RequeueAfter backoff, not an immediate requeue") + assert.Equal(t, machineDeletionRestrictedRequeueInterval, result.RequeueAfter) + + // The Machine should NOT have been deleted. + err = r.client.Get(ctx, client.ObjectKey{Namespace: target.Namespace, Name: target.Name}, + &mapi.Machine{}) + require.NoError(t, err, "expected Machine to still exist") + + assertEventWithReason(t, recorder, "MachineDeletionRestricted") + }) + } +} + +// TestIsWindowsMachineHealthy_RunningWithoutNodeRef is a regression test ensuring a Machine reporting phase +// "Running" with a nil NodeRef is treated as unhealthy instead of panicking on a nil pointer dereference. +func TestIsWindowsMachineHealthy_RunningWithoutNodeRef(t *testing.T) { + ctx := context.Background() + m := newTestMachine("running-no-noderef", testRunningPhase, "", false) + r, _ := newDeletionTestReconciler(t, []*mapi.Machine{m}, newTestMachineSet(2), nil) + + assert.NotPanics(t, func() { + healthy := r.isWindowsMachineHealthy(ctx, m) + assert.False(t, healthy) + }) +} + +// assertEventWithReason drains the given FakeRecorder's channel (non-blocking with a short timeout) and asserts +// that at least one event with the given reason was recorded. +func assertEventWithReason(t *testing.T, recorder *record.FakeRecorder, reason string) { + t.Helper() + select { + case e := <-recorder.Events: + assert.Contains(t, e, reason) + case <-time.After(time.Second): + t.Fatalf("expected an event with reason %q, but none was recorded", reason) + } +} + +// assertNoEventWithReason asserts that no event with the given reason was recorded. +func assertNoEventWithReason(t *testing.T, recorder *record.FakeRecorder, reason string) { + t.Helper() + select { + case e := <-recorder.Events: + assert.NotContains(t, e, reason) + default: + // expected: no event recorded + } +} diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go index c0ba9918f6..9cfd934472 100644 --- a/test/e2e/create_test.go +++ b/test/e2e/create_test.go @@ -180,7 +180,13 @@ func (tc *testContext) testMachineConfiguration(t *testing.T) { require.NoError(t, err, "failed to create Windows MachineSet") machineCreationTime := time.Now() - t.Run("Machine configuration while private key change", tc.testMachineConfigurationWhilePrivateKeyChange) + if !t.Run("Machine configuration while private key change", tc.testMachineConfigurationWhilePrivateKeyChange) { + // If the private key rotation subtest failed (e.g. Machine deletion timed out), the MachineSet may still be + // self-healing (old Machines mid-deletion alongside new replacements), so continuing on would race against + // that in-progress remediation and produce a confusing, unrelated failure. Stop here since the root cause + // has already been reported by the failed subtest. + return + } machines, err := tc.waitForWindowsMachines(int(gc.numberOfMachineNodes), "Provisioned", false) require.NoError(t, err, "error waiting for Windows Machines to be provisioned") @@ -257,6 +263,14 @@ func (tc *testContext) waitForSSHAvailable(addresses []string) error { // deleted after the private key is changed, but before WMCO is able to configure them, resulting in WMCO getting an // SSH authentication error. This could be considered a platform-agnostic test (except for vSphere where the private // key is baked in the VM template) so we run it only on Azure. +// +// Depending on exact reconcile timing, some Machines provisioned here may instead have already finished +// configuring with the old key by the time the key is rotated. Those Machines are remediated via the "stale +// private key" path rather than the "authentication failure" path, but both paths are gated by the same +// maxUnhealthyCount safety check in WMCO (see isAllowedDeletion), so all original Machines are still expected to +// eventually be deleted and replaced - potentially after a MachineDeletionRestricted event is observed on one of +// them while it waits for a sibling's replacement to become healthy. waitForMachinesDeleted's timeout accounts for +// this worst case. func (tc *testContext) testMachineConfigurationWhilePrivateKeyChange(t *testing.T) { if tc.CloudProvider.GetType() != config.AzurePlatformType { t.Skip("test disabled, exclusively runs on Azure") @@ -273,8 +287,12 @@ func (tc *testContext) testMachineConfigurationWhilePrivateKeyChange(t *testing. // waitForMachinesDeleted waits for the given list of machines to be deleted func (tc *testContext) waitForMachinesDeleted(machines []mapi.Machine) (err error) { - // This is the maximum amount of time for the deletion of all machines in Azure - deletionTimeout := time.Minute * 15 + // This timeout must account for the worst case remediation path: if the Machine deletion is restricted by + // WMCO's maxUnhealthyCount safety gate (e.g. because a sibling Machine's replacement is still being built), + // the restricted Machine will not be deleted until that sibling's replacement Machine has been fully + // provisioned and configured into a healthy Node - a process that can take up to vmConfigurationTime. A flat + // 15 minute timeout (assuming only a simple VM deletion) was observed to be insufficient in this scenario. + deletionTimeout := vmConfigurationTime + time.Minute*15 for _, m := range machines { log.Printf("waiting (timeout: %s) for machine %s to be deleted", deletionTimeout.String(), m.GetName()) err = wait.PollUntilContextTimeout(context.TODO(), retry.ResourceChangeTimeout, deletionTimeout, false, @@ -575,7 +593,12 @@ func (tc *testContext) waitForWindowsMachines(machineCount int, phase string, ig return false, nil } if len(machines.Items) != machineCount { - log.Printf("waiting for %d/%d Windows Machines", machineCount-len(machines.Items), machineCount) + if len(machines.Items) < machineCount { + log.Printf("found %d/%d Windows Machines, still waiting", len(machines.Items), machineCount) + } else { + log.Printf("found %d Windows Machines, expected %d (extra Machines present, likely mid-remediation)", + len(machines.Items), machineCount) + } return false, nil } // A phase of "" skips the phase check diff --git a/test/e2e/secrets_test.go b/test/e2e/secrets_test.go index 790e7b8e9f..7517b7f123 100644 --- a/test/e2e/secrets_test.go +++ b/test/e2e/secrets_test.go @@ -104,7 +104,10 @@ func (tc *testContext) waitForNewMachineNodes() error { // waitForConfiguredWindowsNodes will re-populate gc.machineNodes with the configured nodes found log.Printf("waiting for existing Machine nodes to be removed and replaced") - return wait.Poll(retryInterval, time.Minute*10, func() (done bool, err error) { + // This timeout must allow for a full replacement Machine to be provisioned and configured + // (vmConfigurationTime), plus a safety margin, in case WMCO's maxUnhealthyCount safety gate (see + // isAllowedDeletion) restricts deletion of an old Machine until a sibling's replacement becomes healthy. + return wait.Poll(retryInterval, vmConfigurationTime+time.Minute*5, func() (done bool, err error) { err = tc.waitForConfiguredWindowsNodes(gc.numberOfMachineNodes, false, false) if err != nil { log.Printf("error waiting for configured Windows Nodes: %s", err) @@ -227,9 +230,6 @@ func generatePrivateKey() ([]byte, error) { // createPrivateKeySecret ensures that a private key secret exists with the correct data in both the operator and test // namespaces func (tc *testContext) createPrivateKeySecret(useKnownKey bool) error { - if err := tc.ensurePrivateKeyDeleted(); err != nil { - return fmt.Errorf("error ensuring any existing private key is removed: %w", err) - } var keyData []byte var err error if useKnownKey { @@ -244,19 +244,35 @@ func (tc *testContext) createPrivateKeySecret(useKnownKey bool) error { } } - privateKeySecret := core.Secret{ - Data: map[string][]byte{secrets.PrivateKeySecretKey: keyData}, - ObjectMeta: meta.ObjectMeta{ - Name: secrets.PrivateKeySecret, - }, - } - - // Create the private key secret in both the operator's namespace, and the test namespace. This is needed to make it - // possible to SSH into the Windows nodes from pods spun up in the test namespace. + // Update the private key secret in place, falling back to Create if it doesn't yet exist, in both the + // operator's namespace and the test namespace. This is needed to make it possible to SSH into the Windows + // nodes from pods spun up in the test namespace. + // An atomic update-or-create is used here instead of deleting then re-creating the secret, to avoid a window + // where the secret does not exist at all. That window was observed to cause a burst of unrelated + // "Secret cloud-private-key not found" errors across multiple WMCO controllers while this test rotated keys. for _, ns := range []string{wmcoNamespace, tc.workloadNamespace} { - _, err := tc.client.K8s.CoreV1().Secrets(ns).Create(context.TODO(), &privateKeySecret, meta.CreateOptions{}) - if err != nil { - return fmt.Errorf("could not create private key secret in namespace %s: %w", ns, err) + existing, getErr := tc.client.K8s.CoreV1().Secrets(ns).Get(context.TODO(), secrets.PrivateKeySecret, + meta.GetOptions{}) + if getErr != nil { + if !apierrors.IsNotFound(getErr) { + return fmt.Errorf("error getting private key secret in namespace %s: %w", ns, getErr) + } + newSecret := &core.Secret{ + Data: map[string][]byte{secrets.PrivateKeySecretKey: keyData}, + ObjectMeta: meta.ObjectMeta{ + Name: secrets.PrivateKeySecret, + }, + } + if _, err := tc.client.K8s.CoreV1().Secrets(ns).Create(context.TODO(), newSecret, + meta.CreateOptions{}); err != nil { + return fmt.Errorf("could not create private key secret in namespace %s: %w", ns, err) + } + continue + } + existing.Data = map[string][]byte{secrets.PrivateKeySecretKey: keyData} + if _, err := tc.client.K8s.CoreV1().Secrets(ns).Update(context.TODO(), existing, + meta.UpdateOptions{}); err != nil { + return fmt.Errorf("could not update private key secret in namespace %s: %w", ns, err) } } return nil diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsfailuredomain.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsfailuredomain.go new file mode 100644 index 0000000000..e27ef35925 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsfailuredomain.go @@ -0,0 +1,36 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// AWSFailureDomainApplyConfiguration represents a declarative configuration of the AWSFailureDomain type for use +// with apply. +// +// AWSFailureDomain configures failure domain information for the AWS platform. +type AWSFailureDomainApplyConfiguration struct { + // subnet is a reference to the subnet to use for this instance. + Subnet *AWSResourceReferenceApplyConfiguration `json:"subnet,omitempty"` + // placement configures the placement information for this instance. + Placement *AWSFailureDomainPlacementApplyConfiguration `json:"placement,omitempty"` +} + +// AWSFailureDomainApplyConfiguration constructs a declarative configuration of the AWSFailureDomain type for use with +// apply. +func AWSFailureDomain() *AWSFailureDomainApplyConfiguration { + return &AWSFailureDomainApplyConfiguration{} +} + +// WithSubnet sets the Subnet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subnet field is set to the value of the last call. +func (b *AWSFailureDomainApplyConfiguration) WithSubnet(value *AWSResourceReferenceApplyConfiguration) *AWSFailureDomainApplyConfiguration { + b.Subnet = value + return b +} + +// WithPlacement sets the Placement field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Placement field is set to the value of the last call. +func (b *AWSFailureDomainApplyConfiguration) WithPlacement(value *AWSFailureDomainPlacementApplyConfiguration) *AWSFailureDomainApplyConfiguration { + b.Placement = value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsfailuredomainplacement.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsfailuredomainplacement.go new file mode 100644 index 0000000000..8473617c17 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsfailuredomainplacement.go @@ -0,0 +1,26 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// AWSFailureDomainPlacementApplyConfiguration represents a declarative configuration of the AWSFailureDomainPlacement type for use +// with apply. +// +// AWSFailureDomainPlacement configures the placement information for the AWSFailureDomain. +type AWSFailureDomainPlacementApplyConfiguration struct { + // availabilityZone is the availability zone of the instance. + AvailabilityZone *string `json:"availabilityZone,omitempty"` +} + +// AWSFailureDomainPlacementApplyConfiguration constructs a declarative configuration of the AWSFailureDomainPlacement type for use with +// apply. +func AWSFailureDomainPlacement() *AWSFailureDomainPlacementApplyConfiguration { + return &AWSFailureDomainPlacementApplyConfiguration{} +} + +// WithAvailabilityZone sets the AvailabilityZone field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailabilityZone field is set to the value of the last call. +func (b *AWSFailureDomainPlacementApplyConfiguration) WithAvailabilityZone(value string) *AWSFailureDomainPlacementApplyConfiguration { + b.AvailabilityZone = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsresourcefilter.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsresourcefilter.go new file mode 100644 index 0000000000..0fb38a1a4f --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsresourcefilter.go @@ -0,0 +1,38 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// AWSResourceFilterApplyConfiguration represents a declarative configuration of the AWSResourceFilter type for use +// with apply. +// +// AWSResourceFilter is a filter used to identify an AWS resource +type AWSResourceFilterApplyConfiguration struct { + // name of the filter. Filter names are case-sensitive. + Name *string `json:"name,omitempty"` + // values includes one or more filter values. Filter values are case-sensitive. + Values []string `json:"values,omitempty"` +} + +// AWSResourceFilterApplyConfiguration constructs a declarative configuration of the AWSResourceFilter type for use with +// apply. +func AWSResourceFilter() *AWSResourceFilterApplyConfiguration { + return &AWSResourceFilterApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *AWSResourceFilterApplyConfiguration) WithName(value string) *AWSResourceFilterApplyConfiguration { + b.Name = &value + return b +} + +// WithValues adds the given value to the Values field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Values field. +func (b *AWSResourceFilterApplyConfiguration) WithValues(values ...string) *AWSResourceFilterApplyConfiguration { + for i := range values { + b.Values = append(b.Values, values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsresourcereference.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsresourcereference.go new file mode 100644 index 0000000000..4a6bf084ec --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/awsresourcereference.go @@ -0,0 +1,74 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + machinev1 "github.com/openshift/api/machine/v1" +) + +// AWSResourceReferenceApplyConfiguration represents a declarative configuration of the AWSResourceReference type for use +// with apply. +// +// AWSResourceReference is a reference to a specific AWS resource by ID, ARN, or filters. +// Only one of ID, ARN or Filters may be specified. Specifying more than one will result in +// a validation error. +type AWSResourceReferenceApplyConfiguration struct { + // type determines how the reference will fetch the AWS resource. + Type *machinev1.AWSResourceReferenceType `json:"type,omitempty"` + // id of resource. + ID *string `json:"id,omitempty"` + // arn of resource. + ARN *string `json:"arn,omitempty"` + // filters is a set of filters used to identify a resource. + Filters *[]AWSResourceFilterApplyConfiguration `json:"filters,omitempty"` +} + +// AWSResourceReferenceApplyConfiguration constructs a declarative configuration of the AWSResourceReference type for use with +// apply. +func AWSResourceReference() *AWSResourceReferenceApplyConfiguration { + return &AWSResourceReferenceApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *AWSResourceReferenceApplyConfiguration) WithType(value machinev1.AWSResourceReferenceType) *AWSResourceReferenceApplyConfiguration { + b.Type = &value + return b +} + +// WithID sets the ID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ID field is set to the value of the last call. +func (b *AWSResourceReferenceApplyConfiguration) WithID(value string) *AWSResourceReferenceApplyConfiguration { + b.ID = &value + return b +} + +// WithARN sets the ARN field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ARN field is set to the value of the last call. +func (b *AWSResourceReferenceApplyConfiguration) WithARN(value string) *AWSResourceReferenceApplyConfiguration { + b.ARN = &value + return b +} + +func (b *AWSResourceReferenceApplyConfiguration) ensureAWSResourceFilterApplyConfigurationExists() { + if b.Filters == nil { + b.Filters = &[]AWSResourceFilterApplyConfiguration{} + } +} + +// WithFilters adds the given value to the Filters field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Filters field. +func (b *AWSResourceReferenceApplyConfiguration) WithFilters(values ...*AWSResourceFilterApplyConfiguration) *AWSResourceReferenceApplyConfiguration { + b.ensureAWSResourceFilterApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithFilters") + } + *b.Filters = append(*b.Filters, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/azurefailuredomain.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/azurefailuredomain.go new file mode 100644 index 0000000000..81443c8924 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/azurefailuredomain.go @@ -0,0 +1,38 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// AzureFailureDomainApplyConfiguration represents a declarative configuration of the AzureFailureDomain type for use +// with apply. +// +// AzureFailureDomain configures failure domain information for the Azure platform. +type AzureFailureDomainApplyConfiguration struct { + // Availability Zone for the virtual machine. + // If nil, the virtual machine should be deployed to no zone. + Zone *string `json:"zone,omitempty"` + // subnet is the name of the network subnet in which the VM will be created. + // When omitted, the subnet value from the machine providerSpec template will be used. + Subnet *string `json:"subnet,omitempty"` +} + +// AzureFailureDomainApplyConfiguration constructs a declarative configuration of the AzureFailureDomain type for use with +// apply. +func AzureFailureDomain() *AzureFailureDomainApplyConfiguration { + return &AzureFailureDomainApplyConfiguration{} +} + +// WithZone sets the Zone field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Zone field is set to the value of the last call. +func (b *AzureFailureDomainApplyConfiguration) WithZone(value string) *AzureFailureDomainApplyConfiguration { + b.Zone = &value + return b +} + +// WithSubnet sets the Subnet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subnet field is set to the value of the last call. +func (b *AzureFailureDomainApplyConfiguration) WithSubnet(value string) *AzureFailureDomainApplyConfiguration { + b.Subnet = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachineset.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachineset.go new file mode 100644 index 0000000000..54ff0aa949 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachineset.go @@ -0,0 +1,276 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + machinev1 "github.com/openshift/api/machine/v1" + internal "github.com/openshift/client-go/machine/applyconfigurations/internal" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ControlPlaneMachineSetApplyConfiguration represents a declarative configuration of the ControlPlaneMachineSet type for use +// with apply. +// +// ControlPlaneMachineSet ensures that a specified number of control plane machine replicas are running at any given time. +// Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). +type ControlPlaneMachineSetApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *ControlPlaneMachineSetSpecApplyConfiguration `json:"spec,omitempty"` + Status *ControlPlaneMachineSetStatusApplyConfiguration `json:"status,omitempty"` +} + +// ControlPlaneMachineSet constructs a declarative configuration of the ControlPlaneMachineSet type for use with +// apply. +func ControlPlaneMachineSet(name, namespace string) *ControlPlaneMachineSetApplyConfiguration { + b := &ControlPlaneMachineSetApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("ControlPlaneMachineSet") + b.WithAPIVersion("machine.openshift.io/v1") + return b +} + +// ExtractControlPlaneMachineSetFrom extracts the applied configuration owned by fieldManager from +// controlPlaneMachineSet for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// controlPlaneMachineSet must be a unmodified ControlPlaneMachineSet API object that was retrieved from the Kubernetes API. +// ExtractControlPlaneMachineSetFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractControlPlaneMachineSetFrom(controlPlaneMachineSet *machinev1.ControlPlaneMachineSet, fieldManager string, subresource string) (*ControlPlaneMachineSetApplyConfiguration, error) { + b := &ControlPlaneMachineSetApplyConfiguration{} + err := managedfields.ExtractInto(controlPlaneMachineSet, internal.Parser().Type("com.github.openshift.api.machine.v1.ControlPlaneMachineSet"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(controlPlaneMachineSet.Name) + b.WithNamespace(controlPlaneMachineSet.Namespace) + + b.WithKind("ControlPlaneMachineSet") + b.WithAPIVersion("machine.openshift.io/v1") + return b, nil +} + +// ExtractControlPlaneMachineSet extracts the applied configuration owned by fieldManager from +// controlPlaneMachineSet. If no managedFields are found in controlPlaneMachineSet for fieldManager, a +// ControlPlaneMachineSetApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// controlPlaneMachineSet must be a unmodified ControlPlaneMachineSet API object that was retrieved from the Kubernetes API. +// ExtractControlPlaneMachineSet provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractControlPlaneMachineSet(controlPlaneMachineSet *machinev1.ControlPlaneMachineSet, fieldManager string) (*ControlPlaneMachineSetApplyConfiguration, error) { + return ExtractControlPlaneMachineSetFrom(controlPlaneMachineSet, fieldManager, "") +} + +// ExtractControlPlaneMachineSetStatus extracts the applied configuration owned by fieldManager from +// controlPlaneMachineSet for the status subresource. +func ExtractControlPlaneMachineSetStatus(controlPlaneMachineSet *machinev1.ControlPlaneMachineSet, fieldManager string) (*ControlPlaneMachineSetApplyConfiguration, error) { + return ExtractControlPlaneMachineSetFrom(controlPlaneMachineSet, fieldManager, "status") +} + +func (b ControlPlaneMachineSetApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithKind(value string) *ControlPlaneMachineSetApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithAPIVersion(value string) *ControlPlaneMachineSetApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithName(value string) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithGenerateName(value string) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithNamespace(value string) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithUID(value types.UID) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithResourceVersion(value string) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithGeneration(value int64) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ControlPlaneMachineSetApplyConfiguration) WithLabels(entries map[string]string) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ControlPlaneMachineSetApplyConfiguration) WithAnnotations(entries map[string]string) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ControlPlaneMachineSetApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ControlPlaneMachineSetApplyConfiguration) WithFinalizers(values ...string) *ControlPlaneMachineSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *ControlPlaneMachineSetApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithSpec(value *ControlPlaneMachineSetSpecApplyConfiguration) *ControlPlaneMachineSetApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *ControlPlaneMachineSetApplyConfiguration) WithStatus(value *ControlPlaneMachineSetStatusApplyConfiguration) *ControlPlaneMachineSetApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *ControlPlaneMachineSetApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *ControlPlaneMachineSetApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *ControlPlaneMachineSetApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *ControlPlaneMachineSetApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesetspec.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesetspec.go new file mode 100644 index 0000000000..c1bbccdcdd --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesetspec.go @@ -0,0 +1,107 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + machinev1 "github.com/openshift/api/machine/v1" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ControlPlaneMachineSetSpecApplyConfiguration represents a declarative configuration of the ControlPlaneMachineSetSpec type for use +// with apply. +// +// ControlPlaneMachineSet represents the configuration of the ControlPlaneMachineSet. +type ControlPlaneMachineSetSpecApplyConfiguration struct { + // machineNamePrefix is the prefix used when creating machine names. + // Each machine name will consist of this prefix, followed by + // a randomly generated string of 5 characters, and the index of the machine. + // It must be a lowercase RFC 1123 subdomain, consisting of lowercase + // alphanumeric characters, hyphens ('-'), and periods ('.'). + // Each block, separated by periods, must start and end with an alphanumeric character. + // Hyphens are not allowed at the start or end of a block, and consecutive periods are not permitted. + // The prefix must be between 1 and 245 characters in length. + // For example, if machineNamePrefix is set to 'control-plane', + // and three machines are created, their names might be: + // control-plane-abcde-0, control-plane-fghij-1, control-plane-klmno-2 + MachineNamePrefix *string `json:"machineNamePrefix,omitempty"` + // state defines whether the ControlPlaneMachineSet is Active or Inactive. + // When Inactive, the ControlPlaneMachineSet will not take any action on the + // state of the Machines within the cluster. + // When Active, the ControlPlaneMachineSet will reconcile the Machines and + // will update the Machines as necessary. + // Once Active, a ControlPlaneMachineSet cannot be made Inactive. To prevent + // further action please remove the ControlPlaneMachineSet. + State *machinev1.ControlPlaneMachineSetState `json:"state,omitempty"` + // replicas defines how many Control Plane Machines should be + // created by this ControlPlaneMachineSet. + // This field is immutable and cannot be changed after cluster + // installation. + // The ControlPlaneMachineSet only operates with 3 or 5 node control planes, + // 3 and 5 are the only valid values for this field. + Replicas *int32 `json:"replicas,omitempty"` + // strategy defines how the ControlPlaneMachineSet will update + // Machines when it detects a change to the ProviderSpec. + Strategy *ControlPlaneMachineSetStrategyApplyConfiguration `json:"strategy,omitempty"` + // Label selector for Machines. Existing Machines selected by this + // selector will be the ones affected by this ControlPlaneMachineSet. + // It must match the template's labels. + // This field is considered immutable after creation of the resource. + Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + // template describes the Control Plane Machines that will be created + // by this ControlPlaneMachineSet. + Template *ControlPlaneMachineSetTemplateApplyConfiguration `json:"template,omitempty"` +} + +// ControlPlaneMachineSetSpecApplyConfiguration constructs a declarative configuration of the ControlPlaneMachineSetSpec type for use with +// apply. +func ControlPlaneMachineSetSpec() *ControlPlaneMachineSetSpecApplyConfiguration { + return &ControlPlaneMachineSetSpecApplyConfiguration{} +} + +// WithMachineNamePrefix sets the MachineNamePrefix field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachineNamePrefix field is set to the value of the last call. +func (b *ControlPlaneMachineSetSpecApplyConfiguration) WithMachineNamePrefix(value string) *ControlPlaneMachineSetSpecApplyConfiguration { + b.MachineNamePrefix = &value + return b +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *ControlPlaneMachineSetSpecApplyConfiguration) WithState(value machinev1.ControlPlaneMachineSetState) *ControlPlaneMachineSetSpecApplyConfiguration { + b.State = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ControlPlaneMachineSetSpecApplyConfiguration) WithReplicas(value int32) *ControlPlaneMachineSetSpecApplyConfiguration { + b.Replicas = &value + return b +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *ControlPlaneMachineSetSpecApplyConfiguration) WithStrategy(value *ControlPlaneMachineSetStrategyApplyConfiguration) *ControlPlaneMachineSetSpecApplyConfiguration { + b.Strategy = value + return b +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *ControlPlaneMachineSetSpecApplyConfiguration) WithSelector(value *metav1.LabelSelectorApplyConfiguration) *ControlPlaneMachineSetSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *ControlPlaneMachineSetSpecApplyConfiguration) WithTemplate(value *ControlPlaneMachineSetTemplateApplyConfiguration) *ControlPlaneMachineSetSpecApplyConfiguration { + b.Template = value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesetstatus.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesetstatus.go new file mode 100644 index 0000000000..8700304cb2 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesetstatus.go @@ -0,0 +1,104 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ControlPlaneMachineSetStatusApplyConfiguration represents a declarative configuration of the ControlPlaneMachineSetStatus type for use +// with apply. +// +// ControlPlaneMachineSetStatus represents the status of the ControlPlaneMachineSet CRD. +type ControlPlaneMachineSetStatusApplyConfiguration struct { + // conditions represents the observations of the ControlPlaneMachineSet's current state. + // Known .status.conditions.type are: Available, Degraded and Progressing. + Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // observedGeneration is the most recent generation observed for this + // ControlPlaneMachineSet. It corresponds to the ControlPlaneMachineSets's generation, + // which is updated on mutation by the API Server. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + // replicas is the number of Control Plane Machines created by the + // ControlPlaneMachineSet controller. + // Note that during update operations this value may differ from the + // desired replica count. + Replicas *int32 `json:"replicas,omitempty"` + // readyReplicas is the number of Control Plane Machines created by the + // ControlPlaneMachineSet controller which are ready. + // Note that this value may be higher than the desired number of replicas + // while rolling updates are in-progress. + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + // updatedReplicas is the number of non-terminated Control Plane Machines + // created by the ControlPlaneMachineSet controller that have the desired + // provider spec and are ready. + // This value is set to 0 when a change is detected to the desired spec. + // When the update strategy is RollingUpdate, this will also coincide + // with starting the process of updating the Machines. + // When the update strategy is OnDelete, this value will remain at 0 until + // a user deletes an existing replica and its replacement has become ready. + UpdatedReplicas *int32 `json:"updatedReplicas,omitempty"` + // unavailableReplicas is the number of Control Plane Machines that are + // still required before the ControlPlaneMachineSet reaches the desired + // available capacity. When this value is non-zero, the number of + // ReadyReplicas is less than the desired Replicas. + UnavailableReplicas *int32 `json:"unavailableReplicas,omitempty"` +} + +// ControlPlaneMachineSetStatusApplyConfiguration constructs a declarative configuration of the ControlPlaneMachineSetStatus type for use with +// apply. +func ControlPlaneMachineSetStatus() *ControlPlaneMachineSetStatusApplyConfiguration { + return &ControlPlaneMachineSetStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *ControlPlaneMachineSetStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *ControlPlaneMachineSetStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *ControlPlaneMachineSetStatusApplyConfiguration) WithObservedGeneration(value int64) *ControlPlaneMachineSetStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithReplicas sets the Replicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Replicas field is set to the value of the last call. +func (b *ControlPlaneMachineSetStatusApplyConfiguration) WithReplicas(value int32) *ControlPlaneMachineSetStatusApplyConfiguration { + b.Replicas = &value + return b +} + +// WithReadyReplicas sets the ReadyReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReadyReplicas field is set to the value of the last call. +func (b *ControlPlaneMachineSetStatusApplyConfiguration) WithReadyReplicas(value int32) *ControlPlaneMachineSetStatusApplyConfiguration { + b.ReadyReplicas = &value + return b +} + +// WithUpdatedReplicas sets the UpdatedReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UpdatedReplicas field is set to the value of the last call. +func (b *ControlPlaneMachineSetStatusApplyConfiguration) WithUpdatedReplicas(value int32) *ControlPlaneMachineSetStatusApplyConfiguration { + b.UpdatedReplicas = &value + return b +} + +// WithUnavailableReplicas sets the UnavailableReplicas field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnavailableReplicas field is set to the value of the last call. +func (b *ControlPlaneMachineSetStatusApplyConfiguration) WithUnavailableReplicas(value int32) *ControlPlaneMachineSetStatusApplyConfiguration { + b.UnavailableReplicas = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesetstrategy.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesetstrategy.go new file mode 100644 index 0000000000..3037286d8a --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesetstrategy.go @@ -0,0 +1,34 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + machinev1 "github.com/openshift/api/machine/v1" +) + +// ControlPlaneMachineSetStrategyApplyConfiguration represents a declarative configuration of the ControlPlaneMachineSetStrategy type for use +// with apply. +// +// ControlPlaneMachineSetStrategy defines the strategy for applying updates to the +// Control Plane Machines managed by the ControlPlaneMachineSet. +type ControlPlaneMachineSetStrategyApplyConfiguration struct { + // type defines the type of update strategy that should be + // used when updating Machines owned by the ControlPlaneMachineSet. + // Valid values are "RollingUpdate" and "OnDelete". + // The current default value is "RollingUpdate". + Type *machinev1.ControlPlaneMachineSetStrategyType `json:"type,omitempty"` +} + +// ControlPlaneMachineSetStrategyApplyConfiguration constructs a declarative configuration of the ControlPlaneMachineSetStrategy type for use with +// apply. +func ControlPlaneMachineSetStrategy() *ControlPlaneMachineSetStrategyApplyConfiguration { + return &ControlPlaneMachineSetStrategyApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *ControlPlaneMachineSetStrategyApplyConfiguration) WithType(value machinev1.ControlPlaneMachineSetStrategyType) *ControlPlaneMachineSetStrategyApplyConfiguration { + b.Type = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesettemplate.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesettemplate.go new file mode 100644 index 0000000000..21e7c5fb29 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesettemplate.go @@ -0,0 +1,43 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + machinev1 "github.com/openshift/api/machine/v1" +) + +// ControlPlaneMachineSetTemplateApplyConfiguration represents a declarative configuration of the ControlPlaneMachineSetTemplate type for use +// with apply. +// +// ControlPlaneMachineSetTemplate is a template used by the ControlPlaneMachineSet +// to create the Machines that it will manage in the future. +type ControlPlaneMachineSetTemplateApplyConfiguration struct { + // machineType determines the type of Machines that should be managed by the ControlPlaneMachineSet. + // Currently, the only valid value is machines_v1beta1_machine_openshift_io. + MachineType *machinev1.ControlPlaneMachineSetMachineType `json:"machineType,omitempty"` + // OpenShiftMachineV1Beta1Machine defines the template for creating Machines + // from the v1beta1.machine.openshift.io API group. + OpenShiftMachineV1Beta1Machine *OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration `json:"machines_v1beta1_machine_openshift_io,omitempty"` +} + +// ControlPlaneMachineSetTemplateApplyConfiguration constructs a declarative configuration of the ControlPlaneMachineSetTemplate type for use with +// apply. +func ControlPlaneMachineSetTemplate() *ControlPlaneMachineSetTemplateApplyConfiguration { + return &ControlPlaneMachineSetTemplateApplyConfiguration{} +} + +// WithMachineType sets the MachineType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachineType field is set to the value of the last call. +func (b *ControlPlaneMachineSetTemplateApplyConfiguration) WithMachineType(value machinev1.ControlPlaneMachineSetMachineType) *ControlPlaneMachineSetTemplateApplyConfiguration { + b.MachineType = &value + return b +} + +// WithOpenShiftMachineV1Beta1Machine sets the OpenShiftMachineV1Beta1Machine field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OpenShiftMachineV1Beta1Machine field is set to the value of the last call. +func (b *ControlPlaneMachineSetTemplateApplyConfiguration) WithOpenShiftMachineV1Beta1Machine(value *OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration) *ControlPlaneMachineSetTemplateApplyConfiguration { + b.OpenShiftMachineV1Beta1Machine = value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesettemplateobjectmeta.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesettemplateobjectmeta.go new file mode 100644 index 0000000000..e7334cf4fc --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/controlplanemachinesettemplateobjectmeta.go @@ -0,0 +1,58 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration represents a declarative configuration of the ControlPlaneMachineSetTemplateObjectMeta type for use +// with apply. +// +// ControlPlaneMachineSetTemplateObjectMeta is a subset of the metav1.ObjectMeta struct. +// It allows users to specify labels and annotations that will be copied onto Machines +// created from this template. +type ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration struct { + // Map of string keys and values that can be used to organize and categorize + // (scope and select) objects. May match selectors of replication controllers + // and services. + // More info: http://kubernetes.io/docs/user-guide/labels. + // This field must contain both the 'machine.openshift.io/cluster-api-machine-role' and 'machine.openshift.io/cluster-api-machine-type' labels, both with a value of 'master'. + // It must also contain a label with the key 'machine.openshift.io/cluster-api-cluster'. + Labels map[string]string `json:"labels,omitempty"` + // annotations is an unstructured key value map stored with a resource that may be + // set by external tools to store and retrieve arbitrary metadata. They are not + // queryable and should be preserved when modifying objects. + // More info: http://kubernetes.io/docs/user-guide/annotations + Annotations map[string]string `json:"annotations,omitempty"` +} + +// ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration constructs a declarative configuration of the ControlPlaneMachineSetTemplateObjectMeta type for use with +// apply. +func ControlPlaneMachineSetTemplateObjectMeta() *ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration { + return &ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration{} +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration) WithLabels(entries map[string]string) *ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration { + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration) WithAnnotations(entries map[string]string) *ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration { + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/failuredomains.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/failuredomains.go new file mode 100644 index 0000000000..c849e16d78 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/failuredomains.go @@ -0,0 +1,143 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + configv1 "github.com/openshift/api/config/v1" +) + +// FailureDomainsApplyConfiguration represents a declarative configuration of the FailureDomains type for use +// with apply. +// +// FailureDomain represents the different configurations required to spread Machines +// across failure domains on different platforms. +type FailureDomainsApplyConfiguration struct { + // platform identifies the platform for which the FailureDomain represents. + // Currently supported values are AWS, Azure, GCP, OpenStack, VSphere and Nutanix. + Platform *configv1.PlatformType `json:"platform,omitempty"` + // aws configures failure domain information for the AWS platform. + AWS *[]AWSFailureDomainApplyConfiguration `json:"aws,omitempty"` + // azure configures failure domain information for the Azure platform. + Azure *[]AzureFailureDomainApplyConfiguration `json:"azure,omitempty"` + // gcp configures failure domain information for the GCP platform. + GCP *[]GCPFailureDomainApplyConfiguration `json:"gcp,omitempty"` + // vsphere configures failure domain information for the VSphere platform. + VSphere []VSphereFailureDomainApplyConfiguration `json:"vsphere,omitempty"` + // openstack configures failure domain information for the OpenStack platform. + OpenStack []OpenStackFailureDomainApplyConfiguration `json:"openstack,omitempty"` + // nutanix configures failure domain information for the Nutanix platform. + Nutanix []NutanixFailureDomainReferenceApplyConfiguration `json:"nutanix,omitempty"` +} + +// FailureDomainsApplyConfiguration constructs a declarative configuration of the FailureDomains type for use with +// apply. +func FailureDomains() *FailureDomainsApplyConfiguration { + return &FailureDomainsApplyConfiguration{} +} + +// WithPlatform sets the Platform field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Platform field is set to the value of the last call. +func (b *FailureDomainsApplyConfiguration) WithPlatform(value configv1.PlatformType) *FailureDomainsApplyConfiguration { + b.Platform = &value + return b +} + +func (b *FailureDomainsApplyConfiguration) ensureAWSFailureDomainApplyConfigurationExists() { + if b.AWS == nil { + b.AWS = &[]AWSFailureDomainApplyConfiguration{} + } +} + +// WithAWS adds the given value to the AWS field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AWS field. +func (b *FailureDomainsApplyConfiguration) WithAWS(values ...*AWSFailureDomainApplyConfiguration) *FailureDomainsApplyConfiguration { + b.ensureAWSFailureDomainApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAWS") + } + *b.AWS = append(*b.AWS, *values[i]) + } + return b +} + +func (b *FailureDomainsApplyConfiguration) ensureAzureFailureDomainApplyConfigurationExists() { + if b.Azure == nil { + b.Azure = &[]AzureFailureDomainApplyConfiguration{} + } +} + +// WithAzure adds the given value to the Azure field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Azure field. +func (b *FailureDomainsApplyConfiguration) WithAzure(values ...*AzureFailureDomainApplyConfiguration) *FailureDomainsApplyConfiguration { + b.ensureAzureFailureDomainApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAzure") + } + *b.Azure = append(*b.Azure, *values[i]) + } + return b +} + +func (b *FailureDomainsApplyConfiguration) ensureGCPFailureDomainApplyConfigurationExists() { + if b.GCP == nil { + b.GCP = &[]GCPFailureDomainApplyConfiguration{} + } +} + +// WithGCP adds the given value to the GCP field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the GCP field. +func (b *FailureDomainsApplyConfiguration) WithGCP(values ...*GCPFailureDomainApplyConfiguration) *FailureDomainsApplyConfiguration { + b.ensureGCPFailureDomainApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithGCP") + } + *b.GCP = append(*b.GCP, *values[i]) + } + return b +} + +// WithVSphere adds the given value to the VSphere field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VSphere field. +func (b *FailureDomainsApplyConfiguration) WithVSphere(values ...*VSphereFailureDomainApplyConfiguration) *FailureDomainsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVSphere") + } + b.VSphere = append(b.VSphere, *values[i]) + } + return b +} + +// WithOpenStack adds the given value to the OpenStack field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OpenStack field. +func (b *FailureDomainsApplyConfiguration) WithOpenStack(values ...*OpenStackFailureDomainApplyConfiguration) *FailureDomainsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOpenStack") + } + b.OpenStack = append(b.OpenStack, *values[i]) + } + return b +} + +// WithNutanix adds the given value to the Nutanix field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Nutanix field. +func (b *FailureDomainsApplyConfiguration) WithNutanix(values ...*NutanixFailureDomainReferenceApplyConfiguration) *FailureDomainsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithNutanix") + } + b.Nutanix = append(b.Nutanix, *values[i]) + } + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/gcpfailuredomain.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/gcpfailuredomain.go new file mode 100644 index 0000000000..c89dee95d3 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/gcpfailuredomain.go @@ -0,0 +1,26 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// GCPFailureDomainApplyConfiguration represents a declarative configuration of the GCPFailureDomain type for use +// with apply. +// +// GCPFailureDomain configures failure domain information for the GCP platform +type GCPFailureDomainApplyConfiguration struct { + // zone is the zone in which the GCP machine provider will create the VM. + Zone *string `json:"zone,omitempty"` +} + +// GCPFailureDomainApplyConfiguration constructs a declarative configuration of the GCPFailureDomain type for use with +// apply. +func GCPFailureDomain() *GCPFailureDomainApplyConfiguration { + return &GCPFailureDomainApplyConfiguration{} +} + +// WithZone sets the Zone field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Zone field is set to the value of the last call. +func (b *GCPFailureDomainApplyConfiguration) WithZone(value string) *GCPFailureDomainApplyConfiguration { + b.Zone = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/nutanixfailuredomainreference.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/nutanixfailuredomainreference.go new file mode 100644 index 0000000000..01fbe8ab3f --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/nutanixfailuredomainreference.go @@ -0,0 +1,27 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// NutanixFailureDomainReferenceApplyConfiguration represents a declarative configuration of the NutanixFailureDomainReference type for use +// with apply. +// +// NutanixFailureDomainReference refers to the failure domain of the Nutanix platform. +type NutanixFailureDomainReferenceApplyConfiguration struct { + // name of the failure domain in which the nutanix machine provider will create the VM. + // Failure domains are defined in a cluster's config.openshift.io/Infrastructure resource. + Name *string `json:"name,omitempty"` +} + +// NutanixFailureDomainReferenceApplyConfiguration constructs a declarative configuration of the NutanixFailureDomainReference type for use with +// apply. +func NutanixFailureDomainReference() *NutanixFailureDomainReferenceApplyConfiguration { + return &NutanixFailureDomainReferenceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NutanixFailureDomainReferenceApplyConfiguration) WithName(value string) *NutanixFailureDomainReferenceApplyConfiguration { + b.Name = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/openshiftmachinev1beta1machinetemplate.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/openshiftmachinev1beta1machinetemplate.go new file mode 100644 index 0000000000..5600d43eba --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/openshiftmachinev1beta1machinetemplate.go @@ -0,0 +1,62 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1beta1 "github.com/openshift/client-go/machine/applyconfigurations/machine/v1beta1" +) + +// OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration represents a declarative configuration of the OpenShiftMachineV1Beta1MachineTemplate type for use +// with apply. +// +// OpenShiftMachineV1Beta1MachineTemplate is a template for the ControlPlaneMachineSet to create +// Machines from the v1beta1.machine.openshift.io API group. +type OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration struct { + // failureDomains is the list of failure domains (sometimes called + // availability zones) in which the ControlPlaneMachineSet should balance + // the Control Plane Machines. + // This will be merged into the ProviderSpec given in the template. + // This field is optional on platforms that do not require placement information. + FailureDomains *FailureDomainsApplyConfiguration `json:"failureDomains,omitempty"` + // ObjectMeta is the standard object metadata + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // Labels are required to match the ControlPlaneMachineSet selector. + ObjectMeta *ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec contains the desired configuration of the Control Plane Machines. + // The ProviderSpec within contains platform specific details + // for creating the Control Plane Machines. + // The ProviderSe should be complete apart from the platform specific + // failure domain field. This will be overridden when the Machines + // are created based on the FailureDomains field. + Spec *v1beta1.MachineSpecApplyConfiguration `json:"spec,omitempty"` +} + +// OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration constructs a declarative configuration of the OpenShiftMachineV1Beta1MachineTemplate type for use with +// apply. +func OpenShiftMachineV1Beta1MachineTemplate() *OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration { + return &OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration{} +} + +// WithFailureDomains sets the FailureDomains field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailureDomains field is set to the value of the last call. +func (b *OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration) WithFailureDomains(value *FailureDomainsApplyConfiguration) *OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration { + b.FailureDomains = value + return b +} + +// WithObjectMeta sets the ObjectMeta field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObjectMeta field is set to the value of the last call. +func (b *OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration) WithObjectMeta(value *ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration) *OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration { + b.ObjectMeta = value + return b +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration) WithSpec(value *v1beta1.MachineSpecApplyConfiguration) *OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration { + b.Spec = value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/openstackfailuredomain.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/openstackfailuredomain.go new file mode 100644 index 0000000000..0642fe120d --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/openstackfailuredomain.go @@ -0,0 +1,42 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// OpenStackFailureDomainApplyConfiguration represents a declarative configuration of the OpenStackFailureDomain type for use +// with apply. +// +// OpenStackFailureDomain configures failure domain information for the OpenStack platform. +type OpenStackFailureDomainApplyConfiguration struct { + // availabilityZone is the nova availability zone in which the OpenStack machine provider will create the VM. + // If not specified, the VM will be created in the default availability zone specified in the nova configuration. + // Availability zone names must NOT contain : since it is used by admin users to specify hosts where instances + // are launched in server creation. Also, it must not contain spaces otherwise it will lead to node that belongs + // to this availability zone register failure, see kubernetes/cloud-provider-openstack#1379 for further information. + // The maximum length of availability zone name is 63 as per labels limits. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // rootVolume contains settings that will be used by the OpenStack machine provider to create the root volume attached to the VM. + // If not specified, no root volume will be created. + RootVolume *RootVolumeApplyConfiguration `json:"rootVolume,omitempty"` +} + +// OpenStackFailureDomainApplyConfiguration constructs a declarative configuration of the OpenStackFailureDomain type for use with +// apply. +func OpenStackFailureDomain() *OpenStackFailureDomainApplyConfiguration { + return &OpenStackFailureDomainApplyConfiguration{} +} + +// WithAvailabilityZone sets the AvailabilityZone field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailabilityZone field is set to the value of the last call. +func (b *OpenStackFailureDomainApplyConfiguration) WithAvailabilityZone(value string) *OpenStackFailureDomainApplyConfiguration { + b.AvailabilityZone = &value + return b +} + +// WithRootVolume sets the RootVolume field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RootVolume field is set to the value of the last call. +func (b *OpenStackFailureDomainApplyConfiguration) WithRootVolume(value *RootVolumeApplyConfiguration) *OpenStackFailureDomainApplyConfiguration { + b.RootVolume = value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/rootvolume.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/rootvolume.go new file mode 100644 index 0000000000..5173e7f80a --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/rootvolume.go @@ -0,0 +1,47 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// RootVolumeApplyConfiguration represents a declarative configuration of the RootVolume type for use +// with apply. +// +// RootVolume represents the volume metadata to boot from. +// The original RootVolume struct is defined in the v1alpha1 but it's not best practice to use it directly here so we define a new one +// that should stay in sync with the original one. +type RootVolumeApplyConfiguration struct { + // availabilityZone specifies the Cinder availability zone where the root volume will be created. + // If not specifified, the root volume will be created in the availability zone specified by the volume type in the cinder configuration. + // If the volume type (configured in the OpenStack cluster) does not specify an availability zone, the root volume will be created in the default availability + // zone specified in the cinder configuration. See https://docs.openstack.org/cinder/latest/admin/availability-zone-type.html for more details. + // If the OpenStack cluster is deployed with the cross_az_attach configuration option set to false, the root volume will have to be in the same + // availability zone as the VM (defined by OpenStackFailureDomain.AvailabilityZone). + // Availability zone names must NOT contain spaces otherwise it will lead to volume that belongs to this availability zone register failure, + // see kubernetes/cloud-provider-openstack#1379 for further information. + // The maximum length of availability zone name is 63 as per labels limits. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // volumeType specifies the type of the root volume that will be provisioned. + // The maximum length of a volume type name is 255 characters, as per the OpenStack limit. + VolumeType *string `json:"volumeType,omitempty"` +} + +// RootVolumeApplyConfiguration constructs a declarative configuration of the RootVolume type for use with +// apply. +func RootVolume() *RootVolumeApplyConfiguration { + return &RootVolumeApplyConfiguration{} +} + +// WithAvailabilityZone sets the AvailabilityZone field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailabilityZone field is set to the value of the last call. +func (b *RootVolumeApplyConfiguration) WithAvailabilityZone(value string) *RootVolumeApplyConfiguration { + b.AvailabilityZone = &value + return b +} + +// WithVolumeType sets the VolumeType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeType field is set to the value of the last call. +func (b *RootVolumeApplyConfiguration) WithVolumeType(value string) *RootVolumeApplyConfiguration { + b.VolumeType = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/vspherefailuredomain.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/vspherefailuredomain.go new file mode 100644 index 0000000000..ef1cb9da8e --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/machine/v1/vspherefailuredomain.go @@ -0,0 +1,29 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// VSphereFailureDomainApplyConfiguration represents a declarative configuration of the VSphereFailureDomain type for use +// with apply. +// +// VSphereFailureDomain configures failure domain information for the vSphere platform +type VSphereFailureDomainApplyConfiguration struct { + // name of the failure domain in which the vSphere machine provider will create the VM. + // Failure domains are defined in a cluster's config.openshift.io/Infrastructure resource. + // When balancing machines across failure domains, the control plane machine set will inject configuration from the + // Infrastructure resource into the machine providerSpec to allocate the machine to a failure domain. + Name *string `json:"name,omitempty"` +} + +// VSphereFailureDomainApplyConfiguration constructs a declarative configuration of the VSphereFailureDomain type for use with +// apply. +func VSphereFailureDomain() *VSphereFailureDomainApplyConfiguration { + return &VSphereFailureDomainApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VSphereFailureDomainApplyConfiguration) WithName(value string) *VSphereFailureDomainApplyConfiguration { + b.Name = &value + return b +} diff --git a/vendor/github.com/openshift/client-go/machine/applyconfigurations/utils.go b/vendor/github.com/openshift/client-go/machine/applyconfigurations/utils.go new file mode 100644 index 0000000000..e0e83b626e --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/applyconfigurations/utils.go @@ -0,0 +1,100 @@ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package applyconfigurations + +import ( + v1 "github.com/openshift/api/machine/v1" + v1beta1 "github.com/openshift/api/machine/v1beta1" + internal "github.com/openshift/client-go/machine/applyconfigurations/internal" + machinev1 "github.com/openshift/client-go/machine/applyconfigurations/machine/v1" + machinev1beta1 "github.com/openshift/client-go/machine/applyconfigurations/machine/v1beta1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no +// apply configuration type exists for the given GroupVersionKind. +func ForKind(kind schema.GroupVersionKind) interface{} { + switch kind { + // Group=machine.openshift.io, Version=v1 + case v1.SchemeGroupVersion.WithKind("AWSFailureDomain"): + return &machinev1.AWSFailureDomainApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("AWSFailureDomainPlacement"): + return &machinev1.AWSFailureDomainPlacementApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("AWSResourceFilter"): + return &machinev1.AWSResourceFilterApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("AWSResourceReference"): + return &machinev1.AWSResourceReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("AzureFailureDomain"): + return &machinev1.AzureFailureDomainApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ControlPlaneMachineSet"): + return &machinev1.ControlPlaneMachineSetApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ControlPlaneMachineSetSpec"): + return &machinev1.ControlPlaneMachineSetSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ControlPlaneMachineSetStatus"): + return &machinev1.ControlPlaneMachineSetStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ControlPlaneMachineSetStrategy"): + return &machinev1.ControlPlaneMachineSetStrategyApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ControlPlaneMachineSetTemplate"): + return &machinev1.ControlPlaneMachineSetTemplateApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ControlPlaneMachineSetTemplateObjectMeta"): + return &machinev1.ControlPlaneMachineSetTemplateObjectMetaApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("FailureDomains"): + return &machinev1.FailureDomainsApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("GCPFailureDomain"): + return &machinev1.GCPFailureDomainApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("NutanixFailureDomainReference"): + return &machinev1.NutanixFailureDomainReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("OpenShiftMachineV1Beta1MachineTemplate"): + return &machinev1.OpenShiftMachineV1Beta1MachineTemplateApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("OpenStackFailureDomain"): + return &machinev1.OpenStackFailureDomainApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("RootVolume"): + return &machinev1.RootVolumeApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("VSphereFailureDomain"): + return &machinev1.VSphereFailureDomainApplyConfiguration{} + + // Group=machine.openshift.io, Version=v1beta1 + case v1beta1.SchemeGroupVersion.WithKind("Condition"): + return &machinev1beta1.ConditionApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("LastOperation"): + return &machinev1beta1.LastOperationApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("LifecycleHook"): + return &machinev1beta1.LifecycleHookApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("LifecycleHooks"): + return &machinev1beta1.LifecycleHooksApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("Machine"): + return &machinev1beta1.MachineApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MachineHealthCheck"): + return &machinev1beta1.MachineHealthCheckApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MachineHealthCheckSpec"): + return &machinev1beta1.MachineHealthCheckSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MachineHealthCheckStatus"): + return &machinev1beta1.MachineHealthCheckStatusApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MachineSet"): + return &machinev1beta1.MachineSetApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MachineSetSpec"): + return &machinev1beta1.MachineSetSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MachineSetStatus"): + return &machinev1beta1.MachineSetStatusApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MachineSpec"): + return &machinev1beta1.MachineSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MachineStatus"): + return &machinev1beta1.MachineStatusApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("MachineTemplateSpec"): + return &machinev1beta1.MachineTemplateSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("ObjectMeta"): + return &machinev1beta1.ObjectMetaApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("ProviderSpec"): + return &machinev1beta1.ProviderSpecApplyConfiguration{} + case v1beta1.SchemeGroupVersion.WithKind("UnhealthyCondition"): + return &machinev1beta1.UnhealthyConditionApplyConfiguration{} + + } + return nil +} + +func NewTypeConverter(scheme *runtime.Scheme) managedfields.TypeConverter { + return managedfields.NewSchemeTypeConverter(scheme, internal.Parser()) +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/clientset.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/clientset.go new file mode 100644 index 0000000000..dbfaf7d27a --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/clientset.go @@ -0,0 +1,117 @@ +// Code generated by client-gen. DO NOT EDIT. + +package versioned + +import ( + fmt "fmt" + http "net/http" + + machinev1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1" + machinev1beta1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + MachineV1() machinev1.MachineV1Interface + MachineV1beta1() machinev1beta1.MachineV1beta1Interface +} + +// Clientset contains the clients for groups. +type Clientset struct { + *discovery.DiscoveryClient + machineV1 *machinev1.MachineV1Client + machineV1beta1 *machinev1beta1.MachineV1beta1Client +} + +// MachineV1 retrieves the MachineV1Client +func (c *Clientset) MachineV1() machinev1.MachineV1Interface { + return c.machineV1 +} + +// MachineV1beta1 retrieves the MachineV1beta1Client +func (c *Clientset) MachineV1beta1() machinev1beta1.MachineV1beta1Interface { + return c.machineV1beta1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + + var cs Clientset + var err error + cs.machineV1, err = machinev1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.machineV1beta1, err = machinev1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + cs, err := NewForConfig(c) + if err != nil { + panic(err) + } + return cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.machineV1 = machinev1.New(c) + cs.machineV1beta1 = machinev1beta1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/fake/clientset_generated.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/fake/clientset_generated.go new file mode 100644 index 0000000000..6f4c36c24e --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/fake/clientset_generated.go @@ -0,0 +1,133 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + applyconfigurations "github.com/openshift/client-go/machine/applyconfigurations" + clientset "github.com/openshift/client-go/machine/clientset/versioned" + machinev1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1" + fakemachinev1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake" + machinev1beta1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1" + fakemachinev1beta1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/discovery" + fakediscovery "k8s.io/client-go/discovery/fake" + "k8s.io/client-go/testing" +) + +// NewSimpleClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any field management, validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +func NewSimpleClientset(objects ...runtime.Object) *Clientset { + o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + var opts metav1.ListOptions + if watchAction, ok := action.(testing.WatchActionImpl); ok { + opts = watchAction.ListOptions + } + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns, opts) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +// Clientset implements clientset.Interface. Meant to be embedded into a +// struct to get a default implementation. This makes faking out just the method +// you want to test easier. +type Clientset struct { + testing.Fake + discovery *fakediscovery.FakeDiscovery + tracker testing.ObjectTracker +} + +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + return c.discovery +} + +func (c *Clientset) Tracker() testing.ObjectTracker { + return c.tracker +} + +// IsWatchListSemanticsUnSupported informs the reflector that this client +// doesn't support WatchList semantics. +// +// This is a synthetic method whose sole purpose is to satisfy the optional +// interface check performed by the reflector. +// Returning true signals that WatchList can NOT be used. +// No additional logic is implemented here. +func (c *Clientset) IsWatchListSemanticsUnSupported() bool { + return true +} + +// NewClientset returns a clientset that will respond with the provided objects. +// It's backed by a very simple object tracker that processes creates, updates and deletions as-is, +// without applying any validations and/or defaults. It shouldn't be considered a replacement +// for a real clientset and is mostly useful in simple unit tests. +// +// Compared to NewSimpleClientset, the Clientset returned here supports field tracking and thus +// server-side apply. Beware though that support in that for CRDs is missing +// (https://github.com/kubernetes/kubernetes/issues/126850). +func NewClientset(objects ...runtime.Object) *Clientset { + o := testing.NewFieldManagedObjectTracker( + scheme, + codecs.UniversalDecoder(), + applyconfigurations.NewTypeConverter(scheme), + ) + for _, obj := range objects { + if err := o.Add(obj); err != nil { + panic(err) + } + } + + cs := &Clientset{tracker: o} + cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} + cs.AddReactor("*", "*", testing.ObjectReaction(o)) + cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + var opts metav1.ListOptions + if watchAction, ok := action.(testing.WatchActionImpl); ok { + opts = watchAction.ListOptions + } + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns, opts) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) + + return cs +} + +var ( + _ clientset.Interface = &Clientset{} + _ testing.FakeClient = &Clientset{} +) + +// MachineV1 retrieves the MachineV1Client +func (c *Clientset) MachineV1() machinev1.MachineV1Interface { + return &fakemachinev1.FakeMachineV1{Fake: &c.Fake} +} + +// MachineV1beta1 retrieves the MachineV1beta1Client +func (c *Clientset) MachineV1beta1() machinev1beta1.MachineV1beta1Interface { + return &fakemachinev1beta1.FakeMachineV1beta1{Fake: &c.Fake} +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/fake/doc.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/fake/doc.go new file mode 100644 index 0000000000..3630ed1cd1 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/fake/doc.go @@ -0,0 +1,4 @@ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated fake clientset. +package fake diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/fake/register.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/fake/register.go new file mode 100644 index 0000000000..f9ffa0cc98 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/fake/register.go @@ -0,0 +1,42 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + machinev1 "github.com/openshift/api/machine/v1" + machinev1beta1 "github.com/openshift/api/machine/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var scheme = runtime.NewScheme() +var codecs = serializer.NewCodecFactory(scheme) + +var localSchemeBuilder = runtime.SchemeBuilder{ + machinev1.AddToScheme, + machinev1beta1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(scheme)) +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/controlplanemachineset.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/controlplanemachineset.go new file mode 100644 index 0000000000..bd66c772f7 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/controlplanemachineset.go @@ -0,0 +1,58 @@ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + machinev1 "github.com/openshift/api/machine/v1" + applyconfigurationsmachinev1 "github.com/openshift/client-go/machine/applyconfigurations/machine/v1" + scheme "github.com/openshift/client-go/machine/clientset/versioned/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// ControlPlaneMachineSetsGetter has a method to return a ControlPlaneMachineSetInterface. +// A group's client should implement this interface. +type ControlPlaneMachineSetsGetter interface { + ControlPlaneMachineSets(namespace string) ControlPlaneMachineSetInterface +} + +// ControlPlaneMachineSetInterface has methods to work with ControlPlaneMachineSet resources. +type ControlPlaneMachineSetInterface interface { + Create(ctx context.Context, controlPlaneMachineSet *machinev1.ControlPlaneMachineSet, opts metav1.CreateOptions) (*machinev1.ControlPlaneMachineSet, error) + Update(ctx context.Context, controlPlaneMachineSet *machinev1.ControlPlaneMachineSet, opts metav1.UpdateOptions) (*machinev1.ControlPlaneMachineSet, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, controlPlaneMachineSet *machinev1.ControlPlaneMachineSet, opts metav1.UpdateOptions) (*machinev1.ControlPlaneMachineSet, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*machinev1.ControlPlaneMachineSet, error) + List(ctx context.Context, opts metav1.ListOptions) (*machinev1.ControlPlaneMachineSetList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *machinev1.ControlPlaneMachineSet, err error) + Apply(ctx context.Context, controlPlaneMachineSet *applyconfigurationsmachinev1.ControlPlaneMachineSetApplyConfiguration, opts metav1.ApplyOptions) (result *machinev1.ControlPlaneMachineSet, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, controlPlaneMachineSet *applyconfigurationsmachinev1.ControlPlaneMachineSetApplyConfiguration, opts metav1.ApplyOptions) (result *machinev1.ControlPlaneMachineSet, err error) + ControlPlaneMachineSetExpansion +} + +// controlPlaneMachineSets implements ControlPlaneMachineSetInterface +type controlPlaneMachineSets struct { + *gentype.ClientWithListAndApply[*machinev1.ControlPlaneMachineSet, *machinev1.ControlPlaneMachineSetList, *applyconfigurationsmachinev1.ControlPlaneMachineSetApplyConfiguration] +} + +// newControlPlaneMachineSets returns a ControlPlaneMachineSets +func newControlPlaneMachineSets(c *MachineV1Client, namespace string) *controlPlaneMachineSets { + return &controlPlaneMachineSets{ + gentype.NewClientWithListAndApply[*machinev1.ControlPlaneMachineSet, *machinev1.ControlPlaneMachineSetList, *applyconfigurationsmachinev1.ControlPlaneMachineSetApplyConfiguration]( + "controlplanemachinesets", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *machinev1.ControlPlaneMachineSet { return &machinev1.ControlPlaneMachineSet{} }, + func() *machinev1.ControlPlaneMachineSetList { return &machinev1.ControlPlaneMachineSetList{} }, + ), + } +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/doc.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/doc.go new file mode 100644 index 0000000000..225e6b2be3 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/doc.go @@ -0,0 +1,4 @@ +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake/doc.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake/doc.go new file mode 100644 index 0000000000..2b5ba4c8e4 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake/doc.go @@ -0,0 +1,4 @@ +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake/fake_controlplanemachineset.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake/fake_controlplanemachineset.go new file mode 100644 index 0000000000..f70c87741c --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake/fake_controlplanemachineset.go @@ -0,0 +1,37 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "github.com/openshift/api/machine/v1" + machinev1 "github.com/openshift/client-go/machine/applyconfigurations/machine/v1" + typedmachinev1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1" + gentype "k8s.io/client-go/gentype" +) + +// fakeControlPlaneMachineSets implements ControlPlaneMachineSetInterface +type fakeControlPlaneMachineSets struct { + *gentype.FakeClientWithListAndApply[*v1.ControlPlaneMachineSet, *v1.ControlPlaneMachineSetList, *machinev1.ControlPlaneMachineSetApplyConfiguration] + Fake *FakeMachineV1 +} + +func newFakeControlPlaneMachineSets(fake *FakeMachineV1, namespace string) typedmachinev1.ControlPlaneMachineSetInterface { + return &fakeControlPlaneMachineSets{ + gentype.NewFakeClientWithListAndApply[*v1.ControlPlaneMachineSet, *v1.ControlPlaneMachineSetList, *machinev1.ControlPlaneMachineSetApplyConfiguration]( + fake.Fake, + namespace, + v1.SchemeGroupVersion.WithResource("controlplanemachinesets"), + v1.SchemeGroupVersion.WithKind("ControlPlaneMachineSet"), + func() *v1.ControlPlaneMachineSet { return &v1.ControlPlaneMachineSet{} }, + func() *v1.ControlPlaneMachineSetList { return &v1.ControlPlaneMachineSetList{} }, + func(dst, src *v1.ControlPlaneMachineSetList) { dst.ListMeta = src.ListMeta }, + func(list *v1.ControlPlaneMachineSetList) []*v1.ControlPlaneMachineSet { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1.ControlPlaneMachineSetList, items []*v1.ControlPlaneMachineSet) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake/fake_machine_client.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake/fake_machine_client.go new file mode 100644 index 0000000000..d78dc16eb8 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake/fake_machine_client.go @@ -0,0 +1,24 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeMachineV1 struct { + *testing.Fake +} + +func (c *FakeMachineV1) ControlPlaneMachineSets(namespace string) v1.ControlPlaneMachineSetInterface { + return newFakeControlPlaneMachineSets(c, namespace) +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeMachineV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/generated_expansion.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/generated_expansion.go new file mode 100644 index 0000000000..6ff020361e --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/generated_expansion.go @@ -0,0 +1,5 @@ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type ControlPlaneMachineSetExpansion interface{} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/machine_client.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/machine_client.go new file mode 100644 index 0000000000..17e942b7a6 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/machine_client.go @@ -0,0 +1,85 @@ +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + http "net/http" + + machinev1 "github.com/openshift/api/machine/v1" + scheme "github.com/openshift/client-go/machine/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type MachineV1Interface interface { + RESTClient() rest.Interface + ControlPlaneMachineSetsGetter +} + +// MachineV1Client is used to interact with features provided by the machine.openshift.io group. +type MachineV1Client struct { + restClient rest.Interface +} + +func (c *MachineV1Client) ControlPlaneMachineSets(namespace string) ControlPlaneMachineSetInterface { + return newControlPlaneMachineSets(c, namespace) +} + +// NewForConfig creates a new MachineV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*MachineV1Client, error) { + config := *c + setConfigDefaults(&config) + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new MachineV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*MachineV1Client, error) { + config := *c + setConfigDefaults(&config) + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &MachineV1Client{client}, nil +} + +// NewForConfigOrDie creates a new MachineV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *MachineV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new MachineV1Client for the given RESTClient. +func New(c rest.Interface) *MachineV1Client { + return &MachineV1Client{c} +} + +func setConfigDefaults(config *rest.Config) { + gv := machinev1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *MachineV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/doc.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/doc.go new file mode 100644 index 0000000000..2b5ba4c8e4 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/doc.go @@ -0,0 +1,4 @@ +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machine.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machine.go new file mode 100644 index 0000000000..3659217ade --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machine.go @@ -0,0 +1,35 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/openshift/api/machine/v1beta1" + machinev1beta1 "github.com/openshift/client-go/machine/applyconfigurations/machine/v1beta1" + typedmachinev1beta1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1" + gentype "k8s.io/client-go/gentype" +) + +// fakeMachines implements MachineInterface +type fakeMachines struct { + *gentype.FakeClientWithListAndApply[*v1beta1.Machine, *v1beta1.MachineList, *machinev1beta1.MachineApplyConfiguration] + Fake *FakeMachineV1beta1 +} + +func newFakeMachines(fake *FakeMachineV1beta1, namespace string) typedmachinev1beta1.MachineInterface { + return &fakeMachines{ + gentype.NewFakeClientWithListAndApply[*v1beta1.Machine, *v1beta1.MachineList, *machinev1beta1.MachineApplyConfiguration]( + fake.Fake, + namespace, + v1beta1.SchemeGroupVersion.WithResource("machines"), + v1beta1.SchemeGroupVersion.WithKind("Machine"), + func() *v1beta1.Machine { return &v1beta1.Machine{} }, + func() *v1beta1.MachineList { return &v1beta1.MachineList{} }, + func(dst, src *v1beta1.MachineList) { dst.ListMeta = src.ListMeta }, + func(list *v1beta1.MachineList) []*v1beta1.Machine { return gentype.ToPointerSlice(list.Items) }, + func(list *v1beta1.MachineList, items []*v1beta1.Machine) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machine_client.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machine_client.go new file mode 100644 index 0000000000..205fe6f8a1 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machine_client.go @@ -0,0 +1,32 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeMachineV1beta1 struct { + *testing.Fake +} + +func (c *FakeMachineV1beta1) Machines(namespace string) v1beta1.MachineInterface { + return newFakeMachines(c, namespace) +} + +func (c *FakeMachineV1beta1) MachineHealthChecks(namespace string) v1beta1.MachineHealthCheckInterface { + return newFakeMachineHealthChecks(c, namespace) +} + +func (c *FakeMachineV1beta1) MachineSets(namespace string) v1beta1.MachineSetInterface { + return newFakeMachineSets(c, namespace) +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeMachineV1beta1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machinehealthcheck.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machinehealthcheck.go new file mode 100644 index 0000000000..eccd715dd6 --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machinehealthcheck.go @@ -0,0 +1,37 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/openshift/api/machine/v1beta1" + machinev1beta1 "github.com/openshift/client-go/machine/applyconfigurations/machine/v1beta1" + typedmachinev1beta1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1" + gentype "k8s.io/client-go/gentype" +) + +// fakeMachineHealthChecks implements MachineHealthCheckInterface +type fakeMachineHealthChecks struct { + *gentype.FakeClientWithListAndApply[*v1beta1.MachineHealthCheck, *v1beta1.MachineHealthCheckList, *machinev1beta1.MachineHealthCheckApplyConfiguration] + Fake *FakeMachineV1beta1 +} + +func newFakeMachineHealthChecks(fake *FakeMachineV1beta1, namespace string) typedmachinev1beta1.MachineHealthCheckInterface { + return &fakeMachineHealthChecks{ + gentype.NewFakeClientWithListAndApply[*v1beta1.MachineHealthCheck, *v1beta1.MachineHealthCheckList, *machinev1beta1.MachineHealthCheckApplyConfiguration]( + fake.Fake, + namespace, + v1beta1.SchemeGroupVersion.WithResource("machinehealthchecks"), + v1beta1.SchemeGroupVersion.WithKind("MachineHealthCheck"), + func() *v1beta1.MachineHealthCheck { return &v1beta1.MachineHealthCheck{} }, + func() *v1beta1.MachineHealthCheckList { return &v1beta1.MachineHealthCheckList{} }, + func(dst, src *v1beta1.MachineHealthCheckList) { dst.ListMeta = src.ListMeta }, + func(list *v1beta1.MachineHealthCheckList) []*v1beta1.MachineHealthCheck { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1beta1.MachineHealthCheckList, items []*v1beta1.MachineHealthCheck) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machineset.go b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machineset.go new file mode 100644 index 0000000000..43b196ff2a --- /dev/null +++ b/vendor/github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake/fake_machineset.go @@ -0,0 +1,35 @@ +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta1 "github.com/openshift/api/machine/v1beta1" + machinev1beta1 "github.com/openshift/client-go/machine/applyconfigurations/machine/v1beta1" + typedmachinev1beta1 "github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1" + gentype "k8s.io/client-go/gentype" +) + +// fakeMachineSets implements MachineSetInterface +type fakeMachineSets struct { + *gentype.FakeClientWithListAndApply[*v1beta1.MachineSet, *v1beta1.MachineSetList, *machinev1beta1.MachineSetApplyConfiguration] + Fake *FakeMachineV1beta1 +} + +func newFakeMachineSets(fake *FakeMachineV1beta1, namespace string) typedmachinev1beta1.MachineSetInterface { + return &fakeMachineSets{ + gentype.NewFakeClientWithListAndApply[*v1beta1.MachineSet, *v1beta1.MachineSetList, *machinev1beta1.MachineSetApplyConfiguration]( + fake.Fake, + namespace, + v1beta1.SchemeGroupVersion.WithResource("machinesets"), + v1beta1.SchemeGroupVersion.WithKind("MachineSet"), + func() *v1beta1.MachineSet { return &v1beta1.MachineSet{} }, + func() *v1beta1.MachineSetList { return &v1beta1.MachineSetList{} }, + func(dst, src *v1beta1.MachineSetList) { dst.ListMeta = src.ListMeta }, + func(list *v1beta1.MachineSetList) []*v1beta1.MachineSet { return gentype.ToPointerSlice(list.Items) }, + func(list *v1beta1.MachineSetList, items []*v1beta1.MachineSet) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 58821c7407..3860ba62a6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -332,10 +332,17 @@ github.com/openshift/client-go/image/applyconfigurations/image/v1 github.com/openshift/client-go/image/applyconfigurations/internal github.com/openshift/client-go/image/clientset/versioned/scheme github.com/openshift/client-go/image/clientset/versioned/typed/image/v1 +github.com/openshift/client-go/machine/applyconfigurations github.com/openshift/client-go/machine/applyconfigurations/internal +github.com/openshift/client-go/machine/applyconfigurations/machine/v1 github.com/openshift/client-go/machine/applyconfigurations/machine/v1beta1 +github.com/openshift/client-go/machine/clientset/versioned +github.com/openshift/client-go/machine/clientset/versioned/fake github.com/openshift/client-go/machine/clientset/versioned/scheme +github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1 +github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1/fake github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1 +github.com/openshift/client-go/machine/clientset/versioned/typed/machine/v1beta1/fake github.com/openshift/client-go/operator/applyconfigurations github.com/openshift/client-go/operator/applyconfigurations/internal github.com/openshift/client-go/operator/applyconfigurations/operator/v1