diff --git a/go.mod b/go.mod index b7f716e44..f42d45c6a 100644 --- a/go.mod +++ b/go.mod @@ -31,6 +31,7 @@ require ( github.com/openshift-kni/lifecycle-agent v0.0.0-20250120220331-9547280df193 // release-4.18 github.com/openshift-kni/numaresources-operator v0.4.18-0.2024100201.0.20250114093602-01c00730991d // release-4.18 github.com/openshift-kni/oran-hwmgr-plugin/api/hwmgr-plugin v0.0.0-20250128160241-57fbcf565b32 + github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20250129205116-6838db628c2b github.com/openshift-kni/oran-o2ims/api/provisioning v0.0.0-20250123151805-c935b06062f9 github.com/openshift/api v3.9.1-0.20191111211345-a27ff30ebf09+incompatible github.com/openshift/client-go v0.0.0-20241107164952-923091dd2b1a diff --git a/go.sum b/go.sum index 24b0e7ffa..e2d642f92 100644 --- a/go.sum +++ b/go.sum @@ -498,6 +498,8 @@ github.com/openshift-kni/numaresources-operator v0.4.18-0.2024100201.0.202501140 github.com/openshift-kni/numaresources-operator v0.4.18-0.2024100201.0.20250114093602-01c00730991d/go.mod h1:0Nx16xaZzxDbBs12tRjAWxDJdA9RknYEf2edrOjOdrU= github.com/openshift-kni/oran-hwmgr-plugin/api/hwmgr-plugin v0.0.0-20250128160241-57fbcf565b32 h1:ufFJmCmIAN8uI1/BowCryt+tIEzaXC1KbJnRwO3UUFE= github.com/openshift-kni/oran-hwmgr-plugin/api/hwmgr-plugin v0.0.0-20250128160241-57fbcf565b32/go.mod h1:IUuPY/mlglIpTHV1MlYbBYPBTRgad5d328i5j/F4AbY= +github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20250129205116-6838db628c2b h1:/wRJJk8u0+aky96XDRwDuRT1GJxq23L5rMMsvxZ0Y8k= +github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20250129205116-6838db628c2b/go.mod h1:WIYfQ7jH7QkTIzqVjMEClf1H47Prs6LuoPvSMxBBAGw= github.com/openshift-kni/oran-o2ims/api/provisioning v0.0.0-20250123151805-c935b06062f9 h1:AP4psTmffaPv3IS/PkXIqRo2lmC0chWv33piK6m28sU= github.com/openshift-kni/oran-o2ims/api/provisioning v0.0.0-20250123151805-c935b06062f9/go.mod h1:7dmhnmqiO1VP3SuqaAdnlFbBdeTLK3FI3vQHapVMNQg= github.com/openshift/api v0.0.0-20241210155609-29859d55727b h1:IrtLpBrlSL7a3HK+Brg7C1DFO/gsztIEMlCRJW0M82s= diff --git a/pkg/oran/nodepool.go b/pkg/oran/nodepool.go new file mode 100644 index 000000000..48bd9387b --- /dev/null +++ b/pkg/oran/nodepool.go @@ -0,0 +1,147 @@ +package oran + +import ( + "context" + "fmt" + + "github.com/golang/glog" + "github.com/openshift-kni/eco-goinfra/pkg/clients" + "github.com/openshift-kni/eco-goinfra/pkg/msg" + hardwaremanagementv1alpha1 "github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1" + k8serrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" +) + +// NodePoolBuilder provides a struct to inferface with NodePool resources on a specific cluster. +type NodePoolBuilder struct { + // Definition of the NodePool used to create the resource. + Definition *hardwaremanagementv1alpha1.NodePool + // Object of the NodePool as it is on the cluster. + Object *hardwaremanagementv1alpha1.NodePool + // apiClient used to interact with the cluster. + apiClient runtimeclient.Client + // errorMsg used to store latest error message from functions that do not return errors. + errorMsg string +} + +// PullNodePool pulls an existing NodePool into a NodePoolBuilder struct. +func PullNodePool(apiClient *clients.Settings, name, nsname string) (*NodePoolBuilder, error) { + glog.V(100).Infof("Pulling existing NodePool %s in namespace %s from cluster", name, nsname) + + if apiClient == nil { + glog.V(100).Infof("The apiClient of the NodePool is nil") + + return nil, fmt.Errorf("nodePool 'apiClient' cannot be nil") + } + + err := apiClient.AttachScheme(hardwaremanagementv1alpha1.AddToScheme) + if err != nil { + glog.V(100).Infof("Failed to add hardwaremanagement v1alpha1 scheme to client schemes: %v", err) + + return nil, err + } + + builder := &NodePoolBuilder{ + apiClient: apiClient.Client, + Definition: &hardwaremanagementv1alpha1.NodePool{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: nsname, + }, + }, + } + + if name == "" { + glog.V(100).Info("The name of the NodePool is empty") + + return nil, fmt.Errorf("nodePool 'name' cannot be empty") + } + + if nsname == "" { + glog.V(100).Info("The nsname of the NodePool is empty") + + return nil, fmt.Errorf("nodePool 'nsname' cannot be empty") + } + + if !builder.Exists() { + glog.V(100).Info("The NodePool %s does not exist in namespace %s", name, nsname) + + return nil, fmt.Errorf("nodePool object %s does not exist in namespace %s", name, nsname) + } + + builder.Definition = builder.Object + + return builder, nil +} + +// Get returns the NodePool object if found. +func (builder *NodePoolBuilder) Get() (*hardwaremanagementv1alpha1.NodePool, error) { + if valid, err := builder.validate(); !valid { + return nil, err + } + + glog.V(100).Infof("Getting NodePool object %s in namespace %s", + builder.Definition.Name, builder.Definition.Namespace) + + nodePool := &hardwaremanagementv1alpha1.NodePool{} + err := builder.apiClient.Get(context.TODO(), runtimeclient.ObjectKey{ + Name: builder.Definition.Name, + Namespace: builder.Definition.Namespace, + }, nodePool) + + if err != nil { + glog.V(100).Infof("Failed to get NodePool object %s in namespace %s: %v", + builder.Definition.Name, builder.Definition.Namespace, err) + + return nil, err + } + + return nodePool, nil +} + +// Exists checks whether this NodePool exists on the cluster. +func (builder *NodePoolBuilder) Exists() bool { + if valid, _ := builder.validate(); !valid { + return false + } + + glog.V(100).Infof("Checking if NodePool %s exists in namespace %s", + builder.Definition.Name, builder.Definition.Namespace) + + var err error + builder.Object, err = builder.Get() + + return err == nil || !k8serrors.IsNotFound(err) +} + +// validate checks that the builder, definition, and apiClient are properly initialized and there is no errorMsg. +func (builder *NodePoolBuilder) validate() (bool, error) { + resourceCRD := "nodePool" + + if builder == nil { + glog.V(100).Infof("The %s builder is uninitialized", resourceCRD) + + return false, fmt.Errorf("error: received nil %s builder", resourceCRD) + } + + if builder.Definition == nil { + glog.V(100).Infof("The %s is uninitialized", resourceCRD) + + return false, fmt.Errorf(msg.UndefinedCrdObjectErrString(resourceCRD)) + } + + if builder.apiClient == nil { + glog.V(100).Infof("The %s builder apiClient is nil", resourceCRD) + + return false, fmt.Errorf("%s builder cannot have nil apiClient", resourceCRD) + } + + if builder.errorMsg != "" { + glog.V(100).Infof("The %s builder has error message %s", resourceCRD, builder.errorMsg) + + return false, fmt.Errorf(builder.errorMsg) + } + + return true, nil +} diff --git a/pkg/oran/nodepool_test.go b/pkg/oran/nodepool_test.go new file mode 100644 index 000000000..3daf9b7f9 --- /dev/null +++ b/pkg/oran/nodepool_test.go @@ -0,0 +1,175 @@ +package oran + +import ( + "fmt" + "testing" + + "github.com/openshift-kni/eco-goinfra/pkg/clients" + hardwaremanagementv1alpha1 "github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1" + "github.com/stretchr/testify/assert" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +const ( + defaultNodePoolName = "test-node-pool" + defaultNodePoolNamespace = "test-namespace" +) + +var hardwaremanagementTestSchemes = []clients.SchemeAttacher{ + hardwaremanagementv1alpha1.AddToScheme, +} + +func TestPullNodePool(t *testing.T) { + testCases := []struct { + name string + nsname string + addToRuntimeObjects bool + client bool + expectedError error + }{ + { + name: defaultNodePoolName, + nsname: defaultNodePoolNamespace, + addToRuntimeObjects: true, + client: true, + expectedError: nil, + }, + { + name: "", + nsname: defaultNodePoolNamespace, + addToRuntimeObjects: true, + client: true, + expectedError: fmt.Errorf("nodePool 'name' cannot be empty"), + }, + { + name: defaultNodePoolName, + nsname: "", + addToRuntimeObjects: true, + client: true, + expectedError: fmt.Errorf("nodePool 'nsname' cannot be empty"), + }, + { + name: defaultNodePoolName, + nsname: defaultNodePoolNamespace, + addToRuntimeObjects: false, + client: true, + expectedError: fmt.Errorf( + "nodePool object %s does not exist in namespace %s", defaultNodePoolName, defaultNodePoolNamespace), + }, + { + name: defaultNodePoolName, + nsname: defaultNodePoolNamespace, + addToRuntimeObjects: true, + client: false, + expectedError: fmt.Errorf("nodePool 'apiClient' cannot be nil"), + }, + } + + for _, testCase := range testCases { + var ( + runtimeObjects []runtime.Object + testSettings *clients.Settings + ) + + if testCase.addToRuntimeObjects { + runtimeObjects = append(runtimeObjects, buildDummyNodePool(defaultNodePoolName, defaultNodePoolNamespace)) + } + + if testCase.client { + testSettings = clients.GetTestClients(clients.TestClientParams{ + K8sMockObjects: runtimeObjects, + SchemeAttachers: hardwaremanagementTestSchemes, + }) + } + + testBuilder, err := PullNodePool(testSettings, testCase.name, testCase.nsname) + assert.Equal(t, testCase.expectedError, err) + + if testCase.expectedError == nil { + assert.Equal(t, testCase.name, testBuilder.Definition.Name) + assert.Equal(t, testCase.nsname, testBuilder.Definition.Namespace) + } + } +} + +func TestNodePoolGet(t *testing.T) { + testCases := []struct { + testBuilder *NodePoolBuilder + expectedError string + }{ + { + testBuilder: buildValidNodePoolTestBuilder(buildTestClientWithDummyNodePool()), + expectedError: "", + }, + { + testBuilder: buildValidNodePoolTestBuilder(clients.GetTestClients(clients.TestClientParams{})), + expectedError: fmt.Sprintf( + "nodepools.o2ims-hardwaremanagement.oran.openshift.io \"%s\" not found", defaultNodePoolName), + }, + } + + for _, testCase := range testCases { + nodePool, err := testCase.testBuilder.Get() + + if testCase.expectedError == "" { + assert.Nil(t, err) + assert.Equal(t, testCase.testBuilder.Definition.Name, nodePool.Name) + assert.Equal(t, testCase.testBuilder.Definition.Namespace, nodePool.Namespace) + } else { + assert.EqualError(t, err, testCase.expectedError) + } + } +} + +func TestNodePoolExists(t *testing.T) { + testCases := []struct { + testBuilder *NodePoolBuilder + exists bool + }{ + { + testBuilder: buildValidNodePoolTestBuilder(buildTestClientWithDummyNodePool()), + exists: true, + }, + { + testBuilder: buildValidNodePoolTestBuilder(clients.GetTestClients(clients.TestClientParams{})), + exists: false, + }, + } + + for _, testCase := range testCases { + exists := testCase.testBuilder.Exists() + assert.Equal(t, testCase.exists, exists) + } +} + +// buildDummyNodePool returns a NodePool with the provided name and nsname. +func buildDummyNodePool(name, nsname string) *hardwaremanagementv1alpha1.NodePool { + return &hardwaremanagementv1alpha1.NodePool{ + ObjectMeta: metav1.ObjectMeta{ + Name: name, + Namespace: nsname, + }, + } +} + +// buildTestClientWithDummyNodePool returns an apiClient with the correct schemes and a NodePool with default name and +// namespace. +func buildTestClientWithDummyNodePool() *clients.Settings { + return clients.GetTestClients(clients.TestClientParams{ + K8sMockObjects: []runtime.Object{ + buildDummyNodePool(defaultNodePoolName, defaultNodePoolNamespace), + }, + SchemeAttachers: hardwaremanagementTestSchemes, + }) +} + +// buildValidNodePoolTestBuilder returns a valid NodePoolBuilder with all defaults and the provided apiClient. +func buildValidNodePoolTestBuilder(apiClient *clients.Settings) *NodePoolBuilder { + _ = apiClient.AttachScheme(hardwaremanagementv1alpha1.AddToScheme) + + return &NodePoolBuilder{ + Definition: buildDummyNodePool(defaultNodePoolName, defaultNodePoolNamespace), + apiClient: apiClient, + } +} diff --git a/pkg/oran/nodepoollist.go b/pkg/oran/nodepoollist.go new file mode 100644 index 000000000..b06dbd897 --- /dev/null +++ b/pkg/oran/nodepoollist.go @@ -0,0 +1,67 @@ +package oran + +import ( + "context" + "fmt" + + "github.com/golang/glog" + "github.com/openshift-kni/eco-goinfra/pkg/clients" + hardwaremanagementv1alpha1 "github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1" + runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" +) + +// ListNodePools returns a list of NodePools in all namespaces, using the provided options. +func ListNodePools(apiClient *clients.Settings, options ...runtimeclient.ListOptions) ([]*NodePoolBuilder, error) { + if apiClient == nil { + glog.V(100).Info("NodePools 'apiClient' parameter cannot be nil") + + return nil, fmt.Errorf("failed to list nodePools, 'apiClient' parameter is nil") + } + + err := apiClient.AttachScheme(hardwaremanagementv1alpha1.AddToScheme) + if err != nil { + glog.V(100).Info("Failed to add hardwaremanagement v1alpha1 scheme to client schemes") + + return nil, err + } + + logMessage := "Listing NodePools in all namespaces" + passedOptions := runtimeclient.ListOptions{} + + if len(options) > 1 { + glog.V(100).Info("NodePools 'options' parameter must be empty or single-valued") + + return nil, fmt.Errorf("error: more than one ListOptions was passed") + } + + if len(options) == 1 { + passedOptions = options[0] + logMessage += fmt.Sprintf(" with the options %v", passedOptions) + } + + glog.V(100).Info(logMessage) + + nodePoolList := new(hardwaremanagementv1alpha1.NodePoolList) + err = apiClient.Client.List(context.TODO(), nodePoolList, &passedOptions) + + if err != nil { + glog.V(100).Infof("Failed to list NodePools in all namespaces due to %v", err) + + return nil, err + } + + var nodePoolObjects []*NodePoolBuilder + + for _, nodePool := range nodePoolList.Items { + copiedNodePool := nodePool + nodePoolBuilder := &NodePoolBuilder{ + apiClient: apiClient.Client, + Object: &copiedNodePool, + Definition: &copiedNodePool, + } + + nodePoolObjects = append(nodePoolObjects, nodePoolBuilder) + } + + return nodePoolObjects, nil +} diff --git a/pkg/oran/nodepoollist_test.go b/pkg/oran/nodepoollist_test.go new file mode 100644 index 000000000..4b410fc6c --- /dev/null +++ b/pkg/oran/nodepoollist_test.go @@ -0,0 +1,63 @@ +package oran + +import ( + "fmt" + "testing" + + "github.com/openshift-kni/eco-goinfra/pkg/clients" + "github.com/stretchr/testify/assert" + "k8s.io/apimachinery/pkg/labels" + runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" +) + +func TestListNodePools(t *testing.T) { + testCases := []struct { + nodePools []*NodePoolBuilder + listOptions []runtimeclient.ListOptions + client bool + expectedError error + }{ + { + nodePools: []*NodePoolBuilder{buildValidNodePoolTestBuilder(buildTestClientWithDummyNodePool())}, + listOptions: nil, + client: true, + expectedError: nil, + }, + { + nodePools: []*NodePoolBuilder{buildValidNodePoolTestBuilder(buildTestClientWithDummyNodePool())}, + listOptions: []runtimeclient.ListOptions{{LabelSelector: labels.NewSelector()}}, + client: true, + expectedError: nil, + }, + { + nodePools: []*NodePoolBuilder{buildValidNodePoolTestBuilder(buildTestClientWithDummyNodePool())}, + listOptions: []runtimeclient.ListOptions{ + {LabelSelector: labels.NewSelector()}, + {LabelSelector: labels.NewSelector()}, + }, + client: true, + expectedError: fmt.Errorf("error: more than one ListOptions was passed"), + }, + { + nodePools: []*NodePoolBuilder{buildValidNodePoolTestBuilder(buildTestClientWithDummyNodePool())}, + listOptions: nil, + client: false, + expectedError: fmt.Errorf("failed to list nodePools, 'apiClient' parameter is nil"), + }, + } + + for _, testCase := range testCases { + var testSettings *clients.Settings + + if testCase.client { + testSettings = buildTestClientWithDummyNodePool() + } + + builders, err := ListNodePools(testSettings, testCase.listOptions...) + assert.Equal(t, testCase.expectedError, err) + + if testCase.expectedError == nil && len(testCase.listOptions) == 0 { + assert.Equal(t, len(testCase.nodePools), len(builders)) + } + } +} diff --git a/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/LICENSE.txt b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/LICENSE.txt new file mode 100644 index 000000000..f433b1a53 --- /dev/null +++ b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/LICENSE.txt @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/conditions.go b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/conditions.go new file mode 100644 index 000000000..b205cbf81 --- /dev/null +++ b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/conditions.go @@ -0,0 +1,47 @@ +/* +Copyright (c) 2024 Red Hat, Inc. + +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 v1alpha1 + +type ConditionType string + +// The following constants define the different types of conditions that will be set +const ( + Provisioned ConditionType = "Provisioned" + Configured ConditionType = "Configured" + Validation ConditionType = "Validation" + Unknown ConditionType = "Unknown" // Indicates the condition has not been evaluated +) + +// ConditionReason describes the reasons for a condition's status. +type ConditionReason string + +const ( + InProgress ConditionReason = "InProgress" + Completed ConditionReason = "Completed" + Unprovisioned ConditionReason = "Unprovisioned" + Failed ConditionReason = "Failed" + NotInitialized ConditionReason = "NotInitialized" + TimedOut ConditionReason = "TimedOut" + ConfigUpdate ConditionReason = "ConfigurationUpdateRequested" + ConfigApplied ConditionReason = "ConfigurationApplied" +) + +// ConditionMessage provides detailed messages associated with condition status updates. +type ConditionMessage string + +const ( + AwaitConfig ConditionMessage = "Spec updated; awaiting configuration application by the hardware plugin" + ConfigSuccess ConditionMessage = "Configuration has been applied successfully" +) diff --git a/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/groupversion.go b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/groupversion.go new file mode 100644 index 000000000..4cf5298df --- /dev/null +++ b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/groupversion.go @@ -0,0 +1,35 @@ +/* +Copyright (c) 2024 Red Hat, Inc. + +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 v1alpha1 contains API schema definitions for the O2 IMS hardware manager plugin API. +// +// +kubebuilder:object:generate=true +// +groupName=o2ims-hardwaremanagement.oran.openshift.io +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "o2ims-hardwaremanagement.oran.openshift.io", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/hardwaretemplate_types.go b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/hardwaretemplate_types.go new file mode 100644 index 000000000..1ecfda3ce --- /dev/null +++ b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/hardwaretemplate_types.go @@ -0,0 +1,104 @@ +/* +Copyright (c) 2024 Red Hat, Inc. + +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NodePoolData provides the necessary information for populating a node pool +type NodePoolData struct { + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + // +kubebuilder:validation:Enum=master;worker + Role string `json:"role"` + // +kubebuilder:validation:MinLength=1 + HwProfile string `json:"hwProfile"` + // ResourcePoolId is the identifier for the Resource Pool in the hardware manager instance. + // +optional + ResourcePoolId string `json:"resourcePoolId,omitempty"` + // +optional + ResourceSelector string `json:"resourceSelector,omitempty"` +} + +// HardwareTemplateSpec defines the desired state of HardwareTemplate +type HardwareTemplateSpec struct { + + // HwMgrId is the identifier for the hardware manager plugin adaptor. + // +kubebuilder:validation:MinLength=1 + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Hardware Manager ID",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + HwMgrId string `json:"hwMgrId"` + + // BootInterfaceLabel is the label of the boot interface. + // +kubebuilder:validation:MinLength=1 + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Boot Interface Label",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + BootInterfaceLabel string `json:"bootInterfaceLabel"` + + // HardwareProvisioningTimeout defines the timeout duration string for the hardware provisioning. + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Hardware Provisioning Timeout",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + HardwareProvisioningTimeout string `json:"hardwareProvisioningTimeout,omitempty"` + + // NodePoolData defines a collection of NodePoolData items + // +kubebuilder:validation:MinItems=1 + //+operator-sdk:csv:customresourcedefinitions:type=spec + NodePoolData []NodePoolData `json:"nodePoolData"` + + // Extensions holds additional custom key-value pairs that can be used to extend the node pool's configuration. + //+operator-sdk:csv:customresourcedefinitions:type=spec + Extensions map[string]string `json:"extensions,omitempty"` +} + +// HardwareTemplateStatus defines the observed state of HardwareTemplate +type HardwareTemplateStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of HardwareTemplate + // Important: Run "make" to regenerate code after modifying this file + + //+operator-sdk:csv:customresourcedefinitions:type=status + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:resource:path=hardwaretemplates,shortName=oranhwtmpl +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.conditions[-1:].reason" +//+kubebuilder:printcolumn:name="Details",type="string",JSONPath=".status.conditions[-1:].message" + +// HardwareTemplate is the Schema for the hardwaretemplates API +// +kubebuilder:validation:XValidation:message="Spec changes are not allowed for a HardwareTemplate that has passed the validation", rule="!has(oldSelf.status) || oldSelf.status.conditions.exists(c, c.type=='Validation' && c.status=='False') || oldSelf.spec == self.spec" +// +operator-sdk:csv:customresourcedefinitions:displayName="ORAN O2IMS Hardware Template",resources={{ConfigMap, v1}} +type HardwareTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec HardwareTemplateSpec `json:"spec,omitempty"` + Status HardwareTemplateStatus `json:"status,omitempty"` +} + +// HardwareTemplateList contains a list of HardwareTemplate. +// +// +kubebuilder:object:root=true +type HardwareTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []HardwareTemplate `json:"items"` +} + +func init() { + SchemeBuilder.Register( + &HardwareTemplate{}, + &HardwareTemplateList{}, + ) +} diff --git a/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/node.go b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/node.go new file mode 100644 index 000000000..89faa722b --- /dev/null +++ b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/node.go @@ -0,0 +1,119 @@ +/* +Copyright (c) 2024 Red Hat, Inc. + +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Interface describes an interface of a hardware server +type Interface struct { + Name string `json:"name"` // The name of the network interface (e.g., eth0, ens33) + Label string `json:"label"` // The label of the interface + // +kubebuilder:validation:Pattern=`^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$` + MACAddress string `json:"macAddress"` // The MAC address of the interface +} + +// NodeSpec describes a node presents a hardware server +type NodeSpec struct { + // NodePool + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Node Pool",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + NodePool string `json:"nodePool"` + + // GroupName + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Group Name",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + GroupName string `json:"groupName"` + + // HwProfile + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Hardware Profile",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + HwProfile string `json:"hwProfile"` + + // HwMgrId is the identifier for the hardware manager instance. + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Hardware Manager ID",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + HwMgrId string `json:"hwMgrId,omitempty"` + + // HwMgrNodeId is the node identifier from the hardware manager. + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Hardware Manager Node ID",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + HwMgrNodeId string `json:"hwMgrNodeId,omitempty"` + + //+operator-sdk:csv:customresourcedefinitions:type=spec + Extensions map[string]string `json:"extensions,omitempty"` +} + +// BMC describes BMC details of a hardware server +type BMC struct { + // The Address contains the URL for accessing the BMC over the network. + Address string `json:"address,omitempty"` + + // CredentialsName is a reference to a secret containing the credentials. That secret + // should contain the keys `username` and `password`. + CredentialsName string `json:"credentialsName,omitempty"` +} + +// NodeStatus describes the observed state of a request to allocate and prepare +// a node that will eventually be part of a deployment manager. +type NodeStatus struct { + //+operator-sdk:csv:customresourcedefinitions:type=status + BMC *BMC `json:"bmc,omitempty"` + + //+operator-sdk:csv:customresourcedefinitions:type=status + Interfaces []*Interface `json:"interfaces,omitempty"` + + //+operator-sdk:csv:customresourcedefinitions:type=status + Hostname string `json:"hostname,omitempty"` + + //+operator-sdk:csv:customresourcedefinitions:type=status + HwProfile string `json:"hwProfile,omitempty"` + + // Conditions represent the observations of the NodeStatus's current state. + // Possible values of the condition type are `Provisioned`, `Unprovisioned`, `Updating` and `Failed`. + //+operator-sdk:csv:customresourcedefinitions:type=status + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// Node is the schema for an allocated node +// +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=nodes,shortName=orannode +// +kubebuilder:printcolumn:name="HwMgr Id",type="string",JSONPath=".spec.hwMgrId" +// +kubebuilder:printcolumn:name="NodePool",type="string",JSONPath=".spec.nodePool" +// +kubebuilder:printcolumn:name="HwMgr Node Id",type="string",JSONPath=".spec.hwMgrNodeId" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.conditions[-1:].reason" +// +operator-sdk:csv:customresourcedefinitions:displayName="Node",resources={{Namespace, v1}} +type Node struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec NodeSpec `json:"spec,omitempty"` + Status NodeStatus `json:"status,omitempty"` +} + +// NodeList contains a list of provisioned node. +// +// +kubebuilder:object:root=true +type NodeList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Node `json:"items"` +} + +func init() { + SchemeBuilder.Register( + &Node{}, + &NodeList{}, + ) +} diff --git a/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/node_pools.go b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/node_pools.go new file mode 100644 index 000000000..43378949b --- /dev/null +++ b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/node_pools.go @@ -0,0 +1,123 @@ +/* +Copyright (c) 2024 Red Hat, Inc. + +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LocationSpec is the geographical location of the requested node. +type LocationSpec struct { + // Location + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Location",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + Location string `json:"location,omitempty"` + // Site + // +kubebuilder:validation:Required + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Site",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + Site string `json:"site"` +} + +// NodePoolSpec describes a pool of nodes to allocate +type NodePoolSpec struct { + // CloudID is the identifier of the O-Cloud that generated this request. The hardware + // manager may want to use this to tag the nodes in its database, and to generate + // statistics. + // + // +kubebuilder:validation:Required + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Cloud ID",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + CloudID string `json:"cloudID"` + + // LocationSpec is the geographical location of the requested node. + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Location Spec",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + LocationSpec `json:",inline"` + + // HwMgrId is the identifier for the hardware manager plugin instance. + //+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Hardware Manager ID",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + HwMgrId string `json:"hwMgrId,omitempty"` + + //+operator-sdk:csv:customresourcedefinitions:type=spec + NodeGroup []NodeGroup `json:"nodeGroup"` + + //+operator-sdk:csv:customresourcedefinitions:type=spec + Extensions map[string]string `json:"extensions,omitempty"` +} + +type NodeGroup struct { + NodePoolData NodePoolData `json:"nodePoolData"` // Explicitly include as a named field + Size int `json:"size" yaml:"size"` +} + +type Properties struct { + NodeNames []string `json:"nodeNames,omitempty"` +} + +// GenerationStatus represents the observed generation for an operator. +type GenerationStatus struct { + ObservedGeneration int64 `json:"observedGeneration,omitempty"` +} + +// NodePoolStatus describes the observed state of a request to allocate and prepare +// a node that will eventually be part of a deployment manager. +type NodePoolStatus struct { + // Properties represent the node properties in the pool + //+operator-sdk:csv:customresourcedefinitions:type=status + Properties Properties `json:"properties,omitempty"` + + // Conditions represent the latest available observations of an NodePool's state. + // +optional + // +kubebuilder:validation:Type=array + // +kubebuilder:validation:Items=Type=object + //+operator-sdk:csv:customresourcedefinitions:type=status + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + + //+operator-sdk:csv:customresourcedefinitions:type=status + HwMgrPlugin GenerationStatus `json:"hwMgrPlugin,omitempty"` + + //+operator-sdk:csv:customresourcedefinitions:type=status + SelectedPools map[string]string `json:"selectedPools,omitempty"` +} + +// NodePool is the schema for an allocation request of nodes +// +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:path=nodepools,shortName=orannp +// +kubebuilder:printcolumn:name="HwMgr Id",type="string",JSONPath=".spec.hwMgrId" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.conditions[-1:].reason" +// +operator-sdk:csv:customresourcedefinitions:displayName="Node Pool",resources={{Namespace, v1}} +type NodePool struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec NodePoolSpec `json:"spec,omitempty"` + Status NodePoolStatus `json:"status,omitempty"` +} + +// NodePoolList contains a list of node allocation requests. +// +// +kubebuilder:object:root=true +type NodePoolList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []NodePool `json:"items"` +} + +func init() { + SchemeBuilder.Register( + &NodePool{}, + &NodePoolList{}, + ) +} diff --git a/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000..b3c1816ac --- /dev/null +++ b/vendor/github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,482 @@ +//go:build !ignore_autogenerated + +/* +Copyright 2023. + +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. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BMC) DeepCopyInto(out *BMC) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BMC. +func (in *BMC) DeepCopy() *BMC { + if in == nil { + return nil + } + out := new(BMC) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GenerationStatus) DeepCopyInto(out *GenerationStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GenerationStatus. +func (in *GenerationStatus) DeepCopy() *GenerationStatus { + if in == nil { + return nil + } + out := new(GenerationStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HardwareTemplate) DeepCopyInto(out *HardwareTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HardwareTemplate. +func (in *HardwareTemplate) DeepCopy() *HardwareTemplate { + if in == nil { + return nil + } + out := new(HardwareTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HardwareTemplate) 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 *HardwareTemplateList) DeepCopyInto(out *HardwareTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HardwareTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HardwareTemplateList. +func (in *HardwareTemplateList) DeepCopy() *HardwareTemplateList { + if in == nil { + return nil + } + out := new(HardwareTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HardwareTemplateList) 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 *HardwareTemplateSpec) DeepCopyInto(out *HardwareTemplateSpec) { + *out = *in + if in.NodePoolData != nil { + in, out := &in.NodePoolData, &out.NodePoolData + *out = make([]NodePoolData, len(*in)) + copy(*out, *in) + } + if in.Extensions != nil { + in, out := &in.Extensions, &out.Extensions + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HardwareTemplateSpec. +func (in *HardwareTemplateSpec) DeepCopy() *HardwareTemplateSpec { + if in == nil { + return nil + } + out := new(HardwareTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HardwareTemplateStatus) DeepCopyInto(out *HardwareTemplateStatus) { + *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 HardwareTemplateStatus. +func (in *HardwareTemplateStatus) DeepCopy() *HardwareTemplateStatus { + if in == nil { + return nil + } + out := new(HardwareTemplateStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Interface) DeepCopyInto(out *Interface) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Interface. +func (in *Interface) DeepCopy() *Interface { + if in == nil { + return nil + } + out := new(Interface) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LocationSpec) DeepCopyInto(out *LocationSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocationSpec. +func (in *LocationSpec) DeepCopy() *LocationSpec { + if in == nil { + return nil + } + out := new(LocationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Node) DeepCopyInto(out *Node) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node. +func (in *Node) DeepCopy() *Node { + if in == nil { + return nil + } + out := new(Node) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Node) 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 *NodeGroup) DeepCopyInto(out *NodeGroup) { + *out = *in + out.NodePoolData = in.NodePoolData +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeGroup. +func (in *NodeGroup) DeepCopy() *NodeGroup { + if in == nil { + return nil + } + out := new(NodeGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeList) DeepCopyInto(out *NodeList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Node, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeList. +func (in *NodeList) DeepCopy() *NodeList { + if in == nil { + return nil + } + out := new(NodeList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodeList) 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 *NodePool) DeepCopyInto(out *NodePool) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePool. +func (in *NodePool) DeepCopy() *NodePool { + if in == nil { + return nil + } + out := new(NodePool) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodePool) 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 *NodePoolData) DeepCopyInto(out *NodePoolData) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolData. +func (in *NodePoolData) DeepCopy() *NodePoolData { + if in == nil { + return nil + } + out := new(NodePoolData) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodePoolList) DeepCopyInto(out *NodePoolList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]NodePool, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolList. +func (in *NodePoolList) DeepCopy() *NodePoolList { + if in == nil { + return nil + } + out := new(NodePoolList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *NodePoolList) 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 *NodePoolSpec) DeepCopyInto(out *NodePoolSpec) { + *out = *in + out.LocationSpec = in.LocationSpec + if in.NodeGroup != nil { + in, out := &in.NodeGroup, &out.NodeGroup + *out = make([]NodeGroup, len(*in)) + copy(*out, *in) + } + if in.Extensions != nil { + in, out := &in.Extensions, &out.Extensions + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolSpec. +func (in *NodePoolSpec) DeepCopy() *NodePoolSpec { + if in == nil { + return nil + } + out := new(NodePoolSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodePoolStatus) DeepCopyInto(out *NodePoolStatus) { + *out = *in + in.Properties.DeepCopyInto(&out.Properties) + 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]) + } + } + out.HwMgrPlugin = in.HwMgrPlugin + if in.SelectedPools != nil { + in, out := &in.SelectedPools, &out.SelectedPools + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolStatus. +func (in *NodePoolStatus) DeepCopy() *NodePoolStatus { + if in == nil { + return nil + } + out := new(NodePoolStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeSpec) DeepCopyInto(out *NodeSpec) { + *out = *in + if in.Extensions != nil { + in, out := &in.Extensions, &out.Extensions + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeSpec. +func (in *NodeSpec) DeepCopy() *NodeSpec { + if in == nil { + return nil + } + out := new(NodeSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeStatus) DeepCopyInto(out *NodeStatus) { + *out = *in + if in.BMC != nil { + in, out := &in.BMC, &out.BMC + *out = new(BMC) + **out = **in + } + if in.Interfaces != nil { + in, out := &in.Interfaces, &out.Interfaces + *out = make([]*Interface, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Interface) + **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 NodeStatus. +func (in *NodeStatus) DeepCopy() *NodeStatus { + if in == nil { + return nil + } + out := new(NodeStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Properties) DeepCopyInto(out *Properties) { + *out = *in + if in.NodeNames != nil { + in, out := &in.NodeNames, &out.NodeNames + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Properties. +func (in *Properties) DeepCopy() *Properties { + if in == nil { + return nil + } + out := new(Properties) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 6e71bde60..0545f9a90 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -491,6 +491,9 @@ github.com/openshift-kni/numaresources-operator/api/numaresourcesoperator/v1 # github.com/openshift-kni/oran-hwmgr-plugin/api/hwmgr-plugin v0.0.0-20250128160241-57fbcf565b32 ## explicit; go 1.22.0 github.com/openshift-kni/oran-hwmgr-plugin/api/hwmgr-plugin/v1alpha1 +# github.com/openshift-kni/oran-o2ims/api/hardwaremanagement v0.0.0-20250129205116-6838db628c2b +## explicit; go 1.22.0 +github.com/openshift-kni/oran-o2ims/api/hardwaremanagement/v1alpha1 # github.com/openshift-kni/oran-o2ims/api/provisioning v0.0.0-20250123151805-c935b06062f9 ## explicit; go 1.22.0 github.com/openshift-kni/oran-o2ims/api/provisioning/v1alpha1