Skip to content

Commit

Permalink
CNF-14440: scorecard tests failing
Browse files Browse the repository at this point in the history
Description:
- add spec descriptor
- add resources to CRDs
- rename ORANO2IMS to Inventory to make bundle building happy
- adjust the groups and domains to match with the GVK
  • Loading branch information
irinamihai committed Sep 17, 2024
1 parent 6a363d3 commit 1b88ea4
Show file tree
Hide file tree
Showing 47 changed files with 975 additions and 742 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ginkgo_flags:=
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 4.16.0
VERSION ?= 4.17.0

# DEFAULT_CHANNEL defines the default channel used in the bundle.
# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
Expand Down
40 changes: 29 additions & 11 deletions PROJECT

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/hardwaremanagement/v1alpha1/groupversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ License.
// Package v1alpha1 contains API schema definitions for the O2 IMS hardware manager plugin API.
//
// +kubebuilder:object:generate=true
// +groupName=hardwaremanagement.oran.openshift.io
// +groupName=o2ims-hardwaremanagement.oran.openshift.io
package v1alpha1

import (
Expand All @@ -25,7 +25,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "hardwaremanagement.oran.openshift.io", Version: "v1alpha1"}
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}
Expand Down
9 changes: 8 additions & 1 deletion api/hardwaremanagement/v1alpha1/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ import (

// NodeSpec describes a node presents a hardware server
type NodeSpec struct {
NodePool string `json:"nodePool"`
// NodePool
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="NodePool",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
NodePool string `json:"nodePool"`
// GroupName
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="GroupName",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
GroupName string `json:"groupName"`
// HwProfile
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="HwProfile",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
HwProfile string `json:"hwProfile"`
}

Expand Down Expand Up @@ -52,6 +58,7 @@ type NodeStatus struct {
//
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +operator-sdk:csv:customresourcedefinitions:displayName="ORAN O2IMS Cluster Request",resources={{Namespace, v1}}
type Node struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
10 changes: 9 additions & 1 deletion api/hardwaremanagement/v1alpha1/node_pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ 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 string `json:"site"`
// Site
//+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
Expand All @@ -30,9 +35,11 @@ type NodePoolSpec struct {
// statistics.
//
// +kubebuilder:validation:Required
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="CloudID",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="LocationSpec",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
LocationSpec `json:",inline"`

NodeGroup []NodeGroup `json:"nodeGroup"`
Expand Down Expand Up @@ -64,6 +71,7 @@ type NodePoolStatus struct {
// +kubebuilder:resource:shortName=np
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +operator-sdk:csv:customresourcedefinitions:displayName="ORAN O2IMS Cluster Request",resources={{Namespace, v1}}
type NodePool struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
8 changes: 6 additions & 2 deletions api/v1alpha1/clusterrequest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ type ClusterRequestSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// LocationSpec is the geographical location of the requested node.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="LocationSpec",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
hwv1alpha1.LocationSpec `json:",inline"`

// ClusterTemplateRef references an existing ClusterTemplate CR.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="ClusterTemplateRef",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
ClusterTemplateRef string `json:"clusterTemplateRef"`

//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="ClusterTemplateInput",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
ClusterTemplateInput ClusterTemplateInput `json:"clusterTemplateInput"`

//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Timeout",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
Timeout Timeout `json:"timeout,omitempty"`
}

Expand All @@ -58,6 +60,7 @@ type ClusterTemplateInput struct {
PolicyTemplateInput runtime.RawExtension `json:"policyTemplateInput"`
}

// NodePoolRef references a node pool.
type NodePoolRef struct {
// Contains the name of the created NodePool.
Name string `json:"name,omitempty"`
Expand Down Expand Up @@ -121,6 +124,7 @@ type ClusterRequestStatus struct {
//+kubebuilder:subresource:status

// ClusterRequest is the Schema for the clusterrequests API
// +operator-sdk:csv:customresourcedefinitions:displayName="ORAN O2IMS Cluster Request",resources={{Namespace, v1},{ClusterInstance, siteconfig.open-cluster-management.io/v1alpha1}}
type ClusterRequest struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
7 changes: 6 additions & 1 deletion api/v1alpha1/clustertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ type ClusterTemplateSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

Templates Templates `json:"templates"`
// Templates defines the references to the templates required for ClusterTemplate.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Templates",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
Templates Templates `json:"templates"`
// InputDataSchema encapsulates all the schemas required for ClusterTemplate.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="InputDataSchema",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
InputDataSchema InputDataSchema `json:"inputDataSchema"`
}

Expand Down Expand Up @@ -78,6 +82,7 @@ type ClusterTemplateStatus struct {

// ClusterTemplate is the Schema for the clustertemplates API
// +kubebuilder:validation:XValidation:message="Spec changes are not allowed for a ClusterTemplate that has passed the validation", rule="!has(oldSelf.status) || oldSelf.status.conditions.exists(c, c.type=='ClusterTemplateValidated' && c.status=='False') || oldSelf.spec == self.spec"
// +operator-sdk:csv:customresourcedefinitions:displayName="ORAN O2IMS Cluster Template",resources={{ConfigMap, v1}}
type ClusterTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

// Package v1alpha1 contains API Schema definitions for the oran v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=oran.openshift.io
// +groupName=o2ims.oran.openshift.io
package v1alpha1

import (
Expand All @@ -26,7 +26,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "oran.openshift.io", Version: "v1alpha1"}
GroupVersion = schema.GroupVersion{Group: "o2ims.oran.openshift.io", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
61 changes: 36 additions & 25 deletions api/v1alpha1/orano2ims_types.go → api/v1alpha1/inventory_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,17 @@ type DeploymentManagerServerConfig struct {
// ResourceServerConfig contains the configuration for the resource server.
type ResourceServerConfig struct {
//+kubebuilder:default:={enabled:true}
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="ServerConfig",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:bool"}
ServerConfig `json:",inline"`
//+optional
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="BackendURL",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
BackendURL string `json:"backendURL,omitempty"`
//+optional
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="BackendToken",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
BackendToken string `json:"backendToken,omitempty"`
// This field allows the addition of extra O-Cloud information for the resource server.
//+optional
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Extensions",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
Extensions []string `json:"extensions,omitempty"`
}

Expand All @@ -71,38 +75,43 @@ type AlarmSubscriptionServerConfig struct {
ServerConfig `json:",inline"`
}

// ORANO2IMSSpec defines the desired state of ORANO2IMS
type ORANO2IMSSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// InventorySpec defines the desired state of Inventory
type InventorySpec struct {
// Image is the full reference of the container image that contains the binary. This is
// optional and the default will be the value passed to the `--image` command line flag of
// the controller manager.
//
//+optional
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Image",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
Image string `json:"image"`
// CloudId is used to correlate the SMO inventory record with the deployed cloud instance.
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="CloudId",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
CloudId string `json:"cloudId"`
//+optional
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="MetadataServerConfig",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
MetadataServerConfig MetadataServerConfig `json:"metadataServerConfig"`
//+optional
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="DeploymentManagerServerConfig",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
DeploymentManagerServerConfig DeploymentManagerServerConfig `json:"deploymentManagerServerConfig"`
// ResourceServerConfig contains the configuration for the resource server.
//+optional
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="ResourceServerConfig",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
ResourceServerConfig ResourceServerConfig `json:"resourceServerConfig,omitempty"`
// AlarmSubscriptionServerConfig contains the configuration for the alarm server.
//+optional
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="AlarmSubscriptionServerConfig",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
AlarmSubscriptionServerConfig AlarmSubscriptionServerConfig `json:"alarmSubscriptionServerConfig"`
// IngressHost defines the FQDN for the IMS endpoints.
//+optional
//+operator-sdk:csv:customresourcedefinitions:type=spec,displayName="IngressHost",xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"}
IngressHost string `json:"ingressHost,omitempty"`
}

type DeploymentsStatus struct {
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Deployment Server Status"
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="DeploymentServerStatus"
DeploymentServerStatus string `json:"deploymentServerStatus,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Metadata Server Status"
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="MetadataServer tatus"
MetadataServerStatus string `json:"metadataServerStatus,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Resource Server Status"
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="ResourceServerStatus"
ResourceServerStatus string `json:"resourceServerStatus,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Conditions"
Conditions []metav1.Condition `json:"conditions,omitempty"`
Expand All @@ -114,35 +123,37 @@ type UsedServerConfig struct {
DeploymentManagerServerUsedConfig []string `json:"deploymentManagerServerUsedConfig,omitempty"`
}

// ORANO2IMSStatus defines the observed state of ORANO2IMS
type ORANO2IMSStatus struct {
// InventoryStatus defines the observed state of Inventory
type InventoryStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="DeploymentsStatus"
DeploymentsStatus DeploymentsStatus `json:"deploymentStatus,omitempty"`
UsedServerConfig UsedServerConfig `json:"usedServerConfig,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=status,displayName="DeploymentsStatus"
UsedServerConfig UsedServerConfig `json:"usedServerConfig,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// ORANO2IMS is the Schema for the orano2ims API
type ORANO2IMS struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// Inventory is the Schema for the Inventory API
// +operator-sdk:csv:customresourcedefinitions:displayName="ORAN O2IMS Inventory",resources={{Deployment,apps/v1}}
type Inventory struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ORANO2IMSSpec `json:"spec,omitempty"`
Status ORANO2IMSStatus `json:"status,omitempty"`
Spec InventorySpec `json:"spec,omitempty"`
Status InventoryStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// ORANO2IMSList contains a list of ORANO2IMS
type ORANO2IMSList struct {
// InventoryList contains a list of Inventory
//
// +kubebuilder:object:root=true
type InventoryList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ORANO2IMS `json:"items"`
Items []Inventory `json:"items"`
}

func init() {
SchemeBuilder.Register(&ORANO2IMS{}, &ORANO2IMSList{})
SchemeBuilder.Register(&Inventory{}, &InventoryList{})
}
Loading

0 comments on commit 1b88ea4

Please sign in to comment.