From bf61901d826947e08cd8efc47ac1c45e1e98accc Mon Sep 17 00:00:00 2001 From: Rahul-D78 Date: Thu, 4 Jul 2024 17:34:15 +0530 Subject: [PATCH 1/2] fix(): node inventory types Signed-off-by: Rahul-D78 --- pkg/controller/v1alpha1/cluster_types.go | 61 ++++++++---- .../v1alpha1/zz_generated.deepcopy.go | 92 +++++++++++++++++++ pkg/worker/v1alpha1/zz_generated.deepcopy.go | 1 + 3 files changed, 137 insertions(+), 17 deletions(-) diff --git a/pkg/controller/v1alpha1/cluster_types.go b/pkg/controller/v1alpha1/cluster_types.go index 63efbe8..591326d 100644 --- a/pkg/controller/v1alpha1/cluster_types.go +++ b/pkg/controller/v1alpha1/cluster_types.go @@ -55,56 +55,56 @@ type ClusterSpec struct { NodeIPs []string `json:"nodeIPs,omitempty"` // NetworkInterface is the network interface attached with the cluster. NetworkInterface string `json:"networkInterface,omitempty"` - //put in an object + // put in an object ClusterProperty ClusterProperty `json:"clusterProperty,omitempty"` } type ClusterProperty struct { - //Telemetry contains Telemetry information + // Telemetry contains Telemetry information Telemetry Telemetry `json:"telemetry,omitempty"` - //GeoLocation contains information regarding Geographical Location of the Cluster + // GeoLocation contains information regarding Geographical Location of the Cluster GeoLocation GeoLocation `json:"geoLocation,omitempty"` - //Monitoring contains the Kubernetes Monitoring Dashboard + // Monitoring contains the Kubernetes Monitoring Dashboard Monitoring Monitoring `json:"monitoring,omitempty"` } // Telemetry defines the field of ClusterSpec type Telemetry struct { - //Enabled is the enable status of the Telemetry + // Enabled is the enable status of the Telemetry Enabled bool `json:"enabled,omitempty"` - //TelemetryProvider is the Telemetry Provider information + // TelemetryProvider is the Telemetry Provider information TelemetryProvider string `json:"telemetryProvider,omitempty"` - //Endpoint is the Telemetry Endpoint + // Endpoint is the Telemetry Endpoint Endpoint string `json:"endpoint,omitempty"` } // GeoLocation defines the field of ClusterSpec type GeoLocation struct { - //CloudProvider is the cloud service provider + // CloudProvider is the cloud service provider CloudProvider string `json:"cloudProvider,omitempty"` - //CloudRegion is the region of the cloud + // CloudRegion is the region of the cloud CloudRegion string `json:"cloudRegion,omitempty"` - //Latitude is the latitude of the cluster + // Latitude is the latitude of the cluster Latitude string `json:"latitude,omitempty"` - //Longitude is the longitude of the cluster + // Longitude is the longitude of the cluster Longitude string `json:"longitude,omitempty"` } // Monitoring defines the field of ClusterSpec type Monitoring struct { - //KubernetesDashboard contains the information regarding Kubernetes Monitoring Dashboard + // KubernetesDashboard contains the information regarding Kubernetes Monitoring Dashboard KubernetesDashboard KubernetesDashboard `json:"kubernetesDashboard,omitempty"` } // KubernetesDashboard defines the field of ClusterSpec type KubernetesDashboard struct { - //Enabled is the enable status of the KubernetesDashboard + // Enabled is the enable status of the KubernetesDashboard Enabled bool `json:"enabled,omitempty"` - //AccessToken is the Access Token to access the KubernetesDashboard + // AccessToken is the Access Token to access the KubernetesDashboard AccessToken string `json:"accessToken,omitempty"` - //IngressPrefix is the prefix of ingress gateway for KubernetesDashboard + // IngressPrefix is the prefix of ingress gateway for KubernetesDashboard IngressPrefix string `json:"ingressPrefix,omitempty"` - //Endpoint is the base endpoint to access the kubernetes dashboard + // Endpoint is the base endpoint to access the kubernetes dashboard Endpoint string `json:"endpoint,omitempty"` } @@ -112,7 +112,7 @@ type KubernetesDashboard struct { type ClusterStatus struct { // SecretName is the name of the secret for the worker cluster. SecretName string `json:"secretName,omitempty"` - //CniSubnet is the podip and service ip subnet of CNI + // CniSubnet is the podip and service ip subnet of CNI CniSubnet []string `json:"cniSubnet,omitempty"` // Namespaces present in cluster Namespaces []NamespacesConfig `json:"namespaces,omitempty"` @@ -131,6 +131,33 @@ type ClusterStatus struct { // VCPURestriction is the restriction on the cluster disabling the creation of new pods VCPURestriction *VCPURestriction `json:"vCPURestriction,omitempty"` + // NodeInventory is the inventory of the nodes in the cluster + NodeInventory []NodeInventory `json:"nodeInventory,omitempty"` +} + +type NodeInventory struct { + //+kubebuilder:validation:Enum:=cpu;gpu; + Type string `json:"type,omitempty"` + Name string `json:"name,omitempty"` + GpuProperties GpuProperties `json:"gpuProperties,omitempty"` +} + +type GpuProperties struct { + GpuNodeType string `json:"gpuNodeType,omitempty"` + GpuSharingType string `json:"gpuSharingType,omitempty"` + GpuUtilization GpuUtilization `json:"gpuUtilization,omitempty"` +} + +type GpuUtilization struct { + TotalGPUs uint `json:"totalGPUs,omitempty"` + Allocated uint `json:"allocated,omitempty"` + Free uint `json:"free,omitempty"` + Reserved []Reserved `json:"reserved,omitempty"` +} + +type Reserved struct { + SliceName string `json:"sliceName,omitempty"` + NumReservedGPUs uint `json:"numReservedGPUs,omitempty"` } type VCPURestriction struct { diff --git a/pkg/controller/v1alpha1/zz_generated.deepcopy.go b/pkg/controller/v1alpha1/zz_generated.deepcopy.go index 0490636..b4117e9 100644 --- a/pkg/controller/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/controller/v1alpha1/zz_generated.deepcopy.go @@ -171,6 +171,13 @@ func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { *out = new(VCPURestriction) (*in).DeepCopyInto(*out) } + if in.NodeInventory != nil { + in, out := &in.NodeInventory, &out.NodeInventory + *out = make([]NodeInventory, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. @@ -209,6 +216,7 @@ func (in *ExternalGatewayConfig) DeepCopyInto(out *ExternalGatewayConfig) { *out = make([]string, len(*in)) copy(*out, *in) } + out.VPCServiceAccess = in.VPCServiceAccess } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalGatewayConfig. @@ -251,6 +259,42 @@ func (in *GeoLocation) DeepCopy() *GeoLocation { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GpuProperties) DeepCopyInto(out *GpuProperties) { + *out = *in + in.GpuUtilization.DeepCopyInto(&out.GpuUtilization) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GpuProperties. +func (in *GpuProperties) DeepCopy() *GpuProperties { + if in == nil { + return nil + } + out := new(GpuProperties) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GpuUtilization) DeepCopyInto(out *GpuUtilization) { + *out = *in + if in.Reserved != nil { + in, out := &in.Reserved, &out.Reserved + *out = make([]Reserved, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GpuUtilization. +func (in *GpuUtilization) DeepCopy() *GpuUtilization { + if in == nil { + return nil + } + out := new(GpuUtilization) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KubernetesDashboard) DeepCopyInto(out *KubernetesDashboard) { *out = *in @@ -347,6 +391,22 @@ func (in *NamespacesConfig) DeepCopy() *NamespacesConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeInventory) DeepCopyInto(out *NodeInventory) { + *out = *in + in.GpuProperties.DeepCopyInto(&out.GpuProperties) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeInventory. +func (in *NodeInventory) DeepCopy() *NodeInventory { + if in == nil { + return nil + } + out := new(NodeInventory) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Project) DeepCopyInto(out *Project) { *out = *in @@ -452,6 +512,38 @@ func (in *QOSProfile) DeepCopy() *QOSProfile { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Reserved) DeepCopyInto(out *Reserved) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reserved. +func (in *Reserved) DeepCopy() *Reserved { + if in == nil { + return nil + } + out := new(Reserved) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServiceAccess) DeepCopyInto(out *ServiceAccess) { + *out = *in + out.Ingress = in.Ingress + out.Egress = in.Egress +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceAccess. +func (in *ServiceAccess) DeepCopy() *ServiceAccess { + if in == nil { + return nil + } + out := new(ServiceAccess) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ServiceAccount) DeepCopyInto(out *ServiceAccount) { *out = *in diff --git a/pkg/worker/v1alpha1/zz_generated.deepcopy.go b/pkg/worker/v1alpha1/zz_generated.deepcopy.go index bda9ca3..0a406a5 100644 --- a/pkg/worker/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/worker/v1alpha1/zz_generated.deepcopy.go @@ -75,6 +75,7 @@ func (in *ExternalGatewayConfig) DeepCopyInto(out *ExternalGatewayConfig) { out.Ingress = in.Ingress out.Egress = in.Egress out.NsIngress = in.NsIngress + out.VPCServiceAccess = in.VPCServiceAccess } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalGatewayConfig. From 2f52fbfa2ab1df1d89d46d37c98906e136912688 Mon Sep 17 00:00:00 2001 From: Rahul-D78 Date: Tue, 13 Aug 2024 18:05:50 +0530 Subject: [PATCH 2/2] fix(): inventory types Signed-off-by: Rahul-D78 --- pkg/controller/v1alpha1/cluster_types.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/controller/v1alpha1/cluster_types.go b/pkg/controller/v1alpha1/cluster_types.go index 591326d..5dc3691 100644 --- a/pkg/controller/v1alpha1/cluster_types.go +++ b/pkg/controller/v1alpha1/cluster_types.go @@ -149,15 +149,16 @@ type GpuProperties struct { } type GpuUtilization struct { - TotalGPUs uint `json:"totalGPUs,omitempty"` - Allocated uint `json:"allocated,omitempty"` - Free uint `json:"free,omitempty"` + TotalGPUs string `json:"totalGPUs,omitempty"` + Free string `json:"free,omitempty"` + Allocated string `json:"allocated,omitempty"` + Memory string `json:"memory,omitempty"` Reserved []Reserved `json:"reserved,omitempty"` } type Reserved struct { SliceName string `json:"sliceName,omitempty"` - NumReservedGPUs uint `json:"numReservedGPUs,omitempty"` + NumReservedGPUs string `json:"numReservedGPUs,omitempty"` } type VCPURestriction struct {