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 AddWorkspaceTemplateVars(vars map[string]string, cfg Config) map[string]string
- func AuthProxyRole(namespace string) rbacv1.Role
- func AuthProxyRoleBindingApplyConfiguration(sa, namespace string) *rbacv1apply.RoleBindingApplyConfiguration
- func AuthProxyRoleBindings(sa, namespace string) rbacv1.RoleBinding
- func InstanceIngressAnnKeyNetRuleGroup(portName string) string
- func SetConfigOnTemplateAnnotations(tmpl *cosmov1alpha1.Template, cfg Config)
- func UserIDByNamespace(namespace string) string
- func UserNamespace(userid string) string
- type Config
- type NetworkRule
- type User
- type UserAuthType
- type UserRole
- type Workspace
- type WorkspaceList
- type WorkspaceSpec
- type WorkspaceStatus
Constants ¶
const ( DefaultWorkspaceResourceName string = "workspace" DefaultWorkspaceServiceMainPortName string = "default" )
const ( InstanceAnnKeyURLBase = "cosmo/ws-urlbase" InstanceAnnKeyWorkspaceDeployment = "cosmo/ws-deployment" InstanceAnnKeyWorkspaceService = "cosmo/ws-service" InstanceAnnKeyWorkspaceIngress = "cosmo/ws-ingress" InstanceAnnKeyWorkspaceServiceMainPort = "cosmo/ws-service-main-port" )
Instance annotation keys for WorkspaceConfig
const ( TemplateVarDeploymentName = "{{WORKSPACE_DEPLOYMENT_NAME}}" TemplateVarServiceName = "{{WORKSPACE_SERVICE_NAME}}" TemplateVarIngressName = "{{WORKSPACE_INGRESS_NAME}}" TemplateVarServiceMainPortName = "{{WORKSPACE_SERVICE_MAIN_PORT_NAME}}" )
Template variables key
const ( UserNamespacePrefix = "cosmo-user-" NamespaceLabelKeyUserID = "cosmo/user-id" NamespaceAnnKeyUserName = "cosmo/user-name" NamespaceAnnKeyUserRole = "cosmo/user-role" NamespaceAnnKeyUserAuthType = "cosmo/auth-type" )
UserNamespace name and keys
const ( UserPasswordSecretName = "password" UserPasswordSecretDataKeyUserPasswordSecret = "password" UserPasswordSecretDataKeyUserPasswordSalt = "salt" UserPasswordSecretAnnKeyUserPasswordIfDefault = "cosmo/default" )
UserPasswordSecret name and keys
const ( AuthProxyRoleName = "cosmo-auth-proxy-role" AuthProxyClusterRoleBindingName = "cosmo-auth-proxy-rolebinding" )
AuthProxy RBAC names
const (
InstanceIngressAnnKeyNetRuleGroupPrefix = "cosmo/ws-netrule-group"
)
Key of NetworkRule Group
const (
TemplateTypeWorkspace = "workspace"
)
TemplateType enum for Workspace
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 { ID string `json:"id"` DisplayName string `json:"displayName,omitempty"` Role UserRole `json:"role,omitempty"` AuthType UserAuthType `json:"authType,omitempty"` Status corev1.NamespacePhase `json:"status,omitempty"` }
+kubebuilder:object:generate=true User is namespace for Workspace. This is not custom resource but converted to Namespace object.
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.
type UserAuthType ¶
type UserAuthType string
UserAuthType enums
const (
UserAuthTypeKosmoSecert UserAuthType = "kosmo-secret"
)
func (UserAuthType) IsValid ¶
func (t UserAuthType) IsValid() bool
func (UserAuthType) String ¶
func (t UserAuthType) String() string
type UserRole ¶
type UserRole string
UserRole enums
const (
UserAdminRole UserRole = "cosmo-admin"
)
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.