common

package
v0.9.3-beta.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AdminTenant is name of the system admin tenant, it's a default tenant created when Cyclone
	// start, and resources shared among all tenants would be placed in this tenant, such as stage
	// templates.
	AdminTenant = "admin"

	// TenantNamespacePrefix is the prefix of namespace which related to a specific tenant
	TenantNamespacePrefix = "cyclone--"

	// TenantPVCPrefix is the prefix of pvc which related to a specific tenant
	TenantPVCPrefix = "cyclone-pvc-"

	// DefaultPVCSize is the default size of pvc
	DefaultPVCSize = "5Gi"

	// AnnotationTenant is the annotation key used for namespace to relate tenant information
	AnnotationTenant = "cyclone.io/tenant-info"

	// LabelProjectName is the label key used to indicate the project which the resources belongs to
	LabelProjectName = "cyclone.io/project-name"

	// LabelWorkflowName is the label key used to indicate the workflow which the resources belongs to
	LabelWorkflowName = "cyclone.io/workflow-name"

	// LabelIntegrationType is the label key used to indicate type of integration
	LabelIntegrationType = "cyclone.io/integration-type"

	// LabelClusterOn is the label key used to indicate the cluster is a worker for the tenant
	LabelClusterOn = "cyclone.io/cluster-worker"

	// LabelTrueValue is the label value used to represent true
	LabelTrueValue = "true"

	// LabelFalseValue is the label value used to represent false
	LabelFalseValue = "false"

	// LabelOwner is the label key used to indicate namespaces created by cyclone
	LabelOwner = "cyclone.io/owner"

	// OwnerCyclone is the label value used to indicate namespaces created by cyclone
	OwnerCyclone = "cyclone"

	// LabelBuiltin is the label key used to represent cyclone built in resources
	LabelBuiltin = "cyclone.io/builtin"

	// LabelScene is the label key used to indicate cyclone scenario
	LabelScene = "cyclone.io/scene"

	// SceneCICD is the label value used to indicate cyclone CI/CD scenario
	SceneCICD = "cicd"

	// SceneAI is the label value used to indicate cyclone AI scenario
	SceneAI = "ai"

	// LabelStageTemplate is the label key used to represent a stage is a stage template
	LabelStageTemplate = "cyclone.io/stage-template"

	// AnnotationAlias is the annotation key used to indicate the alias of resources
	AnnotationAlias = "cyclone.io/alias"

	// AnnotationDescription is the annotation key used to describe resources
	AnnotationDescription = "cyclone.io/description"

	// QuotaCPULimit represents default value of 'limits.cpu'
	QuotaCPULimit = "2"
	// QuotaCPURequest represents default value of 'requests.cpu'
	QuotaCPURequest = "1"
	// QuotaMemoryLimit represents default value of 'limits.memory'
	QuotaMemoryLimit = "4Gi"
	// QuotaMemoryRequest represents default value of 'requests.memory'
	QuotaMemoryRequest = "2Gi"

	// SecretKeyIntegration is the key of the secret dada to indicate its value is about integration information.
	SecretKeyIntegration = "integration"

	// ControlClusterName is the name of control cluster
	ControlClusterName = "control-cluster"
)

Variables

This section is empty.

Functions

func CreateNamespace

func CreateNamespace(name string, client *kubernetes.Clientset) error

CreateNamespace creates a namespace

func CreatePVC

func CreatePVC(tenantName, storageClass, size string, namespace string, client *kubernetes.Clientset) error

CreatePVC creates pvc for tenant

func CreateResourceQuota

func CreateResourceQuota(tenant *api.Tenant, namespace string, client *kubernetes.Clientset) error

CreateResourceQuota creates resource quota for tenant

func IntegrationSecret

func IntegrationSecret(i string) string

IntegrationSecret returns secret name related to the integration

func LabelOwnerCyclone

func LabelOwnerCyclone() string

LabelOwnerCyclone returns a label string describes resource belongs to cyclone

func NamespaceTenant

func NamespaceTenant(n string) string

NamespaceTenant retrieves tenant from given namespace name.

func NewClusterClient

func NewClusterClient(c *api.ClusterCredential, inCluster bool) (*kubernetes.Clientset, error)

NewClusterClient creates a client for k8s cluster

func ParseResourceList

func ParseResourceList(resources map[core_v1.ResourceName]string) (map[core_v1.ResourceName]resource.Quantity, error)

ParseResourceList parse resouces from 'map[string]string' to 'ResourceList'

func ProjectSelector

func ProjectSelector(project string) string

ProjectSelector is a selector for cyclone CRD resources which have corresponding project label

func SecretIntegration

func SecretIntegration(s string) string

SecretIntegration returns integration name related to the secret

func TenantNamespace

func TenantNamespace(tenant string) string

TenantNamespace gets namespace from given tenant name.

func TenantPVC

func TenantPVC(tenant string) string

TenantPVC returns pvc name related to the tenant

func TenantResourceQuota

func TenantResourceQuota(tenant string) string

TenantResourceQuota returns resource quota name related the tenant

func UpdatePVC

func UpdatePVC(tenantName, storageClass, size string, namespace string, client *kubernetes.Clientset) error

UpdatePVC delete the old pvc and recreate another one, so the data of the pvc will lost.

func UpdateResourceQuota

func UpdateResourceQuota(tenant *api.Tenant, namespace string, client *kubernetes.Clientset) error

UpdateResourceQuota updates resource quota for tenant

func WorkerClustersSelector

func WorkerClustersSelector() string

WorkerClustersSelector is a selector for clusters which are use to perform workload

func WorkflowSelector

func WorkflowSelector(workflow string) string

WorkflowSelector is a selector for cyclone CRD resources which have corresponding workflow label

Types

This section is empty.

Jump to

Keyboard shortcuts

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