environment

package
v0.0.0-...-bf90f01 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldKind          = "kind"
	FieldObjects       = "objects"
	FieldSpec          = "spec"
	FieldItems         = "items"
	FieldMetadata      = "metadata"
	FieldLabels        = "labels"
	FieldVersion       = "version"
	FieldVersionQuotas = "version-quotas"
	FieldNamespace     = "namespace"
	FieldName          = "name"
	FieldStatus        = "status"
	FieldParameters    = "parameters"

	ValKindTemplate                = "Template"
	ValKindNamespace               = "Namespace"
	ValKindConfigMap               = "ConfigMap"
	ValKindLimitRange              = "LimitRange"
	ValKindProject                 = "Project"
	ValKindProjectRequest          = "ProjectRequest"
	ValKindPersistentVolumeClaim   = "PersistentVolumeClaim"
	ValKindService                 = "Service"
	ValKindSecret                  = "Secret"
	ValKindServiceAccount          = "ServiceAccount"
	ValKindRoleBindingRestriction  = "RoleBindingRestriction"
	ValKindRoleBinding             = "RoleBinding"
	ValKindRole                    = "Role"
	ValKindRoute                   = "Route"
	ValKindJob                     = "Job"
	ValKindList                    = "List"
	ValKindDeployment              = "Deployment"
	ValKindDeploymentConfig        = "DeploymentConfig"
	ValKindResourceQuota           = "ResourceQuota"
	ValKindPod                     = "Pod"
	ValKindReplicationController   = "ReplicationController"
	ValKindDaemonSet               = "DaemonSet"
	ValKindReplicaSet              = "ReplicaSet"
	ValKindStatefulSet             = "StatefulSet"
	ValKindHorizontalPodAutoScaler = "HorizontalPodAutoScaler"
	ValKindCronJob                 = "CronJob"
	ValKindBuildConfig             = "BuildConfig"
	ValKindBuild                   = "Build"
	ValKindImageStream             = "ImageStream"
)

Variables

View Source
var (
	VersionFabric8TenantUserFile          string
	VersionFabric8TenantCheMtFile         string
	VersionFabric8TenantJenkinsFile       string
	VersionFabric8TenantJenkinsQuotasFile string
	VersionFabric8TenantCheQuotasFile     string
	VersionFabric8TenantDeployFile        string
	DefaultEnvTypes                       = []Type{TypeChe, TypeUser}
)
View Source
var (
	OnlyNumbers = regexp.MustCompile("^[0-9]*$")
)

Functions

func CollectVars

func CollectVars(osUsername, nsBaseName, masterUser string, config *configuration.Data) map[string]string

func GetKind

func GetKind(obj Object) string

func GetLabel

func GetLabel(obj Object, name string) string

func GetLabelVersion

func GetLabelVersion(obj Object) string

func GetName

func GetName(obj Object) string

func GetNamespace

func GetNamespace(obj Object) string

func HasValidStatus

func HasValidStatus(obj Object) bool

func RetrieveMappedTemplates

func RetrieveMappedTemplates() map[Type]Templates

func RetrieveUserName

func RetrieveUserName(openshiftUsername string) string

RetrieveUserName returns a safe namespace basename based on a username

Types

type ByKind

type ByKind Objects

ByKind represents a list of Openshift objects sortable by Kind

func (ByKind) Len

func (a ByKind) Len() int

func (ByKind) Less

func (a ByKind) Less(i, j int) bool

func (ByKind) Swap

func (a ByKind) Swap(i, j int)

type EnvData

type EnvData struct {
	EnvType   Type
	Templates Templates
}

func (*EnvData) Version

func (e *EnvData) Version() string

type Object

type Object map[interface{}]interface{}

func GetStatus

func GetStatus(obj Object) Object

func (Object) ToString

func (o Object) ToString() string

type Objects

type Objects []Object

func ParseObjects

func ParseObjects(source string) (Objects, error)

ParseObjects return a string yaml and return a array of the objects/items from a Template/List kind

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService() *Service

func NewServiceForUserData

func NewServiceForUserData(user *authclient.UserDataAttributes) *Service

func (*Service) GetEnvData

func (s *Service) GetEnvData(ctx context.Context, envType Type) (*EnvData, error)

type Template

type Template struct {
	Filename      string
	DefaultParams map[string]string
	Content       string
	Version       string
}

func (*Template) Process

func (t *Template) Process(vars map[string]string) (Objects, error)

func (*Template) ReplaceVars

func (t *Template) ReplaceVars(variables map[string]string) (string, error)

Process takes a K8/Openshift Template as input and resolves the variable expresions

type Templates

type Templates []*Template

func (Templates) ConstructCompleteVersion

func (t Templates) ConstructCompleteVersion() string

type Type

type Type string

Type describes which type of namespace this is

const (
	TypeChe  Type = "che"
	TypeUser Type = "user"
)

Represents the namespace type

func (*Type) Scan

func (ns *Type) Scan(value interface{}) error

Scan - Implement the database/sql scanner interface

func (Type) String

func (t Type) String() string

func (*Type) Value

func (ns *Type) Value() (driver.Value, error)

Value - Implementation of valuer for database/sql

Jump to

Keyboard shortcuts

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