Skip to content

Commit

Permalink
Merge pull request #1 from kubeslice-ent/feat-gpr
Browse files Browse the repository at this point in the history
Feat gpr
  • Loading branch information
narmidm authored Aug 28, 2024
2 parents cc62a6d + 80a7d78 commit 732344a
Show file tree
Hide file tree
Showing 8 changed files with 619 additions and 19 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/kubeslice/apis
module github.com/kubeslice-ent/apis

go 1.16

Expand Down
62 changes: 45 additions & 17 deletions pkg/controller/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,64 +55,64 @@ 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"`
}

// ClusterStatus defines the observed state of Cluster
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"`
Expand All @@ -131,6 +131,34 @@ 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 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 string `json:"numReservedGPUs,omitempty"`
}

type VCPURestriction struct {
Expand Down
92 changes: 92 additions & 0 deletions pkg/controller/v1alpha1/zz_generated.deepcopy.go

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

38 changes: 38 additions & 0 deletions pkg/operator/v1beta1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2022 Avesha, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* 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 contains API Schema definitions for the mesh v1beta1 API group
// +kubebuilder:object:generate=true
// +groupName=networking.kubeslice.io
package v1beta1

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: "networking.kubeslice.io", Version: "v1beta1"}

// 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
)
Loading

0 comments on commit 732344a

Please sign in to comment.