Skip to content

Commit

Permalink
feat(api): Tenant state
Browse files Browse the repository at this point in the history
  • Loading branch information
prometherion committed Jul 5, 2021
1 parent e1e75a0 commit ef75d04
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

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

20 changes: 20 additions & 0 deletions api/v1beta1/tenant_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2020-2021 Clastix Labs
// SPDX-License-Identifier: Apache-2.0

package v1beta1

// +kubebuilder:validation:Enum=cordoned;active
type tenantState string

const (
TenantStateActive tenantState = "active"
TenantStateCordoned tenantState = "cordoned"
)

// TenantStatus defines the observed state of Tenant
type TenantStatus struct {
//+kubebuilder:default=active
State tenantState `json:"state"`
Size uint `json:"size"`
Namespaces []string `json:"namespaces,omitempty"`
}
7 changes: 1 addition & 6 deletions api/v1beta1/tenant_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,11 @@ type TenantSpec struct {
EnableNodePorts bool `json:"enableNodePorts,omitempty"`
}

// TenantStatus defines the observed state of Tenant
type TenantStatus struct {
Size uint `json:"size"`
Namespaces []string `json:"namespaces,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:storageversion
// +kubebuilder:resource:scope=Cluster,shortName=tnt
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state",description="The actual state of the Tenant"
// +kubebuilder:printcolumn:name="Namespace quota",type="integer",JSONPath=".spec.namespaceQuota",description="The max amount of Namespaces can be created"
// +kubebuilder:printcolumn:name="Namespace count",type="integer",JSONPath=".status.size",description="The total amount of Namespaces in use"
// +kubebuilder:printcolumn:name="Owner name",type="string",JSONPath=".spec.owner.name",description="The assigned Tenant owner"
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/zz_generated.deepcopy.go

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

0 comments on commit ef75d04

Please sign in to comment.