Skip to content

Commit

Permalink
Rename DatumCluster to Location
Browse files Browse the repository at this point in the history
  • Loading branch information
joshlreese committed Dec 5, 2024
1 parent 24648cf commit d19fee4
Show file tree
Hide file tree
Showing 24 changed files with 321 additions and 491 deletions.
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ resources:
namespaced: true
domain: datumapis.com
group: networking
kind: DatumCluster
kind: Location
path: go.datum.net/network-services-operator/api/v1alpha
version: v1alpha
version: "3"
106 changes: 0 additions & 106 deletions api/v1alpha/datumcluster_types.go

This file was deleted.

106 changes: 106 additions & 0 deletions api/v1alpha/location_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
// 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.

// LocationSpec defines the desired state of Location.
type LocationSpec struct {
// The location class that indicates control plane behavior of entities
// associated with the location.
//
// Valid values are:
// - datum-managed
// - self-managed
//
// +kubebuilder:validation:Required
LocationClassName string `json:"locationClassName,omitempty"`

// The topology of the location
//
// 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 location provider
//
// +kubebuilder:validation:Required
Provider LocationProvider `json:"provider"`
}

type LocationProvider struct {
GCP *GCPLocationProvider `json:"gcp,omitempty"`
}

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

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

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

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

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

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

Spec LocationSpec `json:"spec,omitempty"`
Status LocationStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

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

type LocationReference struct {
// Name of a datum location
//
// +kubebuilder:validation:Required
Name string `json:"name"`

// Namespace for the datum location
//
// +kubebuilder:validation:Required
Namespace string `json:"namespace"`
}

func init() {
SchemeBuilder.Register(&Location{}, &LocationList{})
}
13 changes: 2 additions & 11 deletions api/v1alpha/networkbinding_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,10 @@ type NetworkBindingSpec struct {
// +kubebuilder:validation:Required
Network NetworkRef `json:"network,omitempty"`

// The topology of where this binding exists
//
// This may contain arbitrary topology keys. Some keys may be well known, such
// as:
// - topology.datum.net/city-code
// - topology.datum.net/cluster-name
// - topology.datum.net/cluster-namespace
//
// Each unique value of this field across bindings in the namespace will result
// in a NetworkAttachment to be created.
// The location of where a network binding exists.
//
// +kubebuilder:validation:Required
Topology map[string]string `json:"topology"`
Location LocationReference `json:"location,omitempty"`
}

// NetworkBindingObjectReference contains sufficient information for
Expand Down
13 changes: 2 additions & 11 deletions api/v1alpha/networkcontext_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,10 @@ type NetworkContextSpec struct {
// +kubebuilder:validation:Required
Network LocalNetworkRef `json:"network"`

// The topology of where this context exists
//
// This may contain arbitrary topology keys. Some keys may be well known, such
// as:
// - topology.datum.net/city-code
// - topology.datum.net/cluster-name
// - topology.datum.net/cluster-namespace
//
// The combined keys and values MUST be unique for contexts in the same
// network.
// The location of where a network context exists.
//
// +kubebuilder:validation:Required
Topology map[string]string `json:"topology"`
Location LocationReference `json:"location,omitempty"`
}

// NetworkContextStatus defines the observed state of NetworkContext
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha/subnet_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ type SubnetSpec struct {
// +kubebuilder:validation:Required
NetworkContext LocalNetworkContextRef `json:"networkContext"`

// The topology which a subnet is associated with
// The location which a subnet is associated with
//
// +kubebuilder:validation:Required
Topology map[string]string `json:"topology"`
Location LocationReference `json:"location,omitempty"`

// The IP family of a subnet
//
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha/subnetclaim_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ type SubnetClaimSpec struct {
// +kubebuilder:validation:Required
NetworkContext LocalNetworkContextRef `json:"networkContext"`

// The topology which the subnet is associated with
// The location which a subnet claim is associated with
//
// +kubebuilder:validation:Required
Topology map[string]string `json:"topology"`
Location LocationReference `json:"location,omitempty"`

// The IP family of a subnet claim
//
Expand Down
Loading

0 comments on commit d19fee4

Please sign in to comment.