v1alpha1

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 13 Imported by: 0

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

View Source
const (
	DefaultWorkspaceResourceName        string = "workspace"
	DefaultWorkspaceServiceMainPortName string = "default"
)
View Source
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

View Source
const (
	TemplateAnnKeyDefaultUserAddon = "cosmo/default-user-addon"
	TemplateAnnKeySysNsUserAddon   = "cosmo/sysns-user-addon"
)

Template annotation keys for user addon

View Source
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

View Source
const (
	UserPasswordSecretName                        = "password"
	UserPasswordSecretDataKeyUserPasswordSecret   = "password"
	UserPasswordSecretDataKeyUserPasswordSalt     = "salt"
	UserPasswordSecretAnnKeyUserPasswordIfDefault = "cosmo/default"
)

UserPasswordSecret name and keys

View Source
const (
	TemplateTypeWorkspace = "workspace"
	TemplateTypeUserAddon = "user-addon"
)

TemplateType enum for Workspace

View Source
const (
	AuthProxyRoleName               = "cosmo-auth-proxy-role"
	AuthProxyClusterRoleBindingName = "cosmo-auth-proxy-rolebinding"
)

AuthProxy RBAC names

View Source
const (
	UserNamespacePrefix     = "cosmo-user-"
	NamespaceLabelKeyUserID = "cosmo/user-id"
)

Variables

View Source
var (
	ErrNoAnnotations    = errors.New("no annotations")
	ErrNotTypeWorkspace = errors.New("not type workspace")
	ErrURLBaseNotFound  = errors.New("urlbase not found")
)
View Source
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 AuthProxyRole(namespace string) rbacv1.Role

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 UserIDByNamespace(namespace string) string

func UserNamespace

func UserNamespace(userid string) string

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

func (in *Config) DeepCopy() *Config

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.

func (*Config) DeepCopyInto

func (in *Config) DeepCopyInto(out *Config)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Config) Default

func (c *Config) Default()

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

func (in *User) DeepCopy() *User

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new User.

func (*User) DeepCopyInto

func (in *User) DeepCopyInto(out *User)

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

func (in *User) DeepCopyObject() runtime.Object

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

func (in *UserAddon) DeepCopy() *UserAddon

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserAddon.

func (*UserAddon) DeepCopyInto added in v0.2.0

func (in *UserAddon) DeepCopyInto(out *UserAddon)

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

func (in *UserList) DeepCopy() *UserList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserList.

func (*UserList) DeepCopyInto added in v0.2.0

func (in *UserList) DeepCopyInto(out *UserList)

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

func (in *UserList) DeepCopyObject() runtime.Object

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"
)

func (UserRole) IsAdmin

func (r UserRole) IsAdmin() bool

func (UserRole) IsValid

func (r UserRole) IsValid() bool

func (UserRole) String

func (r UserRole) String() string

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

func (in *UserSpec) DeepCopy() *UserSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserSpec.

func (*UserSpec) DeepCopyInto added in v0.2.0

func (in *UserSpec) DeepCopyInto(out *UserSpec)

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

func (in *Workspace) DeepCopy() *Workspace

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workspace.

func (*Workspace) DeepCopyInto

func (in *Workspace) DeepCopyInto(out *Workspace)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Workspace) DeepCopyObject

func (in *Workspace) DeepCopyObject() runtime.Object

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL