Documentation ¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the workspace v1alpha1 API group +kubebuilder:object:generate=true +groupName=workspace.cosmo-workspace.github.io
Index ¶
- Constants
- Variables
- func AuthProxyRole(namespace string) rbacv1.Role
- func AuthProxyRoleBindingApplyConfiguration(sa, namespace string) *rbacv1apply.RoleBindingApplyConfiguration
- func AuthProxyRoleBindings(sa, namespace string) rbacv1.RoleBinding
- func SetConfigOnTemplateAnnotations(tmpl *cosmov1alpha1.Template, cfg Config)
- func UserIDByNamespace(namespace string) string
- func UserNamespace(userid string) string
- type Config
- type NetworkRule
- type User
- type UserAddon
- type UserAuthType
- type UserList
- type UserRole
- type UserSpec
- type UserStatus
- type Workspace
- type WorkspaceList
- type WorkspaceSpec
- type WorkspaceStatus
Constants ¶
const ( DefaultWorkspaceResourceName string = "workspace" DefaultWorkspaceServiceMainPortName string = "default" )
const ( TemplateAnnKeyURLBase = "cosmo/ws-urlbase" TemplateAnnKeyWorkspaceDeployment = "cosmo/ws-deployment" TemplateAnnKeyWorkspaceService = "cosmo/ws-service" TemplateAnnKeyWorkspaceIngress = "cosmo/ws-ingress" TemplateAnnKeyWorkspaceServiceMainPort = "cosmo/ws-service-main-port" )
Template annotation keys for WorkspaceConfig
const ( TemplateAnnKeyDefaultUserAddon = "cosmo/default-user-addon" TemplateAnnKeySysNsUserAddon = "cosmo/sysns-user-addon" )
Template annotation keys for user addon
const ( TemplateVarDeploymentName = "{{WORKSPACE_DEPLOYMENT_NAME}}" TemplateVarServiceName = "{{WORKSPACE_SERVICE_NAME}}" TemplateVarIngressName = "{{WORKSPACE_INGRESS_NAME}}" TemplateVarServiceMainPortName = "{{WORKSPACE_SERVICE_MAIN_PORT_NAME}}" // TemplateVarUserNamespace is variable for user addon in system namespace. TemplateVarUserNamespace = "{{USER_NAMESPACE}}" )
Template variables key
const ( UserPasswordSecretName = "password" UserPasswordSecretDataKeyUserPasswordSecret = "password" UserPasswordSecretDataKeyUserPasswordSalt = "salt" UserPasswordSecretAnnKeyUserPasswordIfDefault = "cosmo/default" )
UserPasswordSecret name and keys
const ( TemplateTypeWorkspace = "workspace" TemplateTypeUserAddon = "user-addon" )
TemplateType enum for Workspace
const ( AuthProxyRoleName = "cosmo-auth-proxy-role" AuthProxyClusterRoleBindingName = "cosmo-auth-proxy-rolebinding" )
AuthProxy RBAC names
const ( UserNamespacePrefix = "cosmo-user-" NamespaceLabelKeyUserID = "cosmo/user-id" )
Variables ¶
var ( ErrNoAnnotations = errors.New("no annotations") ErrNotTypeWorkspace = errors.New("not type workspace") ErrURLBaseNotFound = errors.New("urlbase not found") )
var ( // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: "workspace.cosmo-workspace.github.io", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
Functions ¶
func AuthProxyRole ¶
func AuthProxyRoleBindingApplyConfiguration ¶
func AuthProxyRoleBindingApplyConfiguration(sa, namespace string) *rbacv1apply.RoleBindingApplyConfiguration
func AuthProxyRoleBindings ¶
func AuthProxyRoleBindings(sa, namespace string) rbacv1.RoleBinding
func SetConfigOnTemplateAnnotations ¶
func SetConfigOnTemplateAnnotations(tmpl *cosmov1alpha1.Template, cfg Config)
func UserIDByNamespace ¶
func UserNamespace ¶
Types ¶
type Config ¶
type Config struct { DeploymentName string `json:"deploymentName,omitempty"` ServiceName string `json:"serviceName,omitempty"` IngressName string `json:"ingressName,omitempty"` ServiceMainPortName string `json:"mainServicePortName,omitempty"` URLBase string `json:"urlbase,omitempty"` }
Config defines template-dependent or workspace-dependent configuration metadata for workspace
func ConfigFromTemplateAnnotations ¶
func ConfigFromTemplateAnnotations(tmpl *cosmov1alpha1.Template) (cfg Config, err error)
func (*Config) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.
func (*Config) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NetworkRule ¶
type NetworkRule struct { PortName string `json:"portName"` PortNumber int `json:"portNumber"` HTTPPath string `json:"httpPath"` TargetPortNumber *int32 `json:"targetPortNumber,omitempty"` Host *string `json:"host,omitempty"` Group *string `json:"group,omitempty"` Public bool `json:"public"` }
NetworkRule is an abstract network configuration rule for workspace
func NetworkRulesByServiceAndIngress ¶
func NetworkRulesByServiceAndIngress(svc corev1.Service, ing netv1.Ingress) []NetworkRule
func (*NetworkRule) DeepCopy ¶
func (in *NetworkRule) DeepCopy() *NetworkRule
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkRule.
func (*NetworkRule) DeepCopyInto ¶
func (in *NetworkRule) DeepCopyInto(out *NetworkRule)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*NetworkRule) Default ¶
func (r *NetworkRule) Default()
func (*NetworkRule) IngressRule ¶
func (r *NetworkRule) IngressRule(backendSvcName string) netv1.IngressRule
func (*NetworkRule) ServicePort ¶
func (r *NetworkRule) ServicePort() corev1.ServicePort
type User ¶
type User struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec UserSpec `json:"spec,omitempty"` Status UserStatus `json:"status,omitempty"` }
+kubebuilder:object:root=true +kubebuilder:resource:scope="Cluster" +kubebuilder:subresource:status +kubebuilder:storageversion +kubebuilder:printcolumn:name="Display-Name",type=string,JSONPath=`.spec.displayName` +kubebuilder:printcolumn:name="Role",type=string,JSONPath=`.spec.role` +kubebuilder:printcolumn:name="Auth-Type",type=string,JSONPath=`.spec.authType` +kubebuilder:printcolumn:name="Addons",type=string,JSONPath=`.spec.addons` +kubebuilder:printcolumn:name="Namespace",type=string,JSONPath=`.status.namespace.name` +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase` User is the Schema for the workspaces API
func (*User) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new User.
func (*User) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*User) DeepCopyObject ¶ added in v0.2.0
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type UserAddon ¶ added in v0.2.0
type UserAddon struct { Template cosmov1alpha1.TemplateRef `json:"template,omitempty"` Vars map[string]string `json:"vars,omitempty"` }
func (*UserAddon) DeepCopy ¶ added in v0.2.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserAddon.
func (*UserAddon) DeepCopyInto ¶ added in v0.2.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type UserAuthType ¶
type UserAuthType string
+kubebuilder:validation:enum=kosmo-secret UserAuthType enums
const (
UserAuthTypeKosmoSecert UserAuthType = "kosmo-secret"
)
func (UserAuthType) IsValid ¶
func (t UserAuthType) IsValid() bool
func (UserAuthType) String ¶
func (t UserAuthType) String() string
type UserList ¶ added in v0.2.0
type UserList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []User `json:"items"` }
+kubebuilder:object:root=true UserList contains a list of User
func (*UserList) DeepCopy ¶ added in v0.2.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserList.
func (*UserList) DeepCopyInto ¶ added in v0.2.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*UserList) DeepCopyObject ¶ added in v0.2.0
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type UserRole ¶
type UserRole string
+kubebuilder:validation:enum=cosmo-admin UserRole enums
const (
UserAdminRole UserRole = "cosmo-admin"
)
type UserSpec ¶ added in v0.2.0
type UserSpec struct { DisplayName string `json:"displayName,omitempty"` Role UserRole `json:"role,omitempty"` AuthType UserAuthType `json:"authType,omitempty"` Addons []UserAddon `json:"addons,omitempty"` }
func (*UserSpec) DeepCopy ¶ added in v0.2.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserSpec.
func (*UserSpec) DeepCopyInto ¶ added in v0.2.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type UserStatus ¶ added in v0.2.0
type UserStatus struct { Phase corev1.NamespacePhase `json:"phase,omitempty"` Namespace cosmov1alpha1.ObjectRef `json:"namespace,omitempty"` }
func (*UserStatus) DeepCopy ¶ added in v0.2.0
func (in *UserStatus) DeepCopy() *UserStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserStatus.
func (*UserStatus) DeepCopyInto ¶ added in v0.2.0
func (in *UserStatus) DeepCopyInto(out *UserStatus)
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"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec WorkspaceSpec `json:"spec,omitempty"` Status WorkspaceStatus `json:"status,omitempty"` }
+kubebuilder:object:root=true +kubebuilder:resource:shortName=ws +kubebuilder:subresource:status +kubebuilder:storageversion +kubebuilder:printcolumn:name="Template",type=string,JSONPath=`.spec.template.name` +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase` Workspace is the Schema for the workspaces API
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,omitempty"` Items []Workspace `json:"items"` }
+kubebuilder:object:root=true WorkspaceList contains a list of Workspace
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 WorkspaceSpec ¶
type WorkspaceSpec struct { // +kubebuilder:validation:Required Template cosmov1alpha1.TemplateRef `json:"template"` Replicas *int64 `json:"replicas,omitempty"` Vars map[string]string `json:"vars,omitempty"` Network []NetworkRule `json:"network,omitempty"` }
WorkspaceSpec defines the desired state of Workspace
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 { Instance cosmov1alpha1.ObjectRef `json:"instance,omitempty"` Phase string `json:"phase,omitempty"` URLs map[string]string `json:"urls,omitempty"` Config Config `json:"config,omitempty"` }
WorkspaceStatus has status of Workspace
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.