Documentation
¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the tenant v1alpha1 API group. +kubebuilder:object:generate=true +groupName=tenant.otterscale.io
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // SchemeGroupVersion is group version used to register these objects. // This name is used by applyconfiguration generators (e.g. controller-gen). SchemeGroupVersion = schema.GroupVersion{Group: "tenant.otterscale.io", Version: "v1alpha1"} // GroupVersion is an alias for SchemeGroupVersion, for backward compatibility. GroupVersion = SchemeGroupVersion // SchemeBuilder is used to add go types to the GroupVersionKind scheme. SchemeBuilder = runtime.NewSchemeBuilder(func(scheme *runtime.Scheme) error { metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil }) // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
Functions ¶
This section is empty.
Types ¶
type MemberRole ¶
type MemberRole string
MemberRole determines the RBAC permissions a member is granted in the target namespace.
Each role name is also the ClusterRole bound in the workspace namespace, so adding a role means updating three places that cannot be derived from these constants: the Enum marker below, the controller's +kubebuilder:rbac clusterroles/bind resourceNames, and harborRoleID's Harbor role mapping. +kubebuilder:validation:Enum=admin;edit;view +enum
const ( // MemberRoleAdmin has full control over the workspace resources. MemberRoleAdmin MemberRole = "admin" // MemberRoleEdit can create/update application resources but cannot modify role bindings. MemberRoleEdit MemberRole = "edit" // MemberRoleView has read-only access to resources. MemberRoleView MemberRole = "view" )
func AllMemberRoles ¶
func AllMemberRoles() []MemberRole
AllMemberRoles returns every MemberRole, ordered from most to least privileged, so the enumeration lives in one place.
type NetworkIsolationSpec ¶
type NetworkIsolationSpec struct {
// Enabled toggles the enforcement of network isolation.
// If true, ingress is denied except from the workspace's own namespace and
// the allowed namespaces below.
// +optional
Enabled bool `json:"enabled"`
// AllowedNamespaces lists external namespaces permitted to reach this workspace
// while isolation is enabled. Include system namespaces (e.g. 'istio-system',
// 'monitoring') here if the workloads need them.
// +listType=set
// +kubebuilder:validation:MaxItems=64
// +kubebuilder:validation:items:MinLength=1
// +kubebuilder:validation:items:MaxLength=63
// +kubebuilder:validation:items:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?)$`
// +optional
AllowedNamespaces []string `json:"allowedNamespaces,omitempty"`
}
NetworkIsolationSpec configures the workspace's ingress restrictions, enforced with a standard Kubernetes NetworkPolicy. +kubebuilder:validation:XValidation:rule="!has(self.allowedNamespaces) || size(self.allowedNamespaces) == 0 || self.enabled",message="allowedNamespaces can only be set when network isolation is enabled"
func (*NetworkIsolationSpec) DeepCopy ¶
func (in *NetworkIsolationSpec) DeepCopy() *NetworkIsolationSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkIsolationSpec.
func (*NetworkIsolationSpec) DeepCopyInto ¶
func (in *NetworkIsolationSpec) DeepCopyInto(out *NetworkIsolationSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourceReference ¶
type ResourceReference struct {
// Name is the name of the referenced resource.
// +required
Name string `json:"name"`
// Namespace is the namespace of the referenced resource.
// Empty for cluster-scoped resources.
// +optional
Namespace string `json:"namespace,omitempty"`
}
ResourceReference points at a Kubernetes resource managed by the operator.
func (*ResourceReference) DeepCopy ¶
func (in *ResourceReference) DeepCopy() *ResourceReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceReference.
func (*ResourceReference) DeepCopyInto ¶
func (in *ResourceReference) DeepCopyInto(out *ResourceReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Workspace ¶
type Workspace struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// +optional
metav1.ObjectMeta `json:"metadata,omitzero"`
// Spec defines the desired behavior of the Workspace.
// +required
Spec WorkspaceSpec `json:"spec"`
// Status represents the current information about the Workspace.
// +optional
Status WorkspaceStatus `json:"status,omitzero"`
}
Workspace is the Schema for the workspaces API: a logical isolation unit (a Namespace) with its policies, quotas and member access.
func (*Workspace) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workspace.
func (*Workspace) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Workspace) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type WorkspaceList ¶
type WorkspaceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitzero"`
Items []Workspace `json:"items"`
}
WorkspaceList contains a list of Workspace resources.
func (*WorkspaceList) DeepCopy ¶
func (in *WorkspaceList) DeepCopy() *WorkspaceList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceList.
func (*WorkspaceList) DeepCopyInto ¶
func (in *WorkspaceList) DeepCopyInto(out *WorkspaceList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*WorkspaceList) DeepCopyObject ¶
func (in *WorkspaceList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type WorkspaceMember ¶
type WorkspaceMember struct {
// Role defines the authorization level (Admin, Edit, View).
// +required
Role MemberRole `json:"role"`
// Subject is the unique identifier of the member (e.g., OIDC subject or username).
// It is used directly as the Kubernetes RBAC Subject and as the member's Harbor
// identity: Harbor federates against the same OIDC provider, so the two match
// by construction.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +required
Subject string `json:"subject"`
// Name is the human-readable display name of the member.
// +optional
Name *string `json:"name,omitempty"`
// ServiceAccount indicates whether this member is a service account
// rather than a human user.
// +optional
ServiceAccount bool `json:"serviceAccount,omitempty"`
}
WorkspaceMember defines a single member entity associated with a workspace.
func (*WorkspaceMember) DeepCopy ¶
func (in *WorkspaceMember) DeepCopy() *WorkspaceMember
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceMember.
func (*WorkspaceMember) DeepCopyInto ¶
func (in *WorkspaceMember) DeepCopyInto(out *WorkspaceMember)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type WorkspaceSpec ¶
type WorkspaceSpec struct {
// Namespace is the Kubernetes Namespace created for this workspace, and must
// be unique across all Workspaces.
// When omitted, a 6-character name is auto-generated by the mutating webhook.
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=`^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="namespace is immutable"
// +kubebuilder:validation:XValidation:rule="!(self in ['default','kube-system','kube-public','kube-node-lease','otterscale-system'])",message="namespace is reserved and cannot be used for a workspace"
// +optional
Namespace string `json:"namespace,omitempty"`
// Members is the list of members granted access to this workspace.
// +listType=atomic
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:XValidation:rule="self.exists(u, u.role == 'admin')",message="at least one workspace member must have role 'admin'"
// +required
Members []WorkspaceMember `json:"members"`
// ResourceQuota defines the resource constraints applied to the namespace.
// +optional
ResourceQuota *corev1.ResourceQuotaSpec `json:"resourceQuota,omitempty"`
// LimitRange defines the default resource limits and requests for the workspace's pods.
// +optional
LimitRange *corev1.LimitRangeSpec `json:"limitRange,omitempty"`
// NetworkIsolation defines the ingress traffic rules for the workspace.
// +optional
NetworkIsolation NetworkIsolationSpec `json:"networkIsolation,omitzero"`
}
WorkspaceSpec defines the desired state of the Workspace: its members, resource constraints and network security settings.
func (*WorkspaceSpec) DeepCopy ¶
func (in *WorkspaceSpec) DeepCopy() *WorkspaceSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceSpec.
func (*WorkspaceSpec) DeepCopyInto ¶
func (in *WorkspaceSpec) DeepCopyInto(out *WorkspaceSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type WorkspaceStatus ¶
type WorkspaceStatus struct {
// ObservedGeneration is the most recent Workspace generation the controller
// processed, so clients can tell whether the latest spec change took effect.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// NamespaceRef is a reference to the Namespace managed by this Workspace.
// +optional
NamespaceRef *ResourceReference `json:"namespaceRef,omitempty"`
// ResourceQuotaRef is a reference to the ResourceQuota managed by this Workspace.
// +optional
ResourceQuotaRef *ResourceReference `json:"resourceQuotaRef,omitempty"`
// LimitRangeRef is a reference to the LimitRange managed by this Workspace.
// +optional
LimitRangeRef *ResourceReference `json:"limitRangeRef,omitempty"`
// RoleBindingRefs references the RBAC RoleBindings created for the members.
// +listType=map
// +listMapKey=name
// +optional
RoleBindingRefs []ResourceReference `json:"roleBindingRefs,omitempty"`
// NetworkPolicyRef is a reference to the NetworkPolicy enforcing network isolation.
// +optional
NetworkPolicyRef *ResourceReference `json:"networkPolicyRef,omitempty"`
// ImagePullSecretRef is a reference to the docker-registry Secret holding the
// Harbor robot credentials for image pull/push.
// +optional
ImagePullSecretRef *ResourceReference `json:"imagePullSecretRef,omitempty"`
// HelmRepositoryRef is a reference to the FluxCD HelmRepository for the
// workspace's Harbor OCI registry.
// +optional
HelmRepositoryRef *ResourceReference `json:"helmRepositoryRef,omitempty"`
// Conditions holds the Workspace's status conditions (e.g. Ready).
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
WorkspaceStatus is the observed state of the Workspace: references to the Kubernetes resources the operator created for it.
func (*WorkspaceStatus) DeepCopy ¶
func (in *WorkspaceStatus) DeepCopy() *WorkspaceStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspaceStatus.
func (*WorkspaceStatus) DeepCopyInto ¶
func (in *WorkspaceStatus) DeepCopyInto(out *WorkspaceStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.