Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Physical Network API #27

Merged
merged 1 commit into from
Jul 1, 2024
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
4 changes: 2 additions & 2 deletions charts/region/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ description: A Helm chart for deploying Unikorn's Region Controller

type: application

version: v0.1.17
appVersion: v0.1.17
version: v0.1.18
appVersion: v0.1.18

icon: https://raw.githubusercontent.com/unikorn-cloud/assets/main/images/logos/dark-on-light/icon.png

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/oapi-codegen/runtime v1.1.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
github.com/unikorn-cloud/core v0.1.49
github.com/unikorn-cloud/core v0.1.55
github.com/unikorn-cloud/identity v0.2.11
go.opentelemetry.io/otel v1.27.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.27.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/unikorn-cloud/core v0.1.49 h1:ahAxrzvBnBICi+qN/AmTqKRJHpxl958gKVfBO3lz4G8=
github.com/unikorn-cloud/core v0.1.49/go.mod h1:cP39UQN7aSmsfjQuSMsworI4oBIwx4oA4u20CbPpfZw=
github.com/unikorn-cloud/core v0.1.55 h1:Oy5r3UBTNWb0qFDcmehLrgBwMx9xCo9x2nOEzNZoYUU=
github.com/unikorn-cloud/core v0.1.55/go.mod h1:cP39UQN7aSmsfjQuSMsworI4oBIwx4oA4u20CbPpfZw=
github.com/unikorn-cloud/identity v0.2.11 h1:q6mkJ3qTRjwhlvLS9Jv0I4wlJhnsbJZHu2rbNdnXBYk=
github.com/unikorn-cloud/identity v0.2.11/go.mod h1:4KHNdHiIKpKERD0slunDDXhdC59M7eiN+Y1wSfHbQwQ=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/unikorn/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var (
func init() {
SchemeBuilder.Register(&Region{}, &RegionList{})
SchemeBuilder.Register(&Identity{}, &IdentityList{})
SchemeBuilder.Register(&PhysicalNetwork{}, &PhysicalNetworkList{})
}

// Resource maps a resource type to a group resource.
Expand Down
56 changes: 55 additions & 1 deletion pkg/apis/unikorn/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,17 @@ type RegionStatus struct {
Conditions []unikornv1core.Condition `json:"conditions,omitempty"`
}

// Tag is an arbirary key/value.
type Tag struct {
// Name of the tag.
Name string `json:"name"`
// Value of the tag.
Value string `json:"value"`
}

// TagList is an ordered list of tags.
type TagList []Tag

// IdentityList is a typed list of identities.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type IdentityList struct {
Expand Down Expand Up @@ -252,6 +263,9 @@ type Identity struct {

// IdentitySpec stores any state necessary to manage identity.
type IdentitySpec struct {
// Tags are an abitrary list of key/value pairs that a client
// may populate to store metadata for the resource.
Tags TagList `json:"tags,omitempty"`
// Provider defines the provider type.
Provider Provider `json:"provider"`
// OpenStack is populated when the provider type is set to "openstack".
Expand All @@ -261,9 +275,49 @@ type IdentitySpec struct {
type IdentitySpecOpenStack struct {
// UserID is the ID of the user created for the identity.
UserID string `json:"userID"`
// ProjectIS is the ID of the project created for the identity.
// ProjectID is the ID of the project created for the identity.
ProjectID string `json:"projectID"`
}

type IdentityStatus struct {
}

// PhysicalNetworkList s a typed list of physical networks.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type PhysicalNetworkList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PhysicalNetwork `json:"items"`
}

// PhysicalNetwork defines a physical network beloning to an identity.
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:scope=Namespaced,categories=unikorn
// +kubebuilder:printcolumn:name="status",type="string",JSONPath=".status.conditions[?(@.type==\"Available\")].reason"
// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp"
type PhysicalNetwork struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PhysicalNetworkSpec `json:"spec"`
Status PhysicalNetworkStatus `json:"status"`
}

type PhysicalNetworkSpec struct {
// Tags are an abitrary list of key/value pairs that a client
// may populate to store metadata for the resource.
Tags TagList `json:"tags,omitempty"`
// ProviderNetwork is the provider network for port allocation of
// virtual machines.
ProviderNetwork *OpenstackProviderNetworkSpec `json:"providerNetwork,omitempty"`
}

type OpenstackProviderNetworkSpec struct {
// ID is the network ID.
ID string `json:"id"`
// VlanID is the ID if the VLAN for IPAM.
VlanID int `json:"vlanID"`
}

type PhysicalNetworkStatus struct {
}
160 changes: 160 additions & 0 deletions pkg/apis/unikorn/v1alpha1/zz_generated.deepcopy.go

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

9 changes: 9 additions & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ var (
func VersionString() string {
return fmt.Sprintf("%s/%s (revision/%s)", Application, Version, Revision)
}

const (
// RegionLabel creates an indexable linkage between resources and their
// owning region.
RegionLabel = "regions.unikorn-cloud.org/region-id"
// IdentityLabel creates an indexable linkage between resources and an
// owning identity.
IdentityLabel = "regions.unikorn-cloud.org/identity-id"
)
Loading
Loading