Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ help: ## Display this help.

##@ Development

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=crd

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
Expand All @@ -49,14 +53,14 @@ vet: ## Run go vet against code.
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
.PHONY: controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.17.3)

PROTO_GEN = $(shell pwd)/bin/go-to-protobuf
.PHONY: proto-gen
proto-gen: ## Convert the types definition to Protocol Buffers.
$(call go-get-tool,$(PROTO_GEN),k8s.io/code-generator/cmd/go-to-protobuf@v0.23.3)
$(call go-get-tool,$(PROTO_GEN),k8s.io/code-generator/cmd/go-to-protobuf@v0.32.2)

# go-get-tool will 'go get' any package $2 and install it to $1.
# go-get-tool will 'go install' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
@[ -f $(1) ] || { \
Expand All @@ -65,7 +69,7 @@ TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef
235 changes: 235 additions & 0 deletions crd/controller.kubeslice.io_clusters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.3
name: clusters.controller.kubeslice.io
spec:
group: controller.kubeslice.io
names:
kind: Cluster
listKind: ClusterList
plural: clusters
singular: cluster
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Cluster is the Schema for the clusters API
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: ClusterSpec defines the desired state of Cluster
properties:
clusterProperty:
description: put in an object
properties:
geoLocation:
description: GeoLocation contains information regarding Geographical
Location of the Cluster
properties:
cloudProvider:
description: CloudProvider is the cloud service provider
type: string
cloudRegion:
description: CloudRegion is the region of the cloud
type: string
latitude:
description: Latitude is the latitude of the cluster
type: string
longitude:
description: Longitude is the longitude of the cluster
type: string
type: object
monitoring:
description: Monitoring contains the Kubernetes Monitoring Dashboard
properties:
grafanaDashboardBaseURL:
description: GrafanaDashboardBaseURL is the base URL for the
grafana dashboard
type: string
kubernetesDashboard:
description: KubernetesDashboard contains the information
regarding Kubernetes Monitoring Dashboard
properties:
accessToken:
description: AccessToken is the Access Token to access
the KubernetesDashboard
type: string
enabled:
description: Enabled is the enable status of the KubernetesDashboard
type: boolean
endpoint:
description: Endpoint is the base endpoint to access the
kubernetes dashboard
type: string
ingressPrefix:
description: IngressPrefix is the prefix of ingress gateway
for KubernetesDashboard
type: string
type: object
type: object
telemetry:
description: Telemetry contains Telemetry information
properties:
enabled:
description: Enabled is the enable status of the Telemetry
type: boolean
endpoint:
description: Endpoint is the Telemetry Endpoint
type: string
telemetryProvider:
description: TelemetryProvider is the Telemetry Provider information
type: string
type: object
type: object
enableAutoEviction:
description: EnableAutoEviction is a flag to enable auto eviction
feature for the given cluster
type: boolean
networkInterface:
description: NetworkInterface is the network interface attached with
the cluster.
type: string
nodeIP:
description: NodeIP is the IP address of the Node - deprecated field
use Plural NodeIPs
type: string
nodeIPs:
items:
type: string
type: array
requeueOnFailure:
type: boolean
type: object
status:
description: ClusterStatus defines the observed state of Cluster
properties:
GPURestriction:
properties:
enforceRestrictions:
description: EnforceRestrictions is the flag to check if the cluster
is restricted
type: boolean
lastUpdatedTimestamp:
description: LastUpdatedTimestamp is the timestamp when the enforcement
was updated
format: date-time
type: string
type: object
clusterHealth:
description: ClusterHealth shows the health of the worker cluster
properties:
clusterHealthStatus:
description: ClusterHealthStatus shows the overall health status
of the cluster
enum:
- Normal
- Warning
type: string
componentStatuses:
description: ComponentStatuses shows the health status of individual
components in the cluster
items:
properties:
component:
description: Component name
type: string
componentHealthStatus:
enum:
- Normal
- Warning
- Error
type: string
required:
- component
- componentHealthStatus
type: object
type: array
lastUpdated:
description: LastUpdated is the timestamp when healthstatus was
updated
format: date-time
type: string
type: object
cniSubnet:
description: CniSubnet is the podip and service ip subnet of CNI
items:
type: string
type: array
isDeregisterInProgress:
description: IsDeregisterInProgress is the flag to check if the cluster
deregister is InProgress
type: boolean
namespaces:
description: Namespaces present in cluster
items:
properties:
name:
type: string
sliceName:
type: string
type: object
type: array
networkPresent:
default: false
description: NetworkPresent denotes if the networking components (NSM,
Spire) are installed on a cluster
type: boolean
nodeIPs:
description: NodeIPs of the gateway node of worker cluster
items:
type: string
type: array
registrationStatus:
description: RegistrationStatus shows the status of cluster registration
enum:
- Pending
- InProgress
- Failed
- Registered
- DeregisterInProgress
- DeregisterFailed
- Deregistered
type: string
secretName:
description: SecretName is the name of the secret for the worker cluster.
type: string
vCPURestriction:
description: VCPURestriction is the restriction on the cluster disabling
the creation of new pods
properties:
enforceRestrictions:
description: EnforceRestrictions is the flag to check if the cluster
is restricted
type: boolean
lastUpdatedTimestamp:
description: LastUpdatedTimestamp is the timestamp when the enforcement
was updated
format: date-time
type: string
type: object
type: object
type: object
served: true
storage: true
subresources:
status: {}
67 changes: 67 additions & 0 deletions crd/controller.kubeslice.io_projects.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.17.3
name: projects.controller.kubeslice.io
spec:
group: controller.kubeslice.io
names:
kind: Project
listKind: ProjectList
plural: projects
singular: project
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Project is the Schema for the projects API
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: ProjectSpec defines the desired state of Project
properties:
defaultSliceCreation:
description: If defaultSliceCreation is true, then the default slice
will be created
type: boolean
serviceAccount:
description: ServiceAccount is a field of Project. Edit project_types.go
to remove/update
properties:
readOnly:
items:
type: string
type: array
readWrite:
items:
type: string
type: array
type: object
type: object
status:
description: ProjectStatus defines the observed state of Project
type: object
type: object
served: true
storage: true
subresources:
status: {}
Loading