From e6fa01e907d7beac4f74d4395a63e768f993e468 Mon Sep 17 00:00:00 2001 From: Nick Carboni Date: Wed, 14 Sep 2022 01:36:57 -0400 Subject: [PATCH] MGMT-10968: Replace agentmachine finalizer with machine pre-delete hook (#54) * Update assisted-service api and models to latest * Watch for updates to machines related to an agentmachine * Return machine from newAgentMachine test helper * Replace agentmachine finalizer with machine pre-delete hook Previously when a machine was deleted CAPI would cordon/drain the node, then wait on the finalizer for our agentmachine resource. This chain of events doesn't allow assisted-service time to run a pod on the node to reboot it into discovery. This commit adds a PreTerminateDeleteHook to the machine resource instead of a finalizer on the agent machine. When the agentmachine controller sees that the machine is waiting on the hook, it unbinds the agent and waits for the assisted-service to complete the reclaim work. Once the reclaim has completed or failed, the agentmachine controller removes the hook annotation. This requires specifically the PreTerminateDeleteHook rather than the PreDrain one because once we start the agent on the cluster we won't get a chance to drain the node before it is rebooted into discovery. https://issues.redhat.com/browse/MGMT-10968 --- controllers/agentmachine_controller.go | 191 +++++++++---- controllers/agentmachine_controller_test.go | 211 +++++++++++--- go.mod | 11 +- go.sum | 8 +- .../v1beta1/agentclusterinstall_types.go | 40 ++- .../v1beta1/zz_generated.deepcopy.go | 10 + .../api/v1beta1/agentclassification_types.go | 83 ++++++ .../api/v1beta1/agentserviceconfig_types.go | 23 ++ .../api/v1beta1/infraenv_types.go | 22 ++ .../api/v1beta1/zz_generated.deepcopy.go | 96 +++++++ .../models/api_vip_connectivity_response.go | 14 +- .../assisted-service/models/cluster.go | 22 +- .../models/cluster_create_params.go | 3 + .../models/cluster_default_config.go | 239 +++++++++++++++- .../models/cluster_network.go | 4 +- .../models/connectivity_check_nic.go | 47 +++- .../container_image_availability_request.go | 9 + .../openshift/assisted-service/models/disk.go | 47 +++- .../models/disk_skip_formatting_params.go | 88 ++++++ .../models/domain_resolution_request.go | 5 + .../models/download_boot_artifacts_request.go | 105 +++++++ .../assisted-service/models/drive_type.go | 98 +++++++ .../models/feature_support_level.go | 10 +- .../openshift/assisted-service/models/host.go | 102 ++++++- .../models/host_update_params.go | 114 ++++++++ .../models/host_validation_id.go | 23 +- .../models/install_cmd_request.go | 38 ++- .../assisted-service/models/interface.go | 3 + .../assisted-service/models/inventory.go | 3 - .../models/machine_network.go | 4 +- .../models/next_step_cmd_request.go | 5 + .../models/node_label_params.go | 88 ++++++ .../assisted-service/models/os_image.go | 17 -- .../assisted-service/models/ovirt_platform.go | 149 ---------- .../assisted-service/models/platform.go | 46 --- .../assisted-service/models/release_image.go | 5 +- .../assisted-service/models/route.go | 3 + .../models/service_network.go | 2 +- .../openshift/assisted-service/models/step.go | 3 - .../assisted-service/models/step_type.go | 14 +- .../models/tang_connectivity_request.go | 71 +++++ .../models/tang_connectivity_response.go | 266 ++++++++++++++++++ .../models/upgrade_agent_request.go | 52 ++++ .../models/upgrade_agent_response.go | 105 +++++++ .../models/upgrade_agent_result.go | 74 +++++ .../models/v2_cluster_update_params.go | 3 + vendor/modules.txt | 8 +- 47 files changed, 2236 insertions(+), 348 deletions(-) create mode 100644 vendor/github.com/openshift/assisted-service/api/v1beta1/agentclassification_types.go create mode 100644 vendor/github.com/openshift/assisted-service/models/disk_skip_formatting_params.go create mode 100644 vendor/github.com/openshift/assisted-service/models/download_boot_artifacts_request.go create mode 100644 vendor/github.com/openshift/assisted-service/models/drive_type.go create mode 100644 vendor/github.com/openshift/assisted-service/models/node_label_params.go delete mode 100644 vendor/github.com/openshift/assisted-service/models/ovirt_platform.go create mode 100644 vendor/github.com/openshift/assisted-service/models/tang_connectivity_request.go create mode 100644 vendor/github.com/openshift/assisted-service/models/tang_connectivity_response.go create mode 100644 vendor/github.com/openshift/assisted-service/models/upgrade_agent_request.go create mode 100644 vendor/github.com/openshift/assisted-service/models/upgrade_agent_response.go create mode 100644 vendor/github.com/openshift/assisted-service/models/upgrade_agent_result.go diff --git a/controllers/agentmachine_controller.go b/controllers/agentmachine_controller.go index 6b2aa555..f6b8bed6 100644 --- a/controllers/agentmachine_controller.go +++ b/controllers/agentmachine_controller.go @@ -23,10 +23,12 @@ import ( "fmt" "strconv" "strings" + "time" ignitionapi "github.com/coreos/ignition/v2/config/v3_1/types" "github.com/go-openapi/swag" aiv1beta1 "github.com/openshift/assisted-service/api/v1beta1" + aimodels "github.com/openshift/assisted-service/models" capiproviderv1alpha1 "github.com/openshift/cluster-api-provider-agent/api/v1alpha1" openshiftconditionsv1 "github.com/openshift/custom-resource-status/conditions/v1" "github.com/sirupsen/logrus" @@ -36,6 +38,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/selection" "k8s.io/apimachinery/pkg/types" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -53,6 +56,8 @@ const ( AgentMachineFinalizerName = "agentmachine." + aiv1beta1.Group + "/deprovision" AgentMachineRefLabelKey = "agentMachineRef" AgentMachineRefNamespace = "agentMachineRefNamespace" + + machineDeleteHookName = clusterv1.PreTerminateDeleteHookAnnotationPrefix + "/agentmachine" ) // AgentMachineReconciler reconciles a AgentMachine object @@ -89,16 +94,6 @@ func (r *AgentMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request return ctrl.Result{}, client.IgnoreNotFound(err) } - res, err := r.handleDeletionFinalizer(ctx, log, agentMachine) - if res != nil || err != nil { - return *res, err - } - - // If the AgentMachine is ready, we have nothing to do - if agentMachine.Status.Ready { - return ctrl.Result{}, nil - } - machine, err := clusterutil.GetOwnerMachine(ctx, r.Client, agentMachine.ObjectMeta) if err != nil { log.WithError(err).Error("failed to get owner machine") @@ -109,6 +104,16 @@ func (r *AgentMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request return r.updateStatus(ctx, log, agentMachine, ctrl.Result{}, nil) } + res, err := r.handleDeletionHook(ctx, log, agentMachine, machine) + if res != nil || err != nil { + return *res, err + } + + // If the AgentMachine is ready, we have nothing to do + if agentMachine.Status.Ready { + return ctrl.Result{}, nil + } + agentCluster, err := r.getAgentCluster(ctx, log, machine) if err != nil { return ctrl.Result{}, err @@ -141,51 +146,101 @@ func (r *AgentMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request return r.updateStatus(ctx, log, agentMachine, ctrl.Result{}, nil) } -func (r *AgentMachineReconciler) handleDeletionFinalizer(ctx context.Context, log logrus.FieldLogger, agentMachine *capiproviderv1alpha1.AgentMachine) (*ctrl.Result, error) { - if agentMachine.ObjectMeta.DeletionTimestamp.IsZero() { // AgentMachine not being deleted - // Register a finalizer if it is absent. - if !funk.ContainsString(agentMachine.GetFinalizers(), AgentMachineFinalizerName) { - controllerutil.AddFinalizer(agentMachine, AgentMachineFinalizerName) - if err := r.Update(ctx, agentMachine); err != nil { - log.WithError(err).Errorf("failed to add finalizer %s to resource %s %s", AgentMachineFinalizerName, agentMachine.Name, agentMachine.Namespace) - return &ctrl.Result{}, err - } +func (r *AgentMachineReconciler) removeMachineDeletionHookAnnotation(ctx context.Context, machine *clusterv1.Machine) (err error) { + annotations := machine.GetAnnotations() + if _, haveMachineHookAnnotation := annotations[machineDeleteHookName]; haveMachineHookAnnotation { + delete(annotations, machineDeleteHookName) + machine.SetAnnotations(annotations) + err = r.Update(ctx, machine) + } + return err +} + +func (r *AgentMachineReconciler) handleDeletionHook(ctx context.Context, log logrus.FieldLogger, agentMachine *capiproviderv1alpha1.AgentMachine, machine *clusterv1.Machine) (*ctrl.Result, error) { + // TODO: this can be removed when we're sure no agent machines have this finalizer anymore + if funk.ContainsString(agentMachine.GetFinalizers(), AgentMachineFinalizerName) { + controllerutil.RemoveFinalizer(agentMachine, AgentMachineFinalizerName) + if err := r.Update(ctx, agentMachine); err != nil { + log.WithError(err).Errorf("failed to remove finalizer %s from resource %s %s", AgentMachineFinalizerName, agentMachine.Name, agentMachine.Namespace) + return &ctrl.Result{}, err } - } else { // AgentMachine is being deleted - r.Log.Info("Found deletion timestamp on AgentMachine") - if funk.ContainsString(agentMachine.GetFinalizers(), AgentMachineFinalizerName) { - // deletion finalizer found, unbind the Agent from the ClusterDeployment - if agentMachine.Status.AgentRef != nil { - r.Log.Info("Removing ClusterDeployment ref to unbind Agent") - agent, err := r.getAgent(ctx, log, agentMachine) - if err != nil { - if apierrors.IsNotFound(err) { - log.WithError(err).Infof("Failed to get agent %s. assuming the agent no longer exists", agentMachine.Status.AgentRef.Name) - } else { - log.WithError(err).Errorf("Failed to get agent %s", agentMachine.Status.AgentRef.Name) - return &ctrl.Result{}, err - } - } else { - // Remove the AgentMachineRefLabel and set the clusterDeployment to nil - delete(agent.ObjectMeta.Labels, AgentMachineRefLabelKey) - agent.Spec.ClusterDeploymentName = nil - if err := r.Update(ctx, agent); err != nil { - log.WithError(err).Error("failed to remove the Agent's ClusterDeployment ref") - return &ctrl.Result{}, err - } - } - } + } + + // set delete hook if not present and machine not being deleted + annotations := machine.GetAnnotations() + if _, haveMachineHookAnnotation := annotations[machineDeleteHookName]; !haveMachineHookAnnotation && machine.DeletionTimestamp == nil { + if annotations == nil { + annotations = make(map[string]string) + } + annotations[machineDeleteHookName] = "" + machine.SetAnnotations(annotations) + if err := r.Update(ctx, machine); err != nil { + log.WithError(err).Error("failed to add machine delete hook annotation") + return &ctrl.Result{}, err + } + // return early here as there's no reason to check if the machine is held up on this hook as we just created it + return nil, nil + } + + // return if the machine is not waiting on this hook + cond := conditions.Get(machine, clusterv1.PreTerminateDeleteHookSucceededCondition) + if cond == nil || cond.Status == corev1.ConditionTrue { + return nil, nil + } + + if agentMachine.Status.AgentRef == nil { + log.Info("Removing machine delete hook annotation - agent ref is nil") + if err := r.removeMachineDeletionHookAnnotation(ctx, machine); err != nil { + log.WithError(err).Error("failed to remove machine delete hook annotation") + return &ctrl.Result{}, err + } + return nil, nil + } - // remove our finalizer from the list and update it. - controllerutil.RemoveFinalizer(agentMachine, AgentMachineFinalizerName) - if err := r.Update(ctx, agentMachine); err != nil { - log.WithError(err).Errorf("failed to remove finalizer %s from resource %s %s", AgentMachineFinalizerName, agentMachine.Name, agentMachine.Namespace) - return &ctrl.Result{}, err + agent, err := r.getAgent(ctx, log, agentMachine) + if err != nil { + if apierrors.IsNotFound(err) { + log.WithError(err).Infof("Failed to get agent %s. assuming the agent no longer exists", agentMachine.Status.AgentRef.Name) + if hookErr := r.removeMachineDeletionHookAnnotation(ctx, machine); hookErr != nil { + log.WithError(hookErr).Error("failed to remove machine delete hook annotation") + return &ctrl.Result{}, hookErr } + return nil, nil + } else { + log.WithError(err).Errorf("Failed to get agent %s", agentMachine.Status.AgentRef.Name) + return &ctrl.Result{}, err + } + } + + if funk.Contains(agent.ObjectMeta.Labels, AgentMachineRefLabelKey) || agent.Spec.ClusterDeploymentName != nil { + r.Log.Info("Removing ClusterDeployment ref to unbind Agent") + delete(agent.ObjectMeta.Labels, AgentMachineRefLabelKey) + agent.Spec.ClusterDeploymentName = nil + if err := r.Update(ctx, agent); err != nil { + log.WithError(err).Error("failed to remove the Agent's ClusterDeployment ref") + return &ctrl.Result{}, err } - r.Log.Info("AgentMachine is ready for deletion") + } - return &ctrl.Result{}, nil + // Remove the hook when either the host is back to some kind of unbound state, reclaim fails, or is not enabled + removeHookStates := []string{ + aimodels.HostStatusDiscoveringUnbound, + aimodels.HostStatusKnownUnbound, + aimodels.HostStatusDisconnectedUnbound, + aimodels.HostStatusInsufficientUnbound, + aimodels.HostStatusDisabledUnbound, + aimodels.HostStatusUnbindingPendingUserAction, + aimodels.HostStatusError, + } + if funk.Contains(removeHookStates, agent.Status.DebugInfo.State) { + log.Infof("Removing machine delete hook annotation for agent in status %s", agent.Status.DebugInfo.State) + if err := r.removeMachineDeletionHookAnnotation(ctx, machine); err != nil { + log.WithError(err).Error("failed to remove machine delete hook annotation") + return &ctrl.Result{}, err + } + } else { + log.Infof("Waiting for agent %s to reboot into discovery", agent.Name) + return &ctrl.Result{RequeueAfter: 5 * time.Second}, nil } return nil, nil @@ -538,6 +593,41 @@ func getAddresses(foundAgent *aiv1beta1.Agent) []clusterv1.MachineAddress { return machineAddresses } +func (r *AgentMachineReconciler) mapMachineToAgentMachine(machine client.Object) []reconcile.Request { + log := r.Log.WithFields( + logrus.Fields{ + "machine": machine.GetName(), + "machine_namespace": machine.GetNamespace(), + }, + ) + + amList := &capiproviderv1alpha1.AgentMachineList{} + opts := &client.ListOptions{ + Namespace: machine.GetNamespace(), + } + if err := r.List(context.Background(), amList, opts); err != nil { + log.Debugf("failed to list agent machines") + return []reconcile.Request{} + } + + for _, agentMachine := range amList.Items { + for _, ref := range agentMachine.OwnerReferences { + gv, err := schema.ParseGroupVersion(ref.APIVersion) + if err != nil { + continue + } + if ref.Kind == "Machine" && gv.Group == clusterv1.GroupVersion.Group && ref.Name == machine.GetName() { + return []reconcile.Request{{NamespacedName: types.NamespacedName{ + Namespace: agentMachine.Namespace, + Name: agentMachine.Name, + }}} + } + } + } + + return []reconcile.Request{} +} + // SetupWithManager sets up the controller with the Manager. func (r *AgentMachineReconciler) SetupWithManager(mgr ctrl.Manager, agentNamespace string) error { mapAgentToAgentMachine := func(agent client.Object) []reconcile.Request { @@ -577,5 +667,6 @@ func (r *AgentMachineReconciler) SetupWithManager(mgr ctrl.Manager, agentNamespa return ctrl.NewControllerManagedBy(mgr). For(&capiproviderv1alpha1.AgentMachine{}). Watches(&source.Kind{Type: &aiv1beta1.Agent{}}, handler.EnqueueRequestsFromMapFunc(mapAgentToAgentMachine)). + Watches(&source.Kind{Type: &clusterv1.Machine{}}, handler.EnqueueRequestsFromMapFunc(r.mapMachineToAgentMachine)). Complete(r) } diff --git a/controllers/agentmachine_controller_test.go b/controllers/agentmachine_controller_test.go index c0bb80a4..88c50d91 100644 --- a/controllers/agentmachine_controller_test.go +++ b/controllers/agentmachine_controller_test.go @@ -13,18 +13,19 @@ import ( . "github.com/onsi/gomega" hiveext "github.com/openshift/assisted-service/api/hiveextension/v1beta1" aiv1beta1 "github.com/openshift/assisted-service/api/v1beta1" + aimodels "github.com/openshift/assisted-service/models" capiproviderv1alpha1 "github.com/openshift/cluster-api-provider-agent/api/v1alpha1" v1 "github.com/openshift/custom-resource-status/conditions/v1" hivev1 "github.com/openshift/hive/apis/hive/v1" "github.com/sirupsen/logrus" "github.com/thoas/go-funk" corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/kubernetes/scheme" k8sutilspointer "k8s.io/utils/pointer" clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterutil "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -48,7 +49,7 @@ func newAgentMachineRequest(agentMachine *capiproviderv1alpha1.AgentMachine) ctr return ctrl.Request{NamespacedName: namespacedName} } -func newAgentMachine(name, namespace string, spec capiproviderv1alpha1.AgentMachineSpec, ctx context.Context, c client.Client) *capiproviderv1alpha1.AgentMachine { +func newAgentMachine(name, namespace string, spec capiproviderv1alpha1.AgentMachineSpec, ctx context.Context, c client.Client) (*capiproviderv1alpha1.AgentMachine, *clusterv1.Machine) { clusterDeployment := hivev1.ClusterDeployment{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("cluster-deployment-%s", name), @@ -120,9 +121,10 @@ func newAgentMachine(name, namespace string, spec capiproviderv1alpha1.AgentMach machine := clusterv1.Machine{ ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("machine-%s", name), - Namespace: namespace, - Labels: make(map[string]string), + Name: fmt.Sprintf("machine-%s", name), + Namespace: namespace, + Labels: make(map[string]string), + Annotations: make(map[string]string), }, Spec: clusterv1.MachineSpec{ Bootstrap: clusterv1.Bootstrap{ @@ -145,7 +147,7 @@ func newAgentMachine(name, namespace string, spec capiproviderv1alpha1.AgentMach } agentMachine.ObjectMeta.OwnerReferences = append(agentMachine.ObjectMeta.OwnerReferences, machineOwnerRef) - return &agentMachine + return &agentMachine, &machine } func newAgent(name, namespace string, spec aiv1beta1.AgentSpec) *aiv1beta1.Agent { @@ -232,7 +234,7 @@ var _ = Describe("agentmachine reconcile", func() { agent.Status.Conditions = append(agent.Status.Conditions, v1.Condition{Type: aiv1beta1.InstalledCondition, Status: "True"}) Expect(c.Create(ctx, agent)).To(BeNil()) - agentMachine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + agentMachine, _ := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) agentMachine.Status.AgentRef = &capiproviderv1alpha1.AgentReference{Namespace: testNamespace, Name: "agent-1"} Expect(c.Create(ctx, agentMachine)).To(BeNil()) @@ -247,6 +249,23 @@ var _ = Describe("agentmachine reconcile", func() { Expect(conditions.Get(agentMachine, clusterv1.ReadyCondition).Status).To(BeEquivalentTo("True")) }) + It("removes the old finalizer and sets the machine delete hook annotation", func() { + agentMachine, _ := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + controllerutil.AddFinalizer(agentMachine, AgentMachineFinalizerName) + Expect(c.Create(ctx, agentMachine)).To(Succeed()) + + result, err := amr.Reconcile(ctx, newAgentMachineRequest(agentMachine)) + Expect(err).To(BeNil()) + Expect(result).To(Equal(ctrl.Result{})) + + Expect(c.Get(ctx, types.NamespacedName{Namespace: testNamespace, Name: "agentMachine-1"}, agentMachine)).To(Succeed()) + Expect(controllerutil.ContainsFinalizer(agentMachine, AgentMachineFinalizerName)).To(BeFalse()) + machine, err := clusterutil.GetOwnerMachine(ctx, c, agentMachine.ObjectMeta) + Expect(err).To(BeNil()) + _, haveMachineHookAnnotation := machine.GetAnnotations()[machineDeleteHookName] + Expect(haveMachineHookAnnotation).To(BeTrue()) + }) + It("agentMachine no agents", func() { // Agent0: not approved agent0 := newAgent("agent-0", testNamespace, aiv1beta1.AgentSpec{Approved: false}) @@ -254,7 +273,7 @@ var _ = Describe("agentmachine reconcile", func() { agent0.Status.Conditions = append(agent0.Status.Conditions, v1.Condition{Type: aiv1beta1.ValidatedCondition, Status: "True"}) Expect(c.Create(ctx, agent0)).To(BeNil()) - agentMachine := newAgentMachine("agentMachine-0", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + agentMachine, _ := newAgentMachine("agentMachine-0", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) Expect(c.Create(ctx, agentMachine)).To(BeNil()) result, err := amr.Reconcile(ctx, newAgentMachineRequest(agentMachine)) @@ -279,7 +298,7 @@ var _ = Describe("agentmachine reconcile", func() { MatchExpressions: []metav1.LabelSelectorRequirement{{Key: "location", Operator: "In", Values: []string{"datacenter2", "datacenter3"}}}, }, } - agentMachine := newAgentMachine("agentMachine", testNamespace, spec, ctx, c) + agentMachine, _ := newAgentMachine("agentMachine", testNamespace, spec, ctx, c) Expect(c.Create(ctx, agentMachine)).To(BeNil()) agentMachineRequest := newAgentMachineRequest(agentMachine) @@ -337,7 +356,7 @@ var _ = Describe("agentmachine reconcile", func() { }) It("agentMachine agent with missing agentref", func() { - agentMachine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + agentMachine, _ := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) Expect(c.Create(ctx, agentMachine)).To(BeNil()) agentMachineRequest := newAgentMachineRequest(agentMachine) @@ -357,10 +376,10 @@ var _ = Describe("agentmachine reconcile", func() { }) It("non-existing agentMachine", func() { - agentMachine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + agentMachine, _ := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) Expect(c.Create(ctx, agentMachine)).To(BeNil()) - nonExistingAgentMachine := newAgentMachine("agentMachine-2", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + nonExistingAgentMachine, _ := newAgentMachine("agentMachine-2", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) result, err := amr.Reconcile(ctx, newAgentMachineRequest(nonExistingAgentMachine)) Expect(err).To(BeNil()) @@ -368,7 +387,7 @@ var _ = Describe("agentmachine reconcile", func() { }) It("agentMachine ready status", func() { - agentMachine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + agentMachine, _ := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) agentMachine.Status.Ready = true Expect(c.Create(ctx, agentMachine)).To(BeNil()) @@ -377,51 +396,165 @@ var _ = Describe("agentmachine reconcile", func() { Expect(result).To(Equal(ctrl.Result{})) }) - It("agentMachine deprovision with no agentRef", func() { - agentMachine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + It("removes the machine delete hook when agent ref is not set and machine is waiting on delete hook", func() { + agentMachine, machine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) agentMachine.Status.Ready = true - agentMachine.ObjectMeta.DeletionTimestamp = &metav1.Time{Time: time.Now()} - controllerutil.AddFinalizer(agentMachine, AgentMachineFinalizerName) Expect(c.Create(ctx, agentMachine)).To(BeNil()) + + conditions.MarkFalse(machine, clusterv1.PreTerminateDeleteHookSucceededCondition, clusterv1.WaitingExternalHookReason, clusterv1.ConditionSeverityInfo, "") + machine.Annotations[machineDeleteHookName] = "" + Expect(c.Update(ctx, machine)).To(BeNil()) + result, err := amr.Reconcile(ctx, newAgentMachineRequest(agentMachine)) Expect(err).To(BeNil()) Expect(result).To(Equal(ctrl.Result{})) - getErr := c.Get(ctx, types.NamespacedName{Namespace: testNamespace, Name: "agentMachine-1"}, agentMachine) - Expect(getErr.(*errors.StatusError).Status().Code).To(BeEquivalentTo(404)) + Expect(c.Get(ctx, types.NamespacedName{Namespace: machine.Namespace, Name: machine.Name}, machine)).To(BeNil()) + Expect(machine.GetAnnotations()).ToNot(HaveKey(machineDeleteHookName)) }) - It("agentMachine deprovision with agentRef", func() { - agent := newAgent("agent-1", testNamespace, aiv1beta1.AgentSpec{Approved: false}) - agent.Status.Conditions = append(agent.Status.Conditions, v1.Condition{Type: aiv1beta1.BoundCondition, Status: "True"}) - agent.Status.Conditions = append(agent.Status.Conditions, v1.Condition{Type: aiv1beta1.ValidatedCondition, Status: "True"}) - Expect(c.Create(ctx, agent)).To(BeNil()) - - agentMachine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + It("removes the machine delete hook when agent is missing and machine is waiting on delete hook", func() { + agentMachine, machine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) agentMachine.Status.Ready = true - agentMachine.Status.AgentRef = &capiproviderv1alpha1.AgentReference{Namespace: agent.Namespace, Name: agent.Name} - agentMachine.ObjectMeta.DeletionTimestamp = &metav1.Time{Time: time.Now()} - controllerutil.AddFinalizer(agentMachine, AgentMachineFinalizerName) + agentMachine.Status.AgentRef = &capiproviderv1alpha1.AgentReference{Namespace: testNamespace, Name: "missingAgent"} Expect(c.Create(ctx, agentMachine)).To(BeNil()) + + conditions.MarkFalse(machine, clusterv1.PreTerminateDeleteHookSucceededCondition, clusterv1.WaitingExternalHookReason, clusterv1.ConditionSeverityInfo, "") + machine.Annotations[machineDeleteHookName] = "" + Expect(c.Update(ctx, machine)).To(BeNil()) + result, err := amr.Reconcile(ctx, newAgentMachineRequest(agentMachine)) Expect(err).To(BeNil()) Expect(result).To(Equal(ctrl.Result{})) - getErr := c.Get(ctx, types.NamespacedName{Namespace: testNamespace, Name: "agentMachine-1"}, agentMachine) - Expect(getErr.(*errors.StatusError).Status().Code).To(BeEquivalentTo(404)) + Expect(c.Get(ctx, types.NamespacedName{Namespace: machine.Namespace, Name: machine.Name}, machine)).To(BeNil()) + Expect(machine.GetAnnotations()).ToNot(HaveKey(machineDeleteHookName)) }) - It("agentMachine deprovision with agentRef and no agent", func() { - agentMachine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + + It("unbinds the agent and requeues when machine is waiting on delete hook", func() { + agent := newAgent("agent-1", testNamespace, aiv1beta1.AgentSpec{Approved: false}) + agent.Status.Conditions = append(agent.Status.Conditions, v1.Condition{Type: aiv1beta1.BoundCondition, Status: "True"}) + agent.Status.Conditions = append(agent.Status.Conditions, v1.Condition{Type: aiv1beta1.ValidatedCondition, Status: "True"}) + + agentMachine, machine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) agentMachine.Status.Ready = true - agentMachine.Status.AgentRef = &capiproviderv1alpha1.AgentReference{Namespace: testNamespace, Name: "missingAgent"} - agentMachine.ObjectMeta.DeletionTimestamp = &metav1.Time{Time: time.Now()} - controllerutil.AddFinalizer(agentMachine, AgentMachineFinalizerName) + agentMachine.Status.AgentRef = &capiproviderv1alpha1.AgentReference{Namespace: agent.Namespace, Name: agent.Name} + + agent.ObjectMeta.Labels[AgentMachineRefLabelKey] = string(agentMachine.GetUID()) + agent.Spec.ClusterDeploymentName = &aiv1beta1.ClusterReference{ + Name: fmt.Sprintf("cluster-deployment-%s", agentMachine.Name), + Namespace: agentMachine.Namespace, + } + + Expect(c.Create(ctx, agent)).To(BeNil()) Expect(c.Create(ctx, agentMachine)).To(BeNil()) + + conditions.MarkFalse(machine, clusterv1.PreTerminateDeleteHookSucceededCondition, clusterv1.WaitingExternalHookReason, clusterv1.ConditionSeverityInfo, "") + machine.Annotations[machineDeleteHookName] = "" + Expect(c.Update(ctx, machine)).To(BeNil()) + result, err := amr.Reconcile(ctx, newAgentMachineRequest(agentMachine)) Expect(err).To(BeNil()) - Expect(result).To(Equal(ctrl.Result{})) + Expect(result.RequeueAfter).To(Equal(5 * time.Second)) + + Expect(c.Get(ctx, types.NamespacedName{Namespace: agent.Namespace, Name: agent.Name}, agent)).To(BeNil()) + Expect(agent.Labels).ToNot(HaveKey(AgentMachineRefLabelKey)) + Expect(agent.Spec.ClusterDeploymentName).To(BeNil()) + }) + + Context("waiting for agent", func() { + var ( + agent *aiv1beta1.Agent + agentMachine *capiproviderv1alpha1.AgentMachine + machine *clusterv1.Machine + ) + + BeforeEach(func() { + agent = newAgent("agent-1", testNamespace, aiv1beta1.AgentSpec{Approved: false}) + agent.Status.Conditions = append(agent.Status.Conditions, v1.Condition{Type: aiv1beta1.BoundCondition, Status: "True"}) + agent.Status.Conditions = append(agent.Status.Conditions, v1.Condition{Type: aiv1beta1.ValidatedCondition, Status: "True"}) + + agentMachine, machine = newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + agentMachine.Status.Ready = true + agentMachine.Status.AgentRef = &capiproviderv1alpha1.AgentReference{Namespace: agent.Namespace, Name: agent.Name} + + Expect(c.Create(ctx, agent)).To(BeNil()) + Expect(c.Create(ctx, agentMachine)).To(BeNil()) + + conditions.MarkFalse(machine, clusterv1.PreTerminateDeleteHookSucceededCondition, clusterv1.WaitingExternalHookReason, clusterv1.ConditionSeverityInfo, "") + machine.Annotations[machineDeleteHookName] = "" + Expect(c.Update(ctx, machine)).To(BeNil()) + }) + + It("removes the machine delete hook when the agent reaches discovering unbound rebooting", func() { + agent.Status.DebugInfo.State = aimodels.HostStatusDiscoveringUnbound + Expect(c.Update(ctx, agent)).To(BeNil()) + + result, err := amr.Reconcile(ctx, newAgentMachineRequest(agentMachine)) + Expect(err).To(BeNil()) + Expect(result).To(Equal(ctrl.Result{})) + + Expect(c.Get(ctx, types.NamespacedName{Namespace: machine.Namespace, Name: machine.Name}, machine)).To(BeNil()) + Expect(machine.GetAnnotations()).ToNot(HaveKey(machineDeleteHookName)) + }) + + It("removes the machine delete hook when the agent reaches unbinding pending user action", func() { + agent.Status.DebugInfo.State = aimodels.HostStatusUnbindingPendingUserAction + Expect(c.Update(ctx, agent)).To(BeNil()) + + result, err := amr.Reconcile(ctx, newAgentMachineRequest(agentMachine)) + Expect(err).To(BeNil()) + Expect(result).To(Equal(ctrl.Result{})) + + Expect(c.Get(ctx, types.NamespacedName{Namespace: machine.Namespace, Name: machine.Name}, machine)).To(BeNil()) + Expect(machine.GetAnnotations()).ToNot(HaveKey(machineDeleteHookName)) + }) + }) +}) + +var _ = Describe("mapMachineToAgentMachine", func() { + var ( + c client.Client + amr *AgentMachineReconciler + ctx = context.Background() + testNamespace = "test-namespace" + ) + + BeforeEach(func() { + c = fakeclient.NewClientBuilder().WithScheme(scheme.Scheme).Build() + amr = &AgentMachineReconciler{ + Client: c, + Scheme: scheme.Scheme, + Log: logrus.New(), + AgentClient: c, + } + }) + + It("returns a request for the related agent machine", func() { + agentMachine, machine := newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + Expect(c.Create(ctx, agentMachine)).To(Succeed()) + + requests := amr.mapMachineToAgentMachine(machine) + Expect(len(requests)).To(Equal(1)) + + agentMachineKey := types.NamespacedName{ + Name: "agentMachine-1", + Namespace: testNamespace, + } + Expect(requests[0].NamespacedName).To(Equal(agentMachineKey)) + }) + + It("returns an empty list when no agent machine is found", func() { + // creates all the resource except the agent machine + newAgentMachine("agentMachine-1", testNamespace, capiproviderv1alpha1.AgentMachineSpec{}, ctx, c) + + key := types.NamespacedName{ + Name: "machine-agentMachine-1", + Namespace: testNamespace, + } + machine := clusterv1.Machine{} + Expect(c.Get(ctx, key, &machine)).To(Succeed()) - getErr := c.Get(ctx, types.NamespacedName{Namespace: testNamespace, Name: "agentMachine-1"}, agentMachine) - Expect(getErr.(*errors.StatusError).Status().Code).To(BeEquivalentTo(404)) + Expect(amr.mapMachineToAgentMachine(&machine)).To(BeEmpty()) }) }) diff --git a/go.mod b/go.mod index b74f6ab8..193456de 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/golang/mock v1.6.0 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.18.1 - github.com/openshift/assisted-service/api v0.0.0-20220404082135-0bb6463a94fb github.com/openshift/cluster-api-provider-agent/api v0.0.0 github.com/openshift/custom-resource-status v1.1.1 github.com/openshift/hive/apis v0.0.0-20220222213051-def9088fdb5a @@ -28,6 +27,11 @@ require ( sigs.k8s.io/controller-runtime v0.11.1 ) +require ( + github.com/openshift/assisted-service/api v0.0.0-20220811161334-09c4cb098e96 + github.com/openshift/assisted-service/models v0.0.0 +) + require ( cloud.google.com/go v0.93.3 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect @@ -81,7 +85,6 @@ require ( github.com/nxadm/tail v1.4.8 // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/openshift/api v0.0.0-20210216211028-bb81baaf35cd // indirect - github.com/openshift/assisted-service/models v0.0.0 // indirect github.com/prometheus/client_golang v1.11.0 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.28.0 // indirect @@ -117,8 +120,8 @@ require ( ) replace ( - github.com/openshift/assisted-service/api => github.com/openshift/assisted-service/api v0.0.0-20220314012014-141adc8ae8f8 - github.com/openshift/assisted-service/models => github.com/openshift/assisted-service/models v0.0.0-20220327160002-d7f1f0923b25 + github.com/openshift/assisted-service/api => github.com/openshift/assisted-service/api v0.0.0-20220811161334-09c4cb098e96 + github.com/openshift/assisted-service/models => github.com/openshift/assisted-service/models v0.0.0-20220811161334-09c4cb098e96 github.com/openshift/cluster-api-provider-agent/api => ./api sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.0.0 ) diff --git a/go.sum b/go.sum index 19a2e8f8..99b25f43 100644 --- a/go.sum +++ b/go.sum @@ -553,10 +553,10 @@ github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5h github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/openshift/api v0.0.0-20210216211028-bb81baaf35cd h1:SzOmbKIulFFEBPoBosc4G4QBVN4QwynEvb3RU9tOdJA= github.com/openshift/api v0.0.0-20210216211028-bb81baaf35cd/go.mod h1:aqU5Cq+kqKKPbDMqxo9FojgDeSpNJI7iuskjXjtojDg= -github.com/openshift/assisted-service/api v0.0.0-20220314012014-141adc8ae8f8 h1:ZBDznehOlgkeElBH72jsVHo8/XizdydZuHj8C7aaUsE= -github.com/openshift/assisted-service/api v0.0.0-20220314012014-141adc8ae8f8/go.mod h1:KXLo37GRdMYq/8PHRbvWPW9AEZjLI3NdFCySAwBJfAQ= -github.com/openshift/assisted-service/models v0.0.0-20220327160002-d7f1f0923b25 h1:dFjNc0m3rLzMv87+1BsW8Ptag7Afrf3MFrpXZjV1qGE= -github.com/openshift/assisted-service/models v0.0.0-20220327160002-d7f1f0923b25/go.mod h1:jTawnnM2LU/AzpZLYxPeXQy4qBRl5iwFo1bu3zrPv2s= +github.com/openshift/assisted-service/api v0.0.0-20220811161334-09c4cb098e96 h1:/hFV74JO0/fLqhTFjcmL0UNCfeZX9EMf2JRLdWeT8Wo= +github.com/openshift/assisted-service/api v0.0.0-20220811161334-09c4cb098e96/go.mod h1:KXLo37GRdMYq/8PHRbvWPW9AEZjLI3NdFCySAwBJfAQ= +github.com/openshift/assisted-service/models v0.0.0-20220811161334-09c4cb098e96 h1:PuiMFgQfq3IpJg2nJHtAtRwXrRsMhXotXPcdFgdZaH0= +github.com/openshift/assisted-service/models v0.0.0-20220811161334-09c4cb098e96/go.mod h1:jTawnnM2LU/AzpZLYxPeXQy4qBRl5iwFo1bu3zrPv2s= github.com/openshift/build-machinery-go v0.0.0-20200917070002-f171684f77ab/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE= github.com/openshift/custom-resource-status v1.1.1 h1:CFL7mVPbec7aob7r6SWXiyCtXo6G8xZmLuyRj1F2s8Y= github.com/openshift/custom-resource-status v1.1.1/go.mod h1:vklCbKGD2iT8h4L2nGFYBHHe8/DaXWPozOP12JXllqA= diff --git a/vendor/github.com/openshift/assisted-service/api/hiveextension/v1beta1/agentclusterinstall_types.go b/vendor/github.com/openshift/assisted-service/api/hiveextension/v1beta1/agentclusterinstall_types.go index 6bd3e39d..f9fd3ac5 100644 --- a/vendor/github.com/openshift/assisted-service/api/hiveextension/v1beta1/agentclusterinstall_types.go +++ b/vendor/github.com/openshift/assisted-service/api/hiveextension/v1beta1/agentclusterinstall_types.go @@ -25,6 +25,8 @@ const ( ClusterInsufficientAgentsMsg string = "The cluster currently requires %d agents but only %d have registered" ClusterUnapprovedAgentsReason string = "UnapprovedAgents" ClusterUnapprovedAgentsMsg string = "The installation is pending on the approval of %d agents" + ClusterUnsyncedAgentsReason string = "UnsyncedAgents" + ClusterUnsyncedAgentsMsg string = "The cluster currently has %d agents with spec error" ClusterAdditionalAgentsReason string = "AdditionalAgents" ClusterAdditionalAgentsMsg string = "The cluster currently requires exactly %d agents but have %d registered" @@ -169,6 +171,10 @@ type AgentClusterInstallSpec struct { // Proxy defines the proxy settings used for the install config // +optional Proxy *Proxy `json:"proxy,omitempty"` + + // PlatformType is the name for the specific platform upon which to perform the installation. + // +optional + PlatformType PlatformType `json:"platformType,omitempty"` } // IgnitionEndpoint stores the data to of the custom ignition endpoint. @@ -218,6 +224,22 @@ type AgentClusterInstallStatus struct { // +optional DebugInfo DebugInfo `json:"debugInfo"` + // APIVIP is the virtual IP used to reach the OpenShift cluster's API. + // +optional + APIVIP string `json:"apiVIP,omitempty"` + + // IngressVIP is the virtual IP used for cluster ingress traffic. + // +optional + IngressVIP string `json:"ingressVIP,omitempty"` + + // UserManagedNetworking indicates if the networking is managed by the user. + // +optional + UserManagedNetworking *bool `json:"userManagedNetworking,omitempty"` + + // PlatformType is the name for the specific platform upon which to perform the installation. + // +optional + PlatformType PlatformType `json:"platformType,omitempty"` + // ValidationsInfo is a JSON-formatted string containing the validation results for each validation id grouped by category (network, hosts-data, etc.) // +optional ValidationsInfo common.ValidationsStatus `json:"validationsInfo,omitempty"` @@ -265,8 +287,9 @@ type Networking struct { NetworkType string `json:"networkType,omitempty"` // UserManagedNetworking indicates if the networking is managed by the user. + // For single-node installations, set to true or leave empty. // +optional - UserManagedNetworking bool `json:"userManagedNetworking,omitempty"` + UserManagedNetworking *bool `json:"userManagedNetworking,omitempty"` } // MachineNetworkEntry is a single IP address block for node IP blocks. @@ -318,6 +341,21 @@ const ( WorkerAgentMachinePool string = "worker" ) +// PlatformType is a specific supported infrastructure provider. +// +kubebuilder:validation:Enum="";BareMetal;None;VSphere +type PlatformType string + +const ( + // BareMetalPlatformType represents managed bare metal infrastructure. + BareMetalPlatformType PlatformType = "BareMetal" + + // NonePlatformType means there is no infrastructure provider. + NonePlatformType PlatformType = "None" + + // VSpherePlatformType represents VMWare vSphere infrastructure. + VSpherePlatformType PlatformType = "VSphere" +) + // AgentMachinePool is a pool of machines to be installed. type AgentMachinePool struct { // Hyperthreading determines the mode of hyperthreading that machines in the diff --git a/vendor/github.com/openshift/assisted-service/api/hiveextension/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/openshift/assisted-service/api/hiveextension/v1beta1/zz_generated.deepcopy.go index e1ba798d..9d923bc0 100644 --- a/vendor/github.com/openshift/assisted-service/api/hiveextension/v1beta1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/assisted-service/api/hiveextension/v1beta1/zz_generated.deepcopy.go @@ -167,6 +167,11 @@ func (in *AgentClusterInstallStatus) DeepCopyInto(out *AgentClusterInstallStatus copy(*out, *in) } out.DebugInfo = in.DebugInfo + if in.UserManagedNetworking != nil { + in, out := &in.UserManagedNetworking, &out.UserManagedNetworking + *out = new(bool) + **out = **in + } if in.ValidationsInfo != nil { in, out := &in.ValidationsInfo, &out.ValidationsInfo *out = make(common.ValidationsStatus, len(*in)) @@ -362,6 +367,11 @@ func (in *Networking) DeepCopyInto(out *Networking) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.UserManagedNetworking != nil { + in, out := &in.UserManagedNetworking, &out.UserManagedNetworking + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Networking. diff --git a/vendor/github.com/openshift/assisted-service/api/v1beta1/agentclassification_types.go b/vendor/github.com/openshift/assisted-service/api/v1beta1/agentclassification_types.go new file mode 100644 index 00000000..b183a8a1 --- /dev/null +++ b/vendor/github.com/openshift/assisted-service/api/v1beta1/agentclassification_types.go @@ -0,0 +1,83 @@ +/* +Copyright 2022. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + QueryErrorsCondition conditionsv1.ConditionType = "QueryErrors" + QueryNoErrorsReason string = "NoQueryErrors" + QueryHasErrorsReason string = "HasQueryErrors" +) + +// AgentClassificationSpec defines the desired state of AgentClassification +type AgentClassificationSpec struct { + // LabelKey specifies the label key to apply to matched Agents + // + // +immutable + LabelKey string `json:"labelKey"` + + // LabelValue specifies the label value to apply to matched Agents + // + // +immutable + LabelValue string `json:"labelValue"` + + // Query is in gojq format (https://github.com/itchyny/gojq#difference-to-jq) + // and will be invoked on each Agent's inventory. The query should return a + // boolean. The operator will apply the label to any Agent for which "true" + // is returned. + Query string `json:"query"` +} + +// AgentClassificationStatus defines the observed state of AgentClassification +type AgentClassificationStatus struct { + // MatchedCount shows how many Agents currently match the classification + MatchedCount int `json:"matchedCount,omitempty"` + + // ErrorCount shows how many Agents encountered errors when matching the classification + ErrorCount int `json:"errorCount,omitempty"` + + Conditions []conditionsv1.Condition `json:"conditions,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +// AgentClassification is the Schema for the AgentClassifications API +type AgentClassification struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AgentClassificationSpec `json:"spec,omitempty"` + Status AgentClassificationStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// AgentClassificationList contains a list of AgentClassification +type AgentClassificationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []AgentClassification `json:"items"` +} + +func init() { + SchemeBuilder.Register(&AgentClassification{}, &AgentClassificationList{}) +} diff --git a/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go b/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go index f692af32..7e8fe0ac 100644 --- a/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go +++ b/vendor/github.com/openshift/assisted-service/api/v1beta1/agentserviceconfig_types.go @@ -33,6 +33,8 @@ type OSImage struct { // Url specifies the path to the Operating System image. Url string `json:"url"` // rootFSUrl specifies the path to the root filesystem. + // +optional + // Deprecated: this field is ignored (will be removed in a future release). RootFSUrl string `json:"rootFSUrl"` // The CPU architecture of the image (x86_64/arm64/etc). // +optional @@ -88,6 +90,18 @@ type AgentServiceConfigSpec struct { // that are used if one the operators fails to be successfully deployed //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Must-Gather Images" MustGatherImages []MustGatherImage `json:"mustGatherImages,omitempty"` + + // IPXEHTTPRoute is controlling whether the operator is creating plain HTTP routes + // iPXE hosts may not work with router cyphers and may access artifacts via HTTP only + // This setting accepts "enabled,disabled", defaults to disabled. Empty value defaults to disabled + // The following endpoints would be exposed via http: + // * api/assisted-installer/v2/infra-envs//downloads/files?file_name=ipxe-script in assisted-service + // * boot-artifacts/ and images//pxe-initrd in -image-service + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Expose IPXE HTTP route" + // +kubebuilder:validation:Enum=enabled;disabled + // +kubebuilder:validation:default:=disabled + // +optional + IPXEHTTPRoute string `json:"iPXEHTTPRoute,omitempty"` } // ConditionType related to our reconcile loop in addition to all the reasons @@ -100,6 +114,8 @@ const ( // ReasonReconcileSucceeded when the reconcile completes all operations without error. ReasonReconcileSucceeded string = "ReconcileSucceeded" + // ReasonDeploymentSucceeded when configuring/deploying the assisted-service deployment completed without errors. + ReasonDeploymentSucceeded string = "DeploymentSucceeded" // ReasonStorageFailure when there was a failure configuring/deploying storage. ReasonStorageFailure string = "StorageFailure" // ReasonImageHandlerServiceFailure when there was a failure related to the assisted-image-service's service. @@ -128,6 +144,8 @@ const ( ReasonDeploymentFailure string = "DeploymentFailure" // ReasonStorageFailure when there was a failure configuring/deploying the validating webhook. ReasonValidatingWebHookFailure string = "ValidatingWebHookFailure" + // ReasonStorageFailure when there was a failure configuring/deploying the validating webhook. + ReasonMutatingWebHookFailure string = "MutatingWebHookFailure" // ReasonWebHookServiceFailure when there was a failure related to the webhook's service. ReasonWebHookServiceFailure string = "ReasonWebHookServiceFailure" // ReasonWebHookDeploymentFailure when there was a failure configuring/deploying the webhook deployment. @@ -140,6 +158,11 @@ const ( ReasonWebHookServiceAccountFailure string = "ReasonWebHookServiceAccountFailure" // ReasonWebHookAPIServiceFailure when there was a failure related to the webhook's API service. ReasonWebHookAPIServiceFailure string = "ReasonWebHookAPIServiceFailure" + + // IPXEHTTPRouteEnabled is expected value in IPXEHTTPRoute to enable the route + IPXEHTTPRouteEnabled string = "enabled" + // IPXEHTTPRouteEnabled is expected value in IPXEHTTPRoute to disable the route + IPXEHTTPRouteDisabled string = "disabled" ) // AgentServiceConfigStatus defines the observed state of AgentServiceConfig diff --git a/vendor/github.com/openshift/assisted-service/api/v1beta1/infraenv_types.go b/vendor/github.com/openshift/assisted-service/api/v1beta1/infraenv_types.go index 8e6a3778..626a424e 100644 --- a/vendor/github.com/openshift/assisted-service/api/v1beta1/infraenv_types.go +++ b/vendor/github.com/openshift/assisted-service/api/v1beta1/infraenv_types.go @@ -88,6 +88,16 @@ type InfraEnvSpec struct { // +kubebuilder:default=x86_64 // +optional CpuArchitecture string `json:"cpuArchitecture,omitempty"` + + // IPXEScriptType the script type that should be served (DiscoveryImageAlways/BootOrderControl) + // DiscoveryImageAlways: Boot unconditionaly from the network discovery image + // BootOrderControl: Boot from discovery ISO depending on the host's state. + // When the value is BootOrderControl, the service will look for an Agent record that matches the host's MAC address; + // if found, and if that Agent is in a state where it is provisioned and attached to a cluster, then host will boot the host disk. + // Otherwise it will boot the discovery ISO using the same script as the DiscoveryImageAlways option. + // +kubebuilder:default=DiscoveryImageAlways + // +optional + IPXEScriptType IPXEScriptType `json:"ipxeScriptType"` } // Proxy defines the proxy settings for agents and clusters that use the InfraEnv. @@ -169,6 +179,18 @@ type InfraEnvList struct { Items []InfraEnv `json:"items"` } +// IPXEScriptType is the script type that should be served (BootOrderControl/DiscoveryImageAlways) +// +kubebuilder:validation:Enum="";DiscoveryImageAlways;BootOrderControl +type IPXEScriptType string + +const ( + // DiscoveryImageAlways - Boot from network + DiscoveryImageAlways IPXEScriptType = "DiscoveryImageAlways" + + // BootOrderControl - Boot with mac identification redirect script + BootOrderControl IPXEScriptType = "BootOrderControl" +) + func init() { SchemeBuilder.Register(&InfraEnv{}, &InfraEnvList{}) } diff --git a/vendor/github.com/openshift/assisted-service/api/v1beta1/zz_generated.deepcopy.go b/vendor/github.com/openshift/assisted-service/api/v1beta1/zz_generated.deepcopy.go index 57162d31..d93a93a7 100644 --- a/vendor/github.com/openshift/assisted-service/api/v1beta1/zz_generated.deepcopy.go +++ b/vendor/github.com/openshift/assisted-service/api/v1beta1/zz_generated.deepcopy.go @@ -56,6 +56,102 @@ func (in *Agent) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AgentClassification) DeepCopyInto(out *AgentClassification) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AgentClassification. +func (in *AgentClassification) DeepCopy() *AgentClassification { + if in == nil { + return nil + } + out := new(AgentClassification) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AgentClassification) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AgentClassificationList) DeepCopyInto(out *AgentClassificationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AgentClassification, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AgentClassificationList. +func (in *AgentClassificationList) DeepCopy() *AgentClassificationList { + if in == nil { + return nil + } + out := new(AgentClassificationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AgentClassificationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AgentClassificationSpec) DeepCopyInto(out *AgentClassificationSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AgentClassificationSpec. +func (in *AgentClassificationSpec) DeepCopy() *AgentClassificationSpec { + if in == nil { + return nil + } + out := new(AgentClassificationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AgentClassificationStatus) DeepCopyInto(out *AgentClassificationStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AgentClassificationStatus. +func (in *AgentClassificationStatus) DeepCopy() *AgentClassificationStatus { + if in == nil { + return nil + } + out := new(AgentClassificationStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AgentList) DeepCopyInto(out *AgentList) { *out = *in diff --git a/vendor/github.com/openshift/assisted-service/models/api_vip_connectivity_response.go b/vendor/github.com/openshift/assisted-service/models/api_vip_connectivity_response.go index 123febb6..918624c9 100644 --- a/vendor/github.com/openshift/assisted-service/models/api_vip_connectivity_response.go +++ b/vendor/github.com/openshift/assisted-service/models/api_vip_connectivity_response.go @@ -12,16 +12,24 @@ import ( "github.com/go-openapi/swag" ) -// APIVipConnectivityResponse api vip connectivity response +// APIVipConnectivityResponse The response from the day-2 agent's attempt to download the worker ignition file from the API machine config server of the target cluster. +// Note - the name "API VIP connectivity" is old and misleading and is preserved for backwards compatibility. // // swagger:model api_vip_connectivity_response type APIVipConnectivityResponse struct { - // Ignition fetched from the specified API VIP + // The error that occurred while downloading the worker ignition file, ignored when is_success is true + DownloadError string `json:"download_error,omitempty"` + + // Ignition file fetched from the target cluster's API machine config server. + // This ignition file may be incomplete as almost all files / systemd units are removed from it by the agent in order to save space. Ignition string `json:"ignition,omitempty"` - // Ignition downloadability check result. + // Whether the agent was able to download the ignition or not IsSuccess bool `json:"is_success,omitempty"` + + // This parameter mirrors the url parameter of the corresponding api_vip_connectivity_request + URL string `json:"url,omitempty"` } // Validate validates this api vip connectivity response diff --git a/vendor/github.com/openshift/assisted-service/models/cluster.go b/vendor/github.com/openshift/assisted-service/models/cluster.go index 038990ec..00e4a6d9 100644 --- a/vendor/github.com/openshift/assisted-service/models/cluster.go +++ b/vendor/github.com/openshift/assisted-service/models/cluster.go @@ -120,10 +120,6 @@ type Cluster struct { // Format: uuid ID *strfmt.UUID `json:"id" gorm:"primaryKey"` - // Json formatted string containing the user overrides for the initial ignition config - // Example: {\"ignition\": {\"version\": \"3.1.0\"}, \"storage\": {\"files\": [{\"path\": \"/tmp/example\", \"contents\": {\"source\": \"data:text/plain;base64,aGVscGltdHJhcHBlZGluYXN3YWdnZXJzcGVj\"}}]}} - IgnitionConfigOverrides string `json:"ignition_config_overrides,omitempty" gorm:"type:text"` - // Explicit ignition endpoint overrides the default ignition endpoint. IgnitionEndpoint *IgnitionEndpoint `json:"ignition_endpoint,omitempty" gorm:"embedded;embeddedPrefix:ignition_endpoint_"` @@ -131,6 +127,16 @@ type Cluster struct { // Required: true ImageInfo *ImageInfo `json:"image_info" gorm:"embedded;embeddedPrefix:image_"` + // Indicates whether this cluster is an imported day-2 cluster or a + // regular cluster. Clusters are considered imported when they are + // created via the ../clusters/import endpoint. Day-2 clusters converted + // from day-1 clusters by kube-api controllers or the + // ../clusters//actions/allow-add-workers endpoint are not + // considered imported. Imported clusters usually lack a lot of + // information and are filled with default values that don't necessarily + // reflect the actual cluster they represent + Imported *bool `json:"imported,omitempty"` + // The virtual IP used for cluster ingress traffic. // Pattern: ^(?:(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})|(?:(?:[0-9a-fA-F]*:[0-9a-fA-F]*){2,}))$ IngressVip string `json:"ingress_vip,omitempty"` @@ -205,6 +211,11 @@ type Cluster struct { // Schedule workloads on masters SchedulableMasters *bool `json:"schedulable_masters,omitempty"` + // Indicates if schedule workloads on masters will be enabled regardless the value of 'schedulable_masters' property. + // Set to 'true' when not enough hosts are associated with this cluster to disable the scheduling on masters. + // + SchedulableMastersForcedTrue *bool `json:"schedulable_masters_forced_true,omitempty"` + // The IP address pool to use for service IP addresses. You can enter only one IP address pool. If you need to access the services from an external network, configure load balancers and routers to manage the traffic. // Pattern: ^(?:(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3}\/(?:(?:[0-9])|(?:[1-2][0-9])|(?:3[0-2])))|(?:(?:[0-9a-fA-F]*:[0-9a-fA-F]*){2,})/(?:(?:[0-9])|(?:[1-9][0-9])|(?:1[0-1][0-9])|(?:12[0-8])))$ ServiceNetworkCidr string `json:"service_network_cidr,omitempty"` @@ -228,6 +239,9 @@ type Cluster struct { // Format: date-time StatusUpdatedAt strfmt.DateTime `json:"status_updated_at,omitempty" gorm:"type:timestamp with time zone"` + // A comma-separated list of tags that are associated to the cluster. + Tags string `json:"tags,omitempty"` + // All hosts associated to this cluster. TotalHostCount int64 `json:"total_host_count,omitempty" gorm:"-"` diff --git a/vendor/github.com/openshift/assisted-service/models/cluster_create_params.go b/vendor/github.com/openshift/assisted-service/models/cluster_create_params.go index c93f9322..32de99c7 100644 --- a/vendor/github.com/openshift/assisted-service/models/cluster_create_params.go +++ b/vendor/github.com/openshift/assisted-service/models/cluster_create_params.go @@ -122,6 +122,9 @@ type ClusterCreateParams struct { // SSH public key for debugging OpenShift nodes. SSHPublicKey string `json:"ssh_public_key,omitempty"` + // A comma-separated list of tags that are associated to the cluster. + Tags *string `json:"tags,omitempty"` + // Indicate if the networking is managed by the user. UserManagedNetworking *bool `json:"user_managed_networking,omitempty"` diff --git a/vendor/github.com/openshift/assisted-service/models/cluster_default_config.go b/vendor/github.com/openshift/assisted-service/models/cluster_default_config.go index b068ba21..f7466d5b 100644 --- a/vendor/github.com/openshift/assisted-service/models/cluster_default_config.go +++ b/vendor/github.com/openshift/assisted-service/models/cluster_default_config.go @@ -7,6 +7,7 @@ package models import ( "context" + "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -28,6 +29,15 @@ type ClusterDefaultConfig struct { // Minimum: 1 ClusterNetworkHostPrefix int64 `json:"cluster_network_host_prefix,omitempty"` + // cluster networks dualstack + ClusterNetworksDualstack []*ClusterNetwork `json:"cluster_networks_dualstack"` + + // cluster networks ipv4 + ClusterNetworksIPV4 []*ClusterNetwork `json:"cluster_networks_ipv4"` + + // This provides a list of forbidden hostnames. If this list is empty or not present, this implies that the UI should fall back to a hard coded list. + ForbiddenHostnames []string `json:"forbidden_hostnames"` + // inactive deletion hours InactiveDeletionHours int64 `json:"inactive_deletion_hours,omitempty"` @@ -37,6 +47,12 @@ type ClusterDefaultConfig struct { // service network cidr // Pattern: ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[\/]([1-9]|[1-2][0-9]|3[0-2]?)$ ServiceNetworkCidr string `json:"service_network_cidr,omitempty"` + + // service networks dualstack + ServiceNetworksDualstack []*ServiceNetwork `json:"service_networks_dualstack"` + + // service networks ipv4 + ServiceNetworksIPV4 []*ServiceNetwork `json:"service_networks_ipv4"` } // Validate validates this cluster default config @@ -51,10 +67,26 @@ func (m *ClusterDefaultConfig) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateClusterNetworksDualstack(formats); err != nil { + res = append(res, err) + } + + if err := m.validateClusterNetworksIPV4(formats); err != nil { + res = append(res, err) + } + if err := m.validateServiceNetworkCidr(formats); err != nil { res = append(res, err) } + if err := m.validateServiceNetworksDualstack(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceNetworksIPV4(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -89,6 +121,58 @@ func (m *ClusterDefaultConfig) validateClusterNetworkHostPrefix(formats strfmt.R return nil } +func (m *ClusterDefaultConfig) validateClusterNetworksDualstack(formats strfmt.Registry) error { + if swag.IsZero(m.ClusterNetworksDualstack) { // not required + return nil + } + + for i := 0; i < len(m.ClusterNetworksDualstack); i++ { + if swag.IsZero(m.ClusterNetworksDualstack[i]) { // not required + continue + } + + if m.ClusterNetworksDualstack[i] != nil { + if err := m.ClusterNetworksDualstack[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cluster_networks_dualstack" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cluster_networks_dualstack" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ClusterDefaultConfig) validateClusterNetworksIPV4(formats strfmt.Registry) error { + if swag.IsZero(m.ClusterNetworksIPV4) { // not required + return nil + } + + for i := 0; i < len(m.ClusterNetworksIPV4); i++ { + if swag.IsZero(m.ClusterNetworksIPV4[i]) { // not required + continue + } + + if m.ClusterNetworksIPV4[i] != nil { + if err := m.ClusterNetworksIPV4[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cluster_networks_ipv4" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cluster_networks_ipv4" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + func (m *ClusterDefaultConfig) validateServiceNetworkCidr(formats strfmt.Registry) error { if swag.IsZero(m.ServiceNetworkCidr) { // not required return nil @@ -101,8 +185,161 @@ func (m *ClusterDefaultConfig) validateServiceNetworkCidr(formats strfmt.Registr return nil } -// ContextValidate validates this cluster default config based on context it is used +func (m *ClusterDefaultConfig) validateServiceNetworksDualstack(formats strfmt.Registry) error { + if swag.IsZero(m.ServiceNetworksDualstack) { // not required + return nil + } + + for i := 0; i < len(m.ServiceNetworksDualstack); i++ { + if swag.IsZero(m.ServiceNetworksDualstack[i]) { // not required + continue + } + + if m.ServiceNetworksDualstack[i] != nil { + if err := m.ServiceNetworksDualstack[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service_networks_dualstack" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_networks_dualstack" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ClusterDefaultConfig) validateServiceNetworksIPV4(formats strfmt.Registry) error { + if swag.IsZero(m.ServiceNetworksIPV4) { // not required + return nil + } + + for i := 0; i < len(m.ServiceNetworksIPV4); i++ { + if swag.IsZero(m.ServiceNetworksIPV4[i]) { // not required + continue + } + + if m.ServiceNetworksIPV4[i] != nil { + if err := m.ServiceNetworksIPV4[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service_networks_ipv4" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_networks_ipv4" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this cluster default config based on the context it is used func (m *ClusterDefaultConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClusterNetworksDualstack(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateClusterNetworksIPV4(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceNetworksDualstack(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceNetworksIPV4(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ClusterDefaultConfig) contextValidateClusterNetworksDualstack(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ClusterNetworksDualstack); i++ { + + if m.ClusterNetworksDualstack[i] != nil { + if err := m.ClusterNetworksDualstack[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cluster_networks_dualstack" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cluster_networks_dualstack" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ClusterDefaultConfig) contextValidateClusterNetworksIPV4(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ClusterNetworksIPV4); i++ { + + if m.ClusterNetworksIPV4[i] != nil { + if err := m.ClusterNetworksIPV4[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cluster_networks_ipv4" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cluster_networks_ipv4" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ClusterDefaultConfig) contextValidateServiceNetworksDualstack(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ServiceNetworksDualstack); i++ { + + if m.ServiceNetworksDualstack[i] != nil { + if err := m.ServiceNetworksDualstack[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service_networks_dualstack" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_networks_dualstack" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ClusterDefaultConfig) contextValidateServiceNetworksIPV4(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ServiceNetworksIPV4); i++ { + + if m.ServiceNetworksIPV4[i] != nil { + if err := m.ServiceNetworksIPV4[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service_networks_ipv4" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_networks_ipv4" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + return nil } diff --git a/vendor/github.com/openshift/assisted-service/models/cluster_network.go b/vendor/github.com/openshift/assisted-service/models/cluster_network.go index 51f03afe..acb05816 100644 --- a/vendor/github.com/openshift/assisted-service/models/cluster_network.go +++ b/vendor/github.com/openshift/assisted-service/models/cluster_network.go @@ -14,7 +14,7 @@ import ( "github.com/go-openapi/validate" ) -// ClusterNetwork IP address block for pod IP blocks. +// ClusterNetwork A network from which Pod IPs are allocated. This block must not overlap with existing physical networks. These IP addresses are used for the Pod network, and if you need to access the Pods from an external network, configure load balancers and routers to manage the traffic. // // swagger:model cluster_network type ClusterNetwork struct { @@ -26,7 +26,7 @@ type ClusterNetwork struct { // Format: uuid ClusterID strfmt.UUID `json:"cluster_id,omitempty" gorm:"primaryKey"` - // The prefix size to allocate to each node from the CIDR. For example, 24 would allocate 2^8=256 adresses to each node. + // The subnet prefix length to assign to each individual node. For example if is set to 23, then each node is assigned a /23 subnet out of the given CIDR, which allows for 510 (2^(32 - 23) - 2) pod IPs addresses. // Maximum: 128 // Minimum: 1 HostPrefix int64 `json:"host_prefix,omitempty"` diff --git a/vendor/github.com/openshift/assisted-service/models/connectivity_check_nic.go b/vendor/github.com/openshift/assisted-service/models/connectivity_check_nic.go index e171d35c..dafaabe3 100644 --- a/vendor/github.com/openshift/assisted-service/models/connectivity_check_nic.go +++ b/vendor/github.com/openshift/assisted-service/models/connectivity_check_nic.go @@ -7,9 +7,12 @@ package models import ( "context" + "strconv" + "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + "github.com/go-openapi/validate" ) // ConnectivityCheckNic connectivity check nic @@ -21,7 +24,8 @@ type ConnectivityCheckNic struct { IPAddresses []string `json:"ip_addresses"` // mac - Mac string `json:"mac,omitempty"` + // Format: mac + Mac strfmt.MAC `json:"mac,omitempty"` // name Name string `json:"name,omitempty"` @@ -29,6 +33,47 @@ type ConnectivityCheckNic struct { // Validate validates this connectivity check nic func (m *ConnectivityCheckNic) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIPAddresses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMac(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ConnectivityCheckNic) validateIPAddresses(formats strfmt.Registry) error { + if swag.IsZero(m.IPAddresses) { // not required + return nil + } + + for i := 0; i < len(m.IPAddresses); i++ { + + if err := validate.Pattern("ip_addresses"+"."+strconv.Itoa(i), "body", m.IPAddresses[i], `^(?:(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})|(?:(?:[0-9a-fA-F]*:[0-9a-fA-F]*){2,}))$`); err != nil { + return err + } + + } + + return nil +} + +func (m *ConnectivityCheckNic) validateMac(formats strfmt.Registry) error { + if swag.IsZero(m.Mac) { // not required + return nil + } + + if err := validate.FormatOf("mac", "body", "mac", m.Mac.String(), formats); err != nil { + return err + } + return nil } diff --git a/vendor/github.com/openshift/assisted-service/models/container_image_availability_request.go b/vendor/github.com/openshift/assisted-service/models/container_image_availability_request.go index 932a23f8..9cd31493 100644 --- a/vendor/github.com/openshift/assisted-service/models/container_image_availability_request.go +++ b/vendor/github.com/openshift/assisted-service/models/container_image_availability_request.go @@ -7,6 +7,7 @@ package models import ( "context" + "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" @@ -47,6 +48,14 @@ func (m *ContainerImageAvailabilityRequest) validateImages(formats strfmt.Regist return err } + for i := 0; i < len(m.Images); i++ { + + if err := validate.Pattern("images"+"."+strconv.Itoa(i), "body", m.Images[i], `^(([a-zA-Z0-9\-\.]+)(:[0-9]+)?\/)?[a-z0-9\._\-\/@]+[?::a-zA-Z0-9_\-.]+$`); err != nil { + return err + } + + } + return nil } diff --git a/vendor/github.com/openshift/assisted-service/models/disk.go b/vendor/github.com/openshift/assisted-service/models/disk.go index ad80c5b0..631c97a1 100644 --- a/vendor/github.com/openshift/assisted-service/models/disk.go +++ b/vendor/github.com/openshift/assisted-service/models/disk.go @@ -28,11 +28,17 @@ type Disk struct { ByPath string `json:"by_path,omitempty"` // drive type - DriveType string `json:"drive_type,omitempty"` + DriveType DriveType `json:"drive_type,omitempty"` + + // has uuid + HasUUID bool `json:"has_uuid,omitempty"` // hctl Hctl string `json:"hctl,omitempty"` + // A comma-separated list of disk names that this disk belongs to + Holders string `json:"holders,omitempty"` + // Determine the disk's unique identifier which is the by-id field if it exists and fallback to the by-path field otherwise ID string `json:"id,omitempty"` @@ -77,6 +83,10 @@ type Disk struct { func (m *Disk) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateDriveType(formats); err != nil { + res = append(res, err) + } + if err := m.validateInstallationEligibility(formats); err != nil { res = append(res, err) } @@ -91,6 +101,23 @@ func (m *Disk) Validate(formats strfmt.Registry) error { return nil } +func (m *Disk) validateDriveType(formats strfmt.Registry) error { + if swag.IsZero(m.DriveType) { // not required + return nil + } + + if err := m.DriveType.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("drive_type") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("drive_type") + } + return err + } + + return nil +} + func (m *Disk) validateInstallationEligibility(formats strfmt.Registry) error { if swag.IsZero(m.InstallationEligibility) { // not required return nil @@ -131,6 +158,10 @@ func (m *Disk) validateIoPerf(formats strfmt.Registry) error { func (m *Disk) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error + if err := m.contextValidateDriveType(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateInstallationEligibility(ctx, formats); err != nil { res = append(res, err) } @@ -145,6 +176,20 @@ func (m *Disk) ContextValidate(ctx context.Context, formats strfmt.Registry) err return nil } +func (m *Disk) contextValidateDriveType(ctx context.Context, formats strfmt.Registry) error { + + if err := m.DriveType.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("drive_type") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("drive_type") + } + return err + } + + return nil +} + func (m *Disk) contextValidateInstallationEligibility(ctx context.Context, formats strfmt.Registry) error { if err := m.InstallationEligibility.ContextValidate(ctx, formats); err != nil { diff --git a/vendor/github.com/openshift/assisted-service/models/disk_skip_formatting_params.go b/vendor/github.com/openshift/assisted-service/models/disk_skip_formatting_params.go new file mode 100644 index 00000000..1427ade2 --- /dev/null +++ b/vendor/github.com/openshift/assisted-service/models/disk_skip_formatting_params.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// DiskSkipFormattingParams Allows an addition or removal of a host disk from the host's skip_formatting_disks list +// +// swagger:model disk-skip-formatting-params +type DiskSkipFormattingParams struct { + + // The ID of the disk that is being added to or removed from the host's skip_formatting_disks list + // Required: true + DiskID *string `json:"disk_id"` + + // True if you wish to add the disk to the skip_formatting_disks list, false if you wish to remove it + // Required: true + SkipFormatting *bool `json:"skip_formatting"` +} + +// Validate validates this disk skip formatting params +func (m *DiskSkipFormattingParams) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDiskID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSkipFormatting(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DiskSkipFormattingParams) validateDiskID(formats strfmt.Registry) error { + + if err := validate.Required("disk_id", "body", m.DiskID); err != nil { + return err + } + + return nil +} + +func (m *DiskSkipFormattingParams) validateSkipFormatting(formats strfmt.Registry) error { + + if err := validate.Required("skip_formatting", "body", m.SkipFormatting); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this disk skip formatting params based on context it is used +func (m *DiskSkipFormattingParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DiskSkipFormattingParams) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DiskSkipFormattingParams) UnmarshalBinary(b []byte) error { + var res DiskSkipFormattingParams + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/openshift/assisted-service/models/domain_resolution_request.go b/vendor/github.com/openshift/assisted-service/models/domain_resolution_request.go index bad2f28b..e3749853 100644 --- a/vendor/github.com/openshift/assisted-service/models/domain_resolution_request.go +++ b/vendor/github.com/openshift/assisted-service/models/domain_resolution_request.go @@ -125,6 +125,7 @@ type DomainResolutionRequestDomain struct { // The domain name that should be resolved // Required: true + // Pattern: ^([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*[.])+[a-zA-Z]{2,}$ DomainName *string `json:"domain_name"` } @@ -148,6 +149,10 @@ func (m *DomainResolutionRequestDomain) validateDomainName(formats strfmt.Regist return err } + if err := validate.Pattern("domain_name", "body", *m.DomainName, `^([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*[.])+[a-zA-Z]{2,}$`); err != nil { + return err + } + return nil } diff --git a/vendor/github.com/openshift/assisted-service/models/download_boot_artifacts_request.go b/vendor/github.com/openshift/assisted-service/models/download_boot_artifacts_request.go new file mode 100644 index 00000000..1774799f --- /dev/null +++ b/vendor/github.com/openshift/assisted-service/models/download_boot_artifacts_request.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// DownloadBootArtifactsRequest Information sent to the agent for downloading artifacts to boot a host into discovery. +// +// swagger:model download_boot_artifacts_request +type DownloadBootArtifactsRequest struct { + + // URL address to download the initrd. + // Required: true + InitrdURL *string `json:"initrd_url"` + + // URL address to download the kernel. + // Required: true + KernelURL *string `json:"kernel_url"` + + // URL address to download the rootfs. + // Required: true + RootfsURL *string `json:"rootfs_url"` +} + +// Validate validates this download boot artifacts request +func (m *DownloadBootArtifactsRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateInitrdURL(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKernelURL(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRootfsURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DownloadBootArtifactsRequest) validateInitrdURL(formats strfmt.Registry) error { + + if err := validate.Required("initrd_url", "body", m.InitrdURL); err != nil { + return err + } + + return nil +} + +func (m *DownloadBootArtifactsRequest) validateKernelURL(formats strfmt.Registry) error { + + if err := validate.Required("kernel_url", "body", m.KernelURL); err != nil { + return err + } + + return nil +} + +func (m *DownloadBootArtifactsRequest) validateRootfsURL(formats strfmt.Registry) error { + + if err := validate.Required("rootfs_url", "body", m.RootfsURL); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this download boot artifacts request based on context it is used +func (m *DownloadBootArtifactsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DownloadBootArtifactsRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DownloadBootArtifactsRequest) UnmarshalBinary(b []byte) error { + var res DownloadBootArtifactsRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/openshift/assisted-service/models/drive_type.go b/vendor/github.com/openshift/assisted-service/models/drive_type.go new file mode 100644 index 00000000..fdc42f61 --- /dev/null +++ b/vendor/github.com/openshift/assisted-service/models/drive_type.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// DriveType drive type +// +// swagger:model drive_type +type DriveType string + +func NewDriveType(value DriveType) *DriveType { + v := value + return &v +} + +const ( + + // DriveTypeUnknown captures enum value "Unknown" + DriveTypeUnknown DriveType = "Unknown" + + // DriveTypeHDD captures enum value "HDD" + DriveTypeHDD DriveType = "HDD" + + // DriveTypeFDD captures enum value "FDD" + DriveTypeFDD DriveType = "FDD" + + // DriveTypeODD captures enum value "ODD" + DriveTypeODD DriveType = "ODD" + + // DriveTypeSSD captures enum value "SSD" + DriveTypeSSD DriveType = "SSD" + + // DriveTypeVirtual captures enum value "virtual" + DriveTypeVirtual DriveType = "virtual" + + // DriveTypeMultipath captures enum value "Multipath" + DriveTypeMultipath DriveType = "Multipath" + + // DriveTypeISCSI captures enum value "iSCSI" + DriveTypeISCSI DriveType = "iSCSI" + + // DriveTypeFC captures enum value "FC" + DriveTypeFC DriveType = "FC" + + // DriveTypeLVM captures enum value "LVM" + DriveTypeLVM DriveType = "LVM" +) + +// for schema +var driveTypeEnum []interface{} + +func init() { + var res []DriveType + if err := json.Unmarshal([]byte(`["Unknown","HDD","FDD","ODD","SSD","virtual","Multipath","iSCSI","FC","LVM"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + driveTypeEnum = append(driveTypeEnum, v) + } +} + +func (m DriveType) validateDriveTypeEnum(path, location string, value DriveType) error { + if err := validate.EnumCase(path, location, value, driveTypeEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this drive type +func (m DriveType) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateDriveTypeEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this drive type based on context it is used +func (m DriveType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/openshift/assisted-service/models/feature_support_level.go b/vendor/github.com/openshift/assisted-service/models/feature_support_level.go index dc1dd216..a354a6f0 100644 --- a/vendor/github.com/openshift/assisted-service/models/feature_support_level.go +++ b/vendor/github.com/openshift/assisted-service/models/feature_support_level.go @@ -126,7 +126,7 @@ func (m *FeatureSupportLevel) UnmarshalBinary(b []byte) error { type FeatureSupportLevelFeaturesItems0 struct { // The ID of the feature - // Enum: [ADDITIONAL_NTP_SOURCE REQUESTED_HOSTNAME PROXY SNO DAY2_HOSTS VIP_AUTO_ALLOC DISK_SELECTION OVN_NETWORK_TYPE SDN_NETWORK_TYPE PLATFORM_SELECTION SCHEDULABLE_MASTERS AUTO_ASSIGN_ROLE CUSTOM_MANIFEST DISK_ENCRYPTION CLUSTER_MANAGED_NETWORKING_WITH_VMS ARM64_ARCHITECTURE] + // Enum: [ADDITIONAL_NTP_SOURCE REQUESTED_HOSTNAME PROXY SNO DAY2_HOSTS VIP_AUTO_ALLOC DISK_SELECTION OVN_NETWORK_TYPE SDN_NETWORK_TYPE PLATFORM_SELECTION SCHEDULABLE_MASTERS AUTO_ASSIGN_ROLE CUSTOM_MANIFEST DISK_ENCRYPTION CLUSTER_MANAGED_NETWORKING_WITH_VMS ARM64_ARCHITECTURE ARM64_ARCHITECTURE_WITH_CLUSTER_MANAGED_NETWORKING SINGLE_NODE_EXPANSION] FeatureID string `json:"feature_id,omitempty"` // support level @@ -156,7 +156,7 @@ var featureSupportLevelFeaturesItems0TypeFeatureIDPropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["ADDITIONAL_NTP_SOURCE","REQUESTED_HOSTNAME","PROXY","SNO","DAY2_HOSTS","VIP_AUTO_ALLOC","DISK_SELECTION","OVN_NETWORK_TYPE","SDN_NETWORK_TYPE","PLATFORM_SELECTION","SCHEDULABLE_MASTERS","AUTO_ASSIGN_ROLE","CUSTOM_MANIFEST","DISK_ENCRYPTION","CLUSTER_MANAGED_NETWORKING_WITH_VMS","ARM64_ARCHITECTURE"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["ADDITIONAL_NTP_SOURCE","REQUESTED_HOSTNAME","PROXY","SNO","DAY2_HOSTS","VIP_AUTO_ALLOC","DISK_SELECTION","OVN_NETWORK_TYPE","SDN_NETWORK_TYPE","PLATFORM_SELECTION","SCHEDULABLE_MASTERS","AUTO_ASSIGN_ROLE","CUSTOM_MANIFEST","DISK_ENCRYPTION","CLUSTER_MANAGED_NETWORKING_WITH_VMS","ARM64_ARCHITECTURE","ARM64_ARCHITECTURE_WITH_CLUSTER_MANAGED_NETWORKING","SINGLE_NODE_EXPANSION"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -213,6 +213,12 @@ const ( // FeatureSupportLevelFeaturesItems0FeatureIDARM64ARCHITECTURE captures enum value "ARM64_ARCHITECTURE" FeatureSupportLevelFeaturesItems0FeatureIDARM64ARCHITECTURE string = "ARM64_ARCHITECTURE" + + // FeatureSupportLevelFeaturesItems0FeatureIDARM64ARCHITECTUREWITHCLUSTERMANAGEDNETWORKING captures enum value "ARM64_ARCHITECTURE_WITH_CLUSTER_MANAGED_NETWORKING" + FeatureSupportLevelFeaturesItems0FeatureIDARM64ARCHITECTUREWITHCLUSTERMANAGEDNETWORKING string = "ARM64_ARCHITECTURE_WITH_CLUSTER_MANAGED_NETWORKING" + + // FeatureSupportLevelFeaturesItems0FeatureIDSINGLENODEEXPANSION captures enum value "SINGLE_NODE_EXPANSION" + FeatureSupportLevelFeaturesItems0FeatureIDSINGLENODEEXPANSION string = "SINGLE_NODE_EXPANSION" ) // prop value enum diff --git a/vendor/github.com/openshift/assisted-service/models/host.go b/vendor/github.com/openshift/assisted-service/models/host.go index 285b22b8..3f615dde 100644 --- a/vendor/github.com/openshift/assisted-service/models/host.go +++ b/vendor/github.com/openshift/assisted-service/models/host.go @@ -23,7 +23,7 @@ import ( // swagger:model host type Host struct { - // api vip connectivity + // Contains a serialized api_vip_connectivity_response APIVipConnectivity string `json:"api_vip_connectivity,omitempty" gorm:"type:text"` // bootstrap @@ -53,6 +53,13 @@ type Host struct { // Additional information about disks, formatted as JSON. DisksInfo string `json:"disks_info,omitempty" gorm:"type:text"` + // A comma-separated list of disks that will be formatted once + // installation begins, unless otherwise set to be skipped by + // skip_formatting_disks. This means that this list also includes disks + // that appear in skip_formatting_disks. This property is managed by the + // service and cannot be modified by the user. + DisksToBeFormatted string `json:"disks_to_be_formatted,omitempty" gorm:"type:text"` + // The domain name resolution result. DomainNameResolutions string `json:"domain_name_resolutions,omitempty" gorm:"type:text"` @@ -119,6 +126,13 @@ type Host struct { // machine config pool name MachineConfigPoolName string `json:"machine_config_pool_name,omitempty"` + // media status + // Enum: [connected disconnected] + MediaStatus *string `json:"media_status,omitempty"` + + // Json containing node's labels. + NodeLabels string `json:"node_labels,omitempty" gorm:"type:text"` + // The configured NTP sources on the host. NtpSources string `json:"ntp_sources,omitempty" gorm:"type:text"` @@ -128,12 +142,20 @@ type Host struct { // progress stages ProgressStages []HostStage `json:"progress_stages" gorm:"-"` + // The last time the host's agent tried to register in the service. + // Format: date-time + RegisteredAt strfmt.DateTime `json:"registered_at,omitempty" gorm:"type:timestamp with time zone"` + // requested hostname RequestedHostname string `json:"requested_hostname,omitempty"` // role Role HostRole `json:"role,omitempty"` + // A comma-seperated list of host disks that the service will avoid + // formatting. + SkipFormattingDisks string `json:"skip_formatting_disks,omitempty" gorm:"type:text"` + // Time at which the current progress stage started. // Format: date-time StageStartedAt strfmt.DateTime `json:"stage_started_at,omitempty" gorm:"type:timestamp with time zone"` @@ -144,7 +166,7 @@ type Host struct { // status // Required: true - // Enum: [discovering known disconnected insufficient disabled preparing-for-installation preparing-failed preparing-successful pending-for-input installing installing-in-progress installing-pending-user-action resetting-pending-user-action installed error resetting added-to-existing-cluster cancelled binding unbinding unbinding-pending-user-action known-unbound disconnected-unbound insufficient-unbound disabled-unbound discovering-unbound] + // Enum: [discovering known disconnected insufficient disabled preparing-for-installation preparing-failed preparing-successful pending-for-input installing installing-in-progress installing-pending-user-action resetting-pending-user-action installed error resetting added-to-existing-cluster cancelled binding unbinding unbinding-pending-user-action known-unbound disconnected-unbound insufficient-unbound disabled-unbound discovering-unbound reclaiming reclaiming-rebooting] Status *string `json:"status"` // status info @@ -158,6 +180,12 @@ type Host struct { // suggested role SuggestedRole HostRole `json:"suggested_role,omitempty"` + // tang connectivity + TangConnectivity string `json:"tang_connectivity,omitempty" gorm:"type:text"` + + // The time on the host as seconds since the Unix epoch. + Timestamp int64 `json:"timestamp,omitempty"` + // updated at // Format: date-time UpdatedAt timeext.Time `json:"updated_at,omitempty" gorm:"type:timestamp with time zone"` @@ -213,6 +241,10 @@ func (m *Host) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateMediaStatus(formats); err != nil { + res = append(res, err) + } + if err := m.validateProgress(formats); err != nil { res = append(res, err) } @@ -221,6 +253,10 @@ func (m *Host) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateRegisteredAt(formats); err != nil { + res = append(res, err) + } + if err := m.validateRole(formats); err != nil { res = append(res, err) } @@ -413,6 +449,48 @@ func (m *Host) validateLogsStartedAt(formats strfmt.Registry) error { return nil } +var hostTypeMediaStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["connected","disconnected"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hostTypeMediaStatusPropEnum = append(hostTypeMediaStatusPropEnum, v) + } +} + +const ( + + // HostMediaStatusConnected captures enum value "connected" + HostMediaStatusConnected string = "connected" + + // HostMediaStatusDisconnected captures enum value "disconnected" + HostMediaStatusDisconnected string = "disconnected" +) + +// prop value enum +func (m *Host) validateMediaStatusEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, hostTypeMediaStatusPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *Host) validateMediaStatus(formats strfmt.Registry) error { + if swag.IsZero(m.MediaStatus) { // not required + return nil + } + + // value enum + if err := m.validateMediaStatusEnum("media_status", "body", *m.MediaStatus); err != nil { + return err + } + + return nil +} + func (m *Host) validateProgress(formats strfmt.Registry) error { if swag.IsZero(m.Progress) { // not required return nil @@ -453,6 +531,18 @@ func (m *Host) validateProgressStages(formats strfmt.Registry) error { return nil } +func (m *Host) validateRegisteredAt(formats strfmt.Registry) error { + if swag.IsZero(m.RegisteredAt) { // not required + return nil + } + + if err := validate.FormatOf("registered_at", "body", "date-time", m.RegisteredAt.String(), formats); err != nil { + return err + } + + return nil +} + func (m *Host) validateRole(formats strfmt.Registry) error { if swag.IsZero(m.Role) { // not required return nil @@ -498,7 +588,7 @@ var hostTypeStatusPropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["discovering","known","disconnected","insufficient","disabled","preparing-for-installation","preparing-failed","preparing-successful","pending-for-input","installing","installing-in-progress","installing-pending-user-action","resetting-pending-user-action","installed","error","resetting","added-to-existing-cluster","cancelled","binding","unbinding","unbinding-pending-user-action","known-unbound","disconnected-unbound","insufficient-unbound","disabled-unbound","discovering-unbound"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["discovering","known","disconnected","insufficient","disabled","preparing-for-installation","preparing-failed","preparing-successful","pending-for-input","installing","installing-in-progress","installing-pending-user-action","resetting-pending-user-action","installed","error","resetting","added-to-existing-cluster","cancelled","binding","unbinding","unbinding-pending-user-action","known-unbound","disconnected-unbound","insufficient-unbound","disabled-unbound","discovering-unbound","reclaiming","reclaiming-rebooting"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -585,6 +675,12 @@ const ( // HostStatusDiscoveringUnbound captures enum value "discovering-unbound" HostStatusDiscoveringUnbound string = "discovering-unbound" + + // HostStatusReclaiming captures enum value "reclaiming" + HostStatusReclaiming string = "reclaiming" + + // HostStatusReclaimingRebooting captures enum value "reclaiming-rebooting" + HostStatusReclaimingRebooting string = "reclaiming-rebooting" ) // prop value enum diff --git a/vendor/github.com/openshift/assisted-service/models/host_update_params.go b/vendor/github.com/openshift/assisted-service/models/host_update_params.go index 5c43230f..2f8eba2e 100644 --- a/vendor/github.com/openshift/assisted-service/models/host_update_params.go +++ b/vendor/github.com/openshift/assisted-service/models/host_update_params.go @@ -24,6 +24,9 @@ type HostUpdateParams struct { // disks selected config DisksSelectedConfig []*DiskConfigParams `json:"disks_selected_config"` + // Allows changing the host's skip_formatting_disks parameter + DisksSkipFormatting []*DiskSkipFormattingParams `json:"disks_skip_formatting"` + // host name HostName *string `json:"host_name,omitempty"` @@ -36,6 +39,9 @@ type HostUpdateParams struct { // machine config pool name MachineConfigPoolName *string `json:"machine_config_pool_name,omitempty"` + + // Labels to be added to the corresponding node. + NodeLabels []*NodeLabelParams `json:"node_labels"` } // Validate validates this host update params @@ -46,10 +52,18 @@ func (m *HostUpdateParams) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateDisksSkipFormatting(formats); err != nil { + res = append(res, err) + } + if err := m.validateHostRole(formats); err != nil { res = append(res, err) } + if err := m.validateNodeLabels(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -82,6 +96,32 @@ func (m *HostUpdateParams) validateDisksSelectedConfig(formats strfmt.Registry) return nil } +func (m *HostUpdateParams) validateDisksSkipFormatting(formats strfmt.Registry) error { + if swag.IsZero(m.DisksSkipFormatting) { // not required + return nil + } + + for i := 0; i < len(m.DisksSkipFormatting); i++ { + if swag.IsZero(m.DisksSkipFormatting[i]) { // not required + continue + } + + if m.DisksSkipFormatting[i] != nil { + if err := m.DisksSkipFormatting[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disks_skip_formatting" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disks_skip_formatting" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + var hostUpdateParamsTypeHostRolePropEnum []interface{} func init() { @@ -127,6 +167,32 @@ func (m *HostUpdateParams) validateHostRole(formats strfmt.Registry) error { return nil } +func (m *HostUpdateParams) validateNodeLabels(formats strfmt.Registry) error { + if swag.IsZero(m.NodeLabels) { // not required + return nil + } + + for i := 0; i < len(m.NodeLabels); i++ { + if swag.IsZero(m.NodeLabels[i]) { // not required + continue + } + + if m.NodeLabels[i] != nil { + if err := m.NodeLabels[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("node_labels" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("node_labels" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // ContextValidate validate this host update params based on the context it is used func (m *HostUpdateParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -135,6 +201,14 @@ func (m *HostUpdateParams) ContextValidate(ctx context.Context, formats strfmt.R res = append(res, err) } + if err := m.contextValidateDisksSkipFormatting(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNodeLabels(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -161,6 +235,46 @@ func (m *HostUpdateParams) contextValidateDisksSelectedConfig(ctx context.Contex return nil } +func (m *HostUpdateParams) contextValidateDisksSkipFormatting(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.DisksSkipFormatting); i++ { + + if m.DisksSkipFormatting[i] != nil { + if err := m.DisksSkipFormatting[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("disks_skip_formatting" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("disks_skip_formatting" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HostUpdateParams) contextValidateNodeLabels(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.NodeLabels); i++ { + + if m.NodeLabels[i] != nil { + if err := m.NodeLabels[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("node_labels" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("node_labels" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + // MarshalBinary interface implementation func (m *HostUpdateParams) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/vendor/github.com/openshift/assisted-service/models/host_validation_id.go b/vendor/github.com/openshift/assisted-service/models/host_validation_id.go index 452a3d04..ecf7124d 100644 --- a/vendor/github.com/openshift/assisted-service/models/host_validation_id.go +++ b/vendor/github.com/openshift/assisted-service/models/host_validation_id.go @@ -29,6 +29,9 @@ const ( // HostValidationIDConnected captures enum value "connected" HostValidationIDConnected HostValidationID = "connected" + // HostValidationIDMediaConnected captures enum value "media-connected" + HostValidationIDMediaConnected HostValidationID = "media-connected" + // HostValidationIDHasInventory captures enum value "has-inventory" HostValidationIDHasInventory HostValidationID = "has-inventory" @@ -115,6 +118,24 @@ const ( // HostValidationIDDiskEncryptionRequirementsSatisfied captures enum value "disk-encryption-requirements-satisfied" HostValidationIDDiskEncryptionRequirementsSatisfied HostValidationID = "disk-encryption-requirements-satisfied" + + // HostValidationIDNonOverlappingSubnets captures enum value "non-overlapping-subnets" + HostValidationIDNonOverlappingSubnets HostValidationID = "non-overlapping-subnets" + + // HostValidationIDVsphereDiskUUIDEnabled captures enum value "vsphere-disk-uuid-enabled" + HostValidationIDVsphereDiskUUIDEnabled HostValidationID = "vsphere-disk-uuid-enabled" + + // HostValidationIDCompatibleAgent captures enum value "compatible-agent" + HostValidationIDCompatibleAgent HostValidationID = "compatible-agent" + + // HostValidationIDNoSkipInstallationDisk captures enum value "no-skip-installation-disk" + HostValidationIDNoSkipInstallationDisk HostValidationID = "no-skip-installation-disk" + + // HostValidationIDNoSkipMissingDisk captures enum value "no-skip-missing-disk" + HostValidationIDNoSkipMissingDisk HostValidationID = "no-skip-missing-disk" + + // HostValidationIDServiceHasSufficientSpokeKubeAPIAccess captures enum value "service-has-sufficient-spoke-kube-api-access" + HostValidationIDServiceHasSufficientSpokeKubeAPIAccess HostValidationID = "service-has-sufficient-spoke-kube-api-access" ) // for schema @@ -122,7 +143,7 @@ var hostValidationIdEnum []interface{} func init() { var res []HostValidationID - if err := json.Unmarshal([]byte(`["connected","has-inventory","has-min-cpu-cores","has-min-valid-disks","has-min-memory","machine-cidr-defined","has-cpu-cores-for-role","has-memory-for-role","hostname-unique","hostname-valid","belongs-to-machine-cidr","ignition-downloadable","belongs-to-majority-group","valid-platform-network-settings","ntp-synced","container-images-available","lso-requirements-satisfied","ocs-requirements-satisfied","odf-requirements-satisfied","sufficient-installation-disk-speed","cnv-requirements-satisfied","sufficient-network-latency-requirement-for-role","sufficient-packet-loss-requirement-for-role","has-default-route","api-domain-name-resolved-correctly","api-int-domain-name-resolved-correctly","apps-domain-name-resolved-correctly","compatible-with-cluster-platform","dns-wildcard-not-configured","disk-encryption-requirements-satisfied"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["connected","media-connected","has-inventory","has-min-cpu-cores","has-min-valid-disks","has-min-memory","machine-cidr-defined","has-cpu-cores-for-role","has-memory-for-role","hostname-unique","hostname-valid","belongs-to-machine-cidr","ignition-downloadable","belongs-to-majority-group","valid-platform-network-settings","ntp-synced","container-images-available","lso-requirements-satisfied","ocs-requirements-satisfied","odf-requirements-satisfied","sufficient-installation-disk-speed","cnv-requirements-satisfied","sufficient-network-latency-requirement-for-role","sufficient-packet-loss-requirement-for-role","has-default-route","api-domain-name-resolved-correctly","api-int-domain-name-resolved-correctly","apps-domain-name-resolved-correctly","compatible-with-cluster-platform","dns-wildcard-not-configured","disk-encryption-requirements-satisfied","non-overlapping-subnets","vsphere-disk-uuid-enabled","compatible-agent","no-skip-installation-disk","no-skip-missing-disk","service-has-sufficient-spoke-kube-api-access"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/vendor/github.com/openshift/assisted-service/models/install_cmd_request.go b/vendor/github.com/openshift/assisted-service/models/install_cmd_request.go index c25743cf..ea633209 100644 --- a/vendor/github.com/openshift/assisted-service/models/install_cmd_request.go +++ b/vendor/github.com/openshift/assisted-service/models/install_cmd_request.go @@ -35,6 +35,7 @@ type InstallCmdRequest struct { // Assisted installer controller image // Required: true + // Pattern: ^(([a-zA-Z0-9\-\.]+)(:[0-9]+)?\/)?[a-z0-9\._\-\/@]+[?::a-zA-Z0-9_\-.]+$ ControllerImage *string `json:"controller_image"` // List of disks to format @@ -43,9 +44,8 @@ type InstallCmdRequest struct { // Guaranteed availability of the installed cluster. 'Full' installs a Highly-Available cluster // over multiple master nodes whereas 'None' installs a full cluster over one node. // - // Required: true // Enum: [Full None] - HighAvailabilityMode *string `json:"high_availability_mode"` + HighAvailabilityMode *string `json:"high_availability_mode,omitempty"` // Host id // Required: true @@ -62,9 +62,11 @@ type InstallCmdRequest struct { // Assisted installer image // Required: true + // Pattern: ^(([a-zA-Z0-9\-\.]+)(:[0-9]+)?\/)?[a-z0-9\._\-\/@]+[?::a-zA-Z0-9_\-.]+$ InstallerImage *string `json:"installer_image"` // Machine config operator image + // Pattern: ^(([a-zA-Z0-9\-\.]+)(:[0-9]+)?\/)?[a-z0-9\._\-\/@]+[?::a-zA-Z0-9_\-.]+$ McoImage string `json:"mco_image,omitempty"` // Must-gather images to use @@ -82,6 +84,9 @@ type InstallCmdRequest struct { // List of service ips ServiceIps []string `json:"service_ips"` + + // Skip formatting installation disk + SkipInstallationDiskCleanup bool `json:"skip_installation_disk_cleanup,omitempty"` } // Validate validates this install cmd request @@ -116,6 +121,10 @@ func (m *InstallCmdRequest) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateMcoImage(formats); err != nil { + res = append(res, err) + } + if err := m.validateProxy(formats); err != nil { res = append(res, err) } @@ -162,6 +171,10 @@ func (m *InstallCmdRequest) validateControllerImage(formats strfmt.Registry) err return err } + if err := validate.Pattern("controller_image", "body", *m.ControllerImage, `^(([a-zA-Z0-9\-\.]+)(:[0-9]+)?\/)?[a-z0-9\._\-\/@]+[?::a-zA-Z0-9_\-.]+$`); err != nil { + return err + } + return nil } @@ -195,9 +208,8 @@ func (m *InstallCmdRequest) validateHighAvailabilityModeEnum(path, location stri } func (m *InstallCmdRequest) validateHighAvailabilityMode(formats strfmt.Registry) error { - - if err := validate.Required("high_availability_mode", "body", m.HighAvailabilityMode); err != nil { - return err + if swag.IsZero(m.HighAvailabilityMode) { // not required + return nil } // value enum @@ -240,6 +252,22 @@ func (m *InstallCmdRequest) validateInstallerImage(formats strfmt.Registry) erro return err } + if err := validate.Pattern("installer_image", "body", *m.InstallerImage, `^(([a-zA-Z0-9\-\.]+)(:[0-9]+)?\/)?[a-z0-9\._\-\/@]+[?::a-zA-Z0-9_\-.]+$`); err != nil { + return err + } + + return nil +} + +func (m *InstallCmdRequest) validateMcoImage(formats strfmt.Registry) error { + if swag.IsZero(m.McoImage) { // not required + return nil + } + + if err := validate.Pattern("mco_image", "body", m.McoImage, `^(([a-zA-Z0-9\-\.]+)(:[0-9]+)?\/)?[a-z0-9\._\-\/@]+[?::a-zA-Z0-9_\-.]+$`); err != nil { + return err + } + return nil } diff --git a/vendor/github.com/openshift/assisted-service/models/interface.go b/vendor/github.com/openshift/assisted-service/models/interface.go index 4652b943..655314da 100644 --- a/vendor/github.com/openshift/assisted-service/models/interface.go +++ b/vendor/github.com/openshift/assisted-service/models/interface.go @@ -50,6 +50,9 @@ type Interface struct { // speed mbps SpeedMbps int64 `json:"speed_mbps,omitempty"` + // type + Type string `json:"type,omitempty"` + // vendor Vendor string `json:"vendor,omitempty"` } diff --git a/vendor/github.com/openshift/assisted-service/models/inventory.go b/vendor/github.com/openshift/assisted-service/models/inventory.go index aa149b93..5b7ff28c 100644 --- a/vendor/github.com/openshift/assisted-service/models/inventory.go +++ b/vendor/github.com/openshift/assisted-service/models/inventory.go @@ -54,9 +54,6 @@ type Inventory struct { // system vendor SystemVendor *SystemVendor `json:"system_vendor,omitempty"` - // timestamp - Timestamp int64 `json:"timestamp,omitempty"` - // tpm version // Enum: [none 1.2 2.0] TpmVersion string `json:"tpm_version,omitempty"` diff --git a/vendor/github.com/openshift/assisted-service/models/machine_network.go b/vendor/github.com/openshift/assisted-service/models/machine_network.go index cf6cf3b3..40ec0984 100644 --- a/vendor/github.com/openshift/assisted-service/models/machine_network.go +++ b/vendor/github.com/openshift/assisted-service/models/machine_network.go @@ -14,12 +14,12 @@ import ( "github.com/go-openapi/validate" ) -// MachineNetwork IP address block for node IP blocks. +// MachineNetwork A network that all hosts belonging to the cluster should have an interface with IP address in. The VIPs (if exist) belong to this network. // // swagger:model machine_network type MachineNetwork struct { - // The IP block address pool for machines within the cluster. + // The IP block address pool. Cidr Subnet `json:"cidr,omitempty" gorm:"primaryKey"` // The cluster that this network is associated with. diff --git a/vendor/github.com/openshift/assisted-service/models/next_step_cmd_request.go b/vendor/github.com/openshift/assisted-service/models/next_step_cmd_request.go index a9344e39..3f6dcf76 100644 --- a/vendor/github.com/openshift/assisted-service/models/next_step_cmd_request.go +++ b/vendor/github.com/openshift/assisted-service/models/next_step_cmd_request.go @@ -21,6 +21,7 @@ type NextStepCmdRequest struct { // Agent image version // Required: true + // Pattern: ^(([a-zA-Z0-9\-\.]+)(:[0-9]+)?\/)?[a-z0-9\._\-\/@]+[?::a-zA-Z0-9_\-.]+$ AgentVersion *string `json:"agent_version"` // Host id @@ -62,6 +63,10 @@ func (m *NextStepCmdRequest) validateAgentVersion(formats strfmt.Registry) error return err } + if err := validate.Pattern("agent_version", "body", *m.AgentVersion, `^(([a-zA-Z0-9\-\.]+)(:[0-9]+)?\/)?[a-z0-9\._\-\/@]+[?::a-zA-Z0-9_\-.]+$`); err != nil { + return err + } + return nil } diff --git a/vendor/github.com/openshift/assisted-service/models/node_label_params.go b/vendor/github.com/openshift/assisted-service/models/node_label_params.go new file mode 100644 index 00000000..07395e91 --- /dev/null +++ b/vendor/github.com/openshift/assisted-service/models/node_label_params.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// NodeLabelParams node label params +// +// swagger:model node-label-params +type NodeLabelParams struct { + + // The key for the label's key-value pair. + // Required: true + Key *string `json:"key"` + + // The value for the label's key-value pair. + // Required: true + Value *string `json:"value"` +} + +// Validate validates this node label params +func (m *NodeLabelParams) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateKey(formats); err != nil { + res = append(res, err) + } + + if err := m.validateValue(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NodeLabelParams) validateKey(formats strfmt.Registry) error { + + if err := validate.Required("key", "body", m.Key); err != nil { + return err + } + + return nil +} + +func (m *NodeLabelParams) validateValue(formats strfmt.Registry) error { + + if err := validate.Required("value", "body", m.Value); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this node label params based on context it is used +func (m *NodeLabelParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NodeLabelParams) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NodeLabelParams) UnmarshalBinary(b []byte) error { + var res NodeLabelParams + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/openshift/assisted-service/models/os_image.go b/vendor/github.com/openshift/assisted-service/models/os_image.go index 0f318829..5c318a05 100644 --- a/vendor/github.com/openshift/assisted-service/models/os_image.go +++ b/vendor/github.com/openshift/assisted-service/models/os_image.go @@ -27,10 +27,6 @@ type OsImage struct { // Required: true OpenshiftVersion *string `json:"openshift_version"` - // The OS rootfs url. - // Required: true - RootfsURL *string `json:"rootfs_url"` - // The base OS image used for the discovery iso. // Required: true URL *string `json:"url"` @@ -52,10 +48,6 @@ func (m *OsImage) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateRootfsURL(formats); err != nil { - res = append(res, err) - } - if err := m.validateURL(formats); err != nil { res = append(res, err) } @@ -88,15 +80,6 @@ func (m *OsImage) validateOpenshiftVersion(formats strfmt.Registry) error { return nil } -func (m *OsImage) validateRootfsURL(formats strfmt.Registry) error { - - if err := validate.Required("rootfs_url", "body", m.RootfsURL); err != nil { - return err - } - - return nil -} - func (m *OsImage) validateURL(formats strfmt.Registry) error { if err := validate.Required("url", "body", m.URL); err != nil { diff --git a/vendor/github.com/openshift/assisted-service/models/ovirt_platform.go b/vendor/github.com/openshift/assisted-service/models/ovirt_platform.go deleted file mode 100644 index 3ecc6cc4..00000000 --- a/vendor/github.com/openshift/assisted-service/models/ovirt_platform.go +++ /dev/null @@ -1,149 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// OvirtPlatform oVirt platform-specific configuration upon which to perform the installation. -// -// swagger:model ovirt-platform -type OvirtPlatform struct { - - // The CA Bundle of the oVirt's engine certificate. - CaBundle *string `json:"ca_bundle,omitempty"` - - // The oVirt cluster ID. - // Format: uuid - ClusterID *strfmt.UUID `json:"cluster_id,omitempty"` - - // The oVirt's engine fully qualified domain name. - Fqdn *string `json:"fqdn,omitempty"` - - // Verify oVirt engine certificate. - Insecure *bool `json:"insecure,omitempty"` - - // The oVirt network the VMs will be attached to. - NetworkName *string `json:"network_name,omitempty"` - - // The password for the oVirt user name. - // Format: password - Password *strfmt.Password `json:"password,omitempty"` - - // The oVirt storage domain ID. - // Format: uuid - StorageDomainID *strfmt.UUID `json:"storage_domain_id,omitempty"` - - // The user name to use to connect to the oVirt instance. - Username *string `json:"username,omitempty"` - - // The oVirt VNIC profile ID. - // Format: uuid - VnicProfileID *strfmt.UUID `json:"vnic_profile_id,omitempty"` -} - -// Validate validates this ovirt platform -func (m *OvirtPlatform) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateClusterID(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePassword(formats); err != nil { - res = append(res, err) - } - - if err := m.validateStorageDomainID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateVnicProfileID(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OvirtPlatform) validateClusterID(formats strfmt.Registry) error { - if swag.IsZero(m.ClusterID) { // not required - return nil - } - - if err := validate.FormatOf("cluster_id", "body", "uuid", m.ClusterID.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *OvirtPlatform) validatePassword(formats strfmt.Registry) error { - if swag.IsZero(m.Password) { // not required - return nil - } - - if err := validate.FormatOf("password", "body", "password", m.Password.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *OvirtPlatform) validateStorageDomainID(formats strfmt.Registry) error { - if swag.IsZero(m.StorageDomainID) { // not required - return nil - } - - if err := validate.FormatOf("storage_domain_id", "body", "uuid", m.StorageDomainID.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *OvirtPlatform) validateVnicProfileID(formats strfmt.Registry) error { - if swag.IsZero(m.VnicProfileID) { // not required - return nil - } - - if err := validate.FormatOf("vnic_profile_id", "body", "uuid", m.VnicProfileID.String(), formats); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this ovirt platform based on context it is used -func (m *OvirtPlatform) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OvirtPlatform) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OvirtPlatform) UnmarshalBinary(b []byte) error { - var res OvirtPlatform - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/vendor/github.com/openshift/assisted-service/models/platform.go b/vendor/github.com/openshift/assisted-service/models/platform.go index ead551ee..c38e108b 100644 --- a/vendor/github.com/openshift/assisted-service/models/platform.go +++ b/vendor/github.com/openshift/assisted-service/models/platform.go @@ -19,9 +19,6 @@ import ( // swagger:model platform type Platform struct { - // ovirt - Ovirt *OvirtPlatform `json:"ovirt,omitempty" gorm:"embedded;embeddedPrefix:ovirt_"` - // type // Required: true Type *PlatformType `json:"type"` @@ -31,10 +28,6 @@ type Platform struct { func (m *Platform) Validate(formats strfmt.Registry) error { var res []error - if err := m.validateOvirt(formats); err != nil { - res = append(res, err) - } - if err := m.validateType(formats); err != nil { res = append(res, err) } @@ -45,25 +38,6 @@ func (m *Platform) Validate(formats strfmt.Registry) error { return nil } -func (m *Platform) validateOvirt(formats strfmt.Registry) error { - if swag.IsZero(m.Ovirt) { // not required - return nil - } - - if m.Ovirt != nil { - if err := m.Ovirt.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ovirt") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ovirt") - } - return err - } - } - - return nil -} - func (m *Platform) validateType(formats strfmt.Registry) error { if err := validate.Required("type", "body", m.Type); err != nil { @@ -92,10 +66,6 @@ func (m *Platform) validateType(formats strfmt.Registry) error { func (m *Platform) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error - if err := m.contextValidateOvirt(ctx, formats); err != nil { - res = append(res, err) - } - if err := m.contextValidateType(ctx, formats); err != nil { res = append(res, err) } @@ -106,22 +76,6 @@ func (m *Platform) ContextValidate(ctx context.Context, formats strfmt.Registry) return nil } -func (m *Platform) contextValidateOvirt(ctx context.Context, formats strfmt.Registry) error { - - if m.Ovirt != nil { - if err := m.Ovirt.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("ovirt") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("ovirt") - } - return err - } - } - - return nil -} - func (m *Platform) contextValidateType(ctx context.Context, formats strfmt.Registry) error { if m.Type != nil { diff --git a/vendor/github.com/openshift/assisted-service/models/release_image.go b/vendor/github.com/openshift/assisted-service/models/release_image.go index f7e48f9a..5a036d57 100644 --- a/vendor/github.com/openshift/assisted-service/models/release_image.go +++ b/vendor/github.com/openshift/assisted-service/models/release_image.go @@ -20,10 +20,13 @@ import ( // swagger:model release-image type ReleaseImage struct { - // The CPU architecture of the image (x86_64/arm64/etc). + // (DEPRECATED) The CPU architecture of the image (x86_64/arm64/etc). // Required: true CPUArchitecture *string `json:"cpu_architecture" gorm:"default:'x86_64'"` + // List of CPU architectures provided by the image. + CPUArchitectures []string `json:"cpu_architectures"` + // Indication that the version is the recommended one. Default bool `json:"default,omitempty"` diff --git a/vendor/github.com/openshift/assisted-service/models/route.go b/vendor/github.com/openshift/assisted-service/models/route.go index f1b5638f..0746c93e 100644 --- a/vendor/github.com/openshift/assisted-service/models/route.go +++ b/vendor/github.com/openshift/assisted-service/models/route.go @@ -28,6 +28,9 @@ type Route struct { // Interface to which packets for this route will be sent Interface string `json:"interface,omitempty"` + + // Route priority metric + Metric int32 `json:"metric,omitempty"` } // Validate validates this route diff --git a/vendor/github.com/openshift/assisted-service/models/service_network.go b/vendor/github.com/openshift/assisted-service/models/service_network.go index e519760d..413d01e8 100644 --- a/vendor/github.com/openshift/assisted-service/models/service_network.go +++ b/vendor/github.com/openshift/assisted-service/models/service_network.go @@ -22,7 +22,7 @@ type ServiceNetwork struct { // The IP block address pool. Cidr Subnet `json:"cidr,omitempty" gorm:"primaryKey"` - // The cluster that this network is associated with. + // A network to use for service IP addresses. If you need to access the services from an external network, configure load balancers and routers to manage the traffic. // Format: uuid ClusterID strfmt.UUID `json:"cluster_id,omitempty" gorm:"primaryKey"` } diff --git a/vendor/github.com/openshift/assisted-service/models/step.go b/vendor/github.com/openshift/assisted-service/models/step.go index ba9f5e6d..61ebc9b9 100644 --- a/vendor/github.com/openshift/assisted-service/models/step.go +++ b/vendor/github.com/openshift/assisted-service/models/step.go @@ -21,9 +21,6 @@ type Step struct { // args Args []string `json:"args"` - // command - Command string `json:"command,omitempty"` - // step id StepID string `json:"step_id,omitempty"` diff --git a/vendor/github.com/openshift/assisted-service/models/step_type.go b/vendor/github.com/openshift/assisted-service/models/step_type.go index a5ed7df6..7c5a066b 100644 --- a/vendor/github.com/openshift/assisted-service/models/step_type.go +++ b/vendor/github.com/openshift/assisted-service/models/step_type.go @@ -47,6 +47,9 @@ const ( // StepTypeAPIVipConnectivityCheck captures enum value "api-vip-connectivity-check" StepTypeAPIVipConnectivityCheck StepType = "api-vip-connectivity-check" + // StepTypeTangConnectivityCheck captures enum value "tang-connectivity-check" + StepTypeTangConnectivityCheck StepType = "tang-connectivity-check" + // StepTypeNtpSynchronizer captures enum value "ntp-synchronizer" StepTypeNtpSynchronizer StepType = "ntp-synchronizer" @@ -67,6 +70,15 @@ const ( // StepTypeNextStepRunner captures enum value "next-step-runner" StepTypeNextStepRunner StepType = "next-step-runner" + + // StepTypeUpgradeAgent captures enum value "upgrade-agent" + StepTypeUpgradeAgent StepType = "upgrade-agent" + + // StepTypeDownloadBootArtifacts captures enum value "download-boot-artifacts" + StepTypeDownloadBootArtifacts StepType = "download-boot-artifacts" + + // StepTypeRebootForReclaim captures enum value "reboot-for-reclaim" + StepTypeRebootForReclaim StepType = "reboot-for-reclaim" ) // for schema @@ -74,7 +86,7 @@ var stepTypeEnum []interface{} func init() { var res []StepType - if err := json.Unmarshal([]byte(`["connectivity-check","execute","inventory","install","free-network-addresses","dhcp-lease-allocate","api-vip-connectivity-check","ntp-synchronizer","installation-disk-speed-check","container-image-availability","domain-resolution","stop-installation","logs-gather","next-step-runner"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["connectivity-check","execute","inventory","install","free-network-addresses","dhcp-lease-allocate","api-vip-connectivity-check","tang-connectivity-check","ntp-synchronizer","installation-disk-speed-check","container-image-availability","domain-resolution","stop-installation","logs-gather","next-step-runner","upgrade-agent","download-boot-artifacts","reboot-for-reclaim"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/vendor/github.com/openshift/assisted-service/models/tang_connectivity_request.go b/vendor/github.com/openshift/assisted-service/models/tang_connectivity_request.go new file mode 100644 index 00000000..e66dac4d --- /dev/null +++ b/vendor/github.com/openshift/assisted-service/models/tang_connectivity_request.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// TangConnectivityRequest tang connectivity request +// +// swagger:model tang_connectivity_request +type TangConnectivityRequest struct { + + // JSON-formatted string containing additional information regarding tang's configuration + // Required: true + TangServers *string `json:"tang_servers"` +} + +// Validate validates this tang connectivity request +func (m *TangConnectivityRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTangServers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TangConnectivityRequest) validateTangServers(formats strfmt.Registry) error { + + if err := validate.Required("tang_servers", "body", m.TangServers); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this tang connectivity request based on context it is used +func (m *TangConnectivityRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TangConnectivityRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TangConnectivityRequest) UnmarshalBinary(b []byte) error { + var res TangConnectivityRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/openshift/assisted-service/models/tang_connectivity_response.go b/vendor/github.com/openshift/assisted-service/models/tang_connectivity_response.go new file mode 100644 index 00000000..36895db2 --- /dev/null +++ b/vendor/github.com/openshift/assisted-service/models/tang_connectivity_response.go @@ -0,0 +1,266 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TangConnectivityResponse tang connectivity response +// +// swagger:model tang_connectivity_response +type TangConnectivityResponse struct { + + // Tang check result. + IsSuccess bool `json:"is_success,omitempty"` + + // tang server response + TangServerResponse []*TangServerResponse `json:"tang_server_response"` +} + +// Validate validates this tang connectivity response +func (m *TangConnectivityResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTangServerResponse(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TangConnectivityResponse) validateTangServerResponse(formats strfmt.Registry) error { + if swag.IsZero(m.TangServerResponse) { // not required + return nil + } + + for i := 0; i < len(m.TangServerResponse); i++ { + if swag.IsZero(m.TangServerResponse[i]) { // not required + continue + } + + if m.TangServerResponse[i] != nil { + if err := m.TangServerResponse[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tang_server_response" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tang_server_response" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this tang connectivity response based on the context it is used +func (m *TangConnectivityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTangServerResponse(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TangConnectivityResponse) contextValidateTangServerResponse(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.TangServerResponse); i++ { + + if m.TangServerResponse[i] != nil { + if err := m.TangServerResponse[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tang_server_response" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tang_server_response" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TangConnectivityResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TangConnectivityResponse) UnmarshalBinary(b []byte) error { + var res TangConnectivityResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// TangServerResponse tang server response +// +// swagger:model TangServerResponse +type TangServerResponse struct { + + // Tang response payload. + Payload string `json:"payload,omitempty"` + + // signatures + Signatures []*TangServerSignatures `json:"signatures"` + + // Tang URL. + TangURL string `json:"tang_url,omitempty"` +} + +// Validate validates this tang server response +func (m *TangServerResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSignatures(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TangServerResponse) validateSignatures(formats strfmt.Registry) error { + if swag.IsZero(m.Signatures) { // not required + return nil + } + + for i := 0; i < len(m.Signatures); i++ { + if swag.IsZero(m.Signatures[i]) { // not required + continue + } + + if m.Signatures[i] != nil { + if err := m.Signatures[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("signatures" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("signatures" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this tang server response based on the context it is used +func (m *TangServerResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSignatures(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TangServerResponse) contextValidateSignatures(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Signatures); i++ { + + if m.Signatures[i] != nil { + if err := m.Signatures[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("signatures" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("signatures" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TangServerResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TangServerResponse) UnmarshalBinary(b []byte) error { + var res TangServerResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// TangServerSignatures tang server signatures +// +// swagger:model TangServerSignatures +type TangServerSignatures struct { + + // protected + Protected string `json:"protected,omitempty"` + + // signature + Signature string `json:"signature,omitempty"` +} + +// Validate validates this tang server signatures +func (m *TangServerSignatures) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this tang server signatures based on context it is used +func (m *TangServerSignatures) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TangServerSignatures) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TangServerSignatures) UnmarshalBinary(b []byte) error { + var res TangServerSignatures + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/openshift/assisted-service/models/upgrade_agent_request.go b/vendor/github.com/openshift/assisted-service/models/upgrade_agent_request.go new file mode 100644 index 00000000..c84bf264 --- /dev/null +++ b/vendor/github.com/openshift/assisted-service/models/upgrade_agent_request.go @@ -0,0 +1,52 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// UpgradeAgentRequest upgrade agent request +// +// swagger:model upgrade_agent_request +type UpgradeAgentRequest struct { + + // Full image reference of the image that the agent should upgrade to, for example + // `quay.io/registry-proxy.engineering.redhat.com/rh-osbs/openshift4-assisted-installer-agent-rhel8:v1.0.0-142`. + // + AgentImage string `json:"agent_image,omitempty"` +} + +// Validate validates this upgrade agent request +func (m *UpgradeAgentRequest) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this upgrade agent request based on context it is used +func (m *UpgradeAgentRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UpgradeAgentRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpgradeAgentRequest) UnmarshalBinary(b []byte) error { + var res UpgradeAgentRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/openshift/assisted-service/models/upgrade_agent_response.go b/vendor/github.com/openshift/assisted-service/models/upgrade_agent_response.go new file mode 100644 index 00000000..fc25c4d0 --- /dev/null +++ b/vendor/github.com/openshift/assisted-service/models/upgrade_agent_response.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// UpgradeAgentResponse upgrade agent response +// +// swagger:model upgrade_agent_response +type UpgradeAgentResponse struct { + + // Full image reference of the image that the agent has upgraded to, for example + // `quay.io/registry-proxy.engineering.redhat.com/rh-osbs/openshift4-assisted-installer-agent-rhel8:v1.0.0-142`. + // + AgentImage string `json:"agent_image,omitempty"` + + // result + Result UpgradeAgentResult `json:"result,omitempty"` +} + +// Validate validates this upgrade agent response +func (m *UpgradeAgentResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateResult(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpgradeAgentResponse) validateResult(formats strfmt.Registry) error { + if swag.IsZero(m.Result) { // not required + return nil + } + + if err := m.Result.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result") + } + return err + } + + return nil +} + +// ContextValidate validate this upgrade agent response based on the context it is used +func (m *UpgradeAgentResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateResult(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpgradeAgentResponse) contextValidateResult(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Result.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("result") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("result") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UpgradeAgentResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpgradeAgentResponse) UnmarshalBinary(b []byte) error { + var res UpgradeAgentResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/openshift/assisted-service/models/upgrade_agent_result.go b/vendor/github.com/openshift/assisted-service/models/upgrade_agent_result.go new file mode 100644 index 00000000..4716a7f7 --- /dev/null +++ b/vendor/github.com/openshift/assisted-service/models/upgrade_agent_result.go @@ -0,0 +1,74 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// UpgradeAgentResult Agent upgrade result. +// +// swagger:model upgrade_agent_result +type UpgradeAgentResult string + +func NewUpgradeAgentResult(value UpgradeAgentResult) *UpgradeAgentResult { + v := value + return &v +} + +const ( + + // UpgradeAgentResultSuccess captures enum value "success" + UpgradeAgentResultSuccess UpgradeAgentResult = "success" + + // UpgradeAgentResultFailure captures enum value "failure" + UpgradeAgentResultFailure UpgradeAgentResult = "failure" +) + +// for schema +var upgradeAgentResultEnum []interface{} + +func init() { + var res []UpgradeAgentResult + if err := json.Unmarshal([]byte(`["success","failure"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + upgradeAgentResultEnum = append(upgradeAgentResultEnum, v) + } +} + +func (m UpgradeAgentResult) validateUpgradeAgentResultEnum(path, location string, value UpgradeAgentResult) error { + if err := validate.EnumCase(path, location, value, upgradeAgentResultEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this upgrade agent result +func (m UpgradeAgentResult) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateUpgradeAgentResultEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this upgrade agent result based on context it is used +func (m UpgradeAgentResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/openshift/assisted-service/models/v2_cluster_update_params.go b/vendor/github.com/openshift/assisted-service/models/v2_cluster_update_params.go index be7cbb87..6e8c3d5f 100644 --- a/vendor/github.com/openshift/assisted-service/models/v2_cluster_update_params.go +++ b/vendor/github.com/openshift/assisted-service/models/v2_cluster_update_params.go @@ -111,6 +111,9 @@ type V2ClusterUpdateParams struct { // SSH public key for debugging OpenShift nodes. SSHPublicKey *string `json:"ssh_public_key,omitempty"` + // A comma-separated list of tags that are associated to the cluster. + Tags *string `json:"tags,omitempty"` + // Indicate if the networking is managed by the user. UserManagedNetworking *bool `json:"user_managed_networking,omitempty"` diff --git a/vendor/modules.txt b/vendor/modules.txt index 9d0447e1..6276015c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -228,12 +228,12 @@ github.com/onsi/gomega/types # github.com/openshift/api v0.0.0-20210216211028-bb81baaf35cd ## explicit; go 1.15 github.com/openshift/api/config/v1 -# github.com/openshift/assisted-service/api v0.0.0-20220404082135-0bb6463a94fb => github.com/openshift/assisted-service/api v0.0.0-20220314012014-141adc8ae8f8 +# github.com/openshift/assisted-service/api v0.0.0-20220811161334-09c4cb098e96 => github.com/openshift/assisted-service/api v0.0.0-20220811161334-09c4cb098e96 ## explicit; go 1.17 github.com/openshift/assisted-service/api/common github.com/openshift/assisted-service/api/hiveextension/v1beta1 github.com/openshift/assisted-service/api/v1beta1 -# github.com/openshift/assisted-service/models v0.0.0 => github.com/openshift/assisted-service/models v0.0.0-20220327160002-d7f1f0923b25 +# github.com/openshift/assisted-service/models v0.0.0 => github.com/openshift/assisted-service/models v0.0.0-20220811161334-09c4cb098e96 ## explicit; go 1.17 github.com/openshift/assisted-service/models # github.com/openshift/cluster-api-provider-agent/api v0.0.0 => ./api @@ -772,7 +772,7 @@ sigs.k8s.io/structured-merge-diff/v4/value # sigs.k8s.io/yaml v1.3.0 ## explicit; go 1.12 sigs.k8s.io/yaml -# github.com/openshift/assisted-service/api => github.com/openshift/assisted-service/api v0.0.0-20220314012014-141adc8ae8f8 -# github.com/openshift/assisted-service/models => github.com/openshift/assisted-service/models v0.0.0-20220327160002-d7f1f0923b25 +# github.com/openshift/assisted-service/api => github.com/openshift/assisted-service/api v0.0.0-20220811161334-09c4cb098e96 +# github.com/openshift/assisted-service/models => github.com/openshift/assisted-service/models v0.0.0-20220811161334-09c4cb098e96 # github.com/openshift/cluster-api-provider-agent/api => ./api # sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.0.0