Skip to content

Commit

Permalink
Temporarily define DatumCluster in this project.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshlreese committed Dec 4, 2024
1 parent 6f377db commit f21ff71
Show file tree
Hide file tree
Showing 13 changed files with 461 additions and 7 deletions.
3 changes: 0 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
},
"ghcr.io/dhoeric/features/act": {}
},
"runArgs": [
"--network=host"
],
"customizations": {
"vscode": {
"settings": {
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ help: ## Display this help.

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

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object paths="./..."
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: fmt
fmt: ## Run go fmt against code.
Expand Down Expand Up @@ -96,7 +96,7 @@ build: manifests generate fmt vet ## Build manager binary.

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
go run ./cmd/main.go
go run ./cmd/main.go -health-probe-bind-address 0

# If you wish to build the manager image targeting other platforms you can use the --platform flag.
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
Expand Down
8 changes: 8 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,12 @@ resources:
kind: SubnetClaim
path: go.datum.net/network-services-operator/api/v1alpha
version: v1alpha
- api:
crdVersion: v1
namespaced: true
domain: datumapis.com
group: networking
kind: DatumCluster
path: go.datum.net/network-services-operator/api/v1alpha
version: v1alpha
version: "3"
94 changes: 94 additions & 0 deletions api/v1alpha/datumcluster_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// SPDX-License-Identifier: AGPL-3.0-only

package v1alpha

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// TODO(jreese) move this definition out of network-services-operator. It's here
// right now for convenience as both workload-operator and infra-provider-gcp
// will need to leverage the type. We'll likely want an `infra-cluster-operator`
// project for this.

// DatumClusterSpec defines the desired state of DatumCluster.
type DatumClusterSpec struct {
// The cluster class for the cluster.
//
// Valid values are:
// - datum-managed
// - self-managed
//
// +kubebuilder:validation:Required
ClusterClassName string `json:"clusterClassName,omitempty"`

// The topology of the cluster
//
// This may contain arbitrary topology keys. Some keys may be well known, such
// as:
// - topology.datum.net/city-code
//
// +kubebuilder:validation:Required
Topology map[string]string `json:"topology"`

// The cluster provider
//
// +kubebuilder:validation:Required
Provider DatumClusterProvider `json:"provider"`
}

type DatumClusterProvider struct {
GCP *GCPClusterProvider `json:"gcp,omitempty"`
}

type GCPClusterProvider struct {
// The GCP project servicing the cluster
//
// For clusters with the class of `datum-managed`, a service account will be
// required for each unique GCP project ID across all clusters registered in a
// namespace.
//
// +kubebuilder:validation:Required
ProjectID string `json:"projectId,omitempty"`

// The GCP region servicing the cluster
//
// +kubebuilder:validation:Required
Region string `json:"region,omitempty"`

// The GCP zone servicing the cluster
//
// +kubebuilder:validation:Required
Zone string `json:"zone,omitempty"`
}

// DatumClusterStatus defines the observed state of DatumCluster.
type DatumClusterStatus struct {
// Represents the observations of a cluster's current state.
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

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

// DatumCluster is the Schema for the datumclusters API.
type DatumCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec DatumClusterSpec `json:"spec,omitempty"`
Status DatumClusterStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// DatumClusterList contains a list of DatumCluster.
type DatumClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []DatumCluster `json:"items"`
}

func init() {
SchemeBuilder.Register(&DatumCluster{}, &DatumClusterList{})
}
141 changes: 141 additions & 0 deletions api/v1alpha/zz_generated.deepcopy.go

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

Loading

0 comments on commit f21ff71

Please sign in to comment.