v1alpha1

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: MIT Imports: 14 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 (
	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

View Source
const (
	TemplateVarDeploymentName      = "{{WORKSPACE_DEPLOYMENT_NAME}}"
	TemplateVarServiceName         = "{{WORKSPACE_SERVICE_NAME}}"
	TemplateVarIngressName         = "{{WORKSPACE_INGRESS_NAME}}"
	TemplateVarServiceMainPortName = "{{WORKSPACE_SERVICE_MAIN_PORT_NAME}}"
)

Template variables key

View Source
const (
	UserNamespacePrefix         = "cosmo-user-"
	NamespaceLabelKeyUserID     = "cosmo/user-id"
	NamespaceAnnKeyUserName     = "cosmo/user-name"
	NamespaceAnnKeyUserRole     = "cosmo/user-role"
	NamespaceAnnKeyUserAuthType = "cosmo/auth-type"
)

UserNamespace name and keys

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

UserPasswordSecret name and keys

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

AuthProxy RBAC names

View Source
const (
	InstanceIngressAnnKeyNetRuleGroupPrefix = "cosmo/ws-netrule-group"
)

Key of NetworkRule Group

View Source
const (
	TemplateTypeWorkspace = "workspace"
)

TemplateType enum for Workspace

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 AddWorkspaceTemplateVars

func AddWorkspaceTemplateVars(vars map[string]string, cfg Config) map[string]string

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 InstanceIngressAnnKeyNetRuleGroup

func InstanceIngressAnnKeyNetRuleGroup(portName string) string

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 {
	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 ConvertUserNamespaceToUser

func ConvertUserNamespaceToUser(ns corev1.Namespace) (*User, error)

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.

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

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