github.com/oam-dev/kubevela@v1.9.11/apis/types/types.go (about)

     1  /*
     2  Copyright 2021 The KubeVela Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package types
    18  
    19  import "github.com/oam-dev/kubevela/pkg/oam"
    20  
    21  const (
    22  	// KubeVelaName name of kubevela
    23  	KubeVelaName = "kubevela"
    24  	// VelaCoreName name of vela-core
    25  	VelaCoreName = "vela-core"
    26  )
    27  
    28  const (
    29  	// DefaultKubeVelaReleaseName defines the default name of KubeVela Release
    30  	DefaultKubeVelaReleaseName = "kubevela"
    31  	// DefaultKubeVelaChartName defines the default chart name of KubeVela, this variable MUST align to the chart name of this repo
    32  	DefaultKubeVelaChartName = "vela-core"
    33  	// DefaultKubeVelaVersion defines the default version needed for KubeVela chart
    34  	DefaultKubeVelaVersion = ">0.0.0-0"
    35  	// DefaultEnvName defines the default environment name for Apps created by KubeVela
    36  	DefaultEnvName = "default"
    37  	// DefaultAppNamespace defines the default K8s namespace for Apps created by KubeVela
    38  	DefaultAppNamespace = "default"
    39  	// AutoDetectWorkloadDefinition defines the default workload type for ComponentDefinition which doesn't specify a workload
    40  	AutoDetectWorkloadDefinition = "autodetects.core.oam.dev"
    41  	// KubeVelaControllerDeployment defines the KubeVela controller's deployment name
    42  	KubeVelaControllerDeployment = "kubevela-vela-core"
    43  )
    44  
    45  // DefaultKubeVelaNS defines the default KubeVela namespace in Kubernetes
    46  var DefaultKubeVelaNS = "vela-system"
    47  
    48  const (
    49  	// AnnoDefinitionDescription is the annotation which describe what is the capability used for in a WorkloadDefinition/TraitDefinition Object
    50  	AnnoDefinitionDescription = "definition.oam.dev/description"
    51  	// AnnoDefinitionExampleURL is the annotation which describe url of usage examples of the capability, it will be loaded in documentation generate.
    52  	AnnoDefinitionExampleURL = "definition.oam.dev/example-url"
    53  	// AnnoDefinitionAlias is the annotation for definition alias
    54  	AnnoDefinitionAlias = "definition.oam.dev/alias"
    55  	// AnnoDefinitionIcon is the annotation which describe the icon url
    56  	AnnoDefinitionIcon = "definition.oam.dev/icon"
    57  	// AnnoDefinitionAppliedWorkloads is the annotation which describe what is the workloads used for in a TraitDefinition Object
    58  	AnnoDefinitionAppliedWorkloads = "definition.oam.dev/appliedWorkloads"
    59  	// LabelDefinition is the label for definition
    60  	LabelDefinition = "definition.oam.dev"
    61  	// LabelDefinitionName is the label for definition name
    62  	LabelDefinitionName = "definition.oam.dev/name"
    63  	// LabelDefinitionDeprecated is the label which describe whether the capability is deprecated
    64  	LabelDefinitionDeprecated = "custom.definition.oam.dev/deprecated"
    65  	// LabelDefinitionHidden is the label which describe whether the capability is hidden by UI
    66  	LabelDefinitionHidden = "custom.definition.oam.dev/ui-hidden"
    67  	// LabelNodeRoleGateway gateway role of node
    68  	LabelNodeRoleGateway = "node-role.kubernetes.io/gateway"
    69  	// LabelNodeRoleWorker worker role of node
    70  	LabelNodeRoleWorker = "node-role.kubernetes.io/worker"
    71  	// AnnoIngressControllerHTTPSPort define ingress controller listen port for https
    72  	AnnoIngressControllerHTTPSPort = "ingress.controller/https-port"
    73  	// AnnoIngressControllerHTTPPort define ingress controller listen port for http
    74  	AnnoIngressControllerHTTPPort = "ingress.controller/http-port"
    75  	// AnnoIngressControllerHost define ingress controller externally host
    76  	AnnoIngressControllerHost = "ingress.controller/host"
    77  	// LabelConfigType is the label marked as the template that generated the config.
    78  	LabelConfigType = "config.oam.dev/type"
    79  	// LabelConfigCatalog is the label marked as the secret generated from the config.
    80  	LabelConfigCatalog = "config.oam.dev/catalog"
    81  	// LabelConfigSubType is the sub-type for a config type
    82  	LabelConfigSubType = "config.oam.dev/sub-type"
    83  	// LabelConfigProject is the label for config project
    84  	LabelConfigProject = "config.oam.dev/project"
    85  	// LabelConfigSyncToMultiCluster is the label to decide whether a config will be synchronized to multi-cluster
    86  	LabelConfigSyncToMultiCluster = "config.oam.dev/multi-cluster"
    87  	// LabelConfigIdentifier is the label for config identifier
    88  	LabelConfigIdentifier = "config.oam.dev/identifier"
    89  	// LabelConfigScope is the label for config scope
    90  	LabelConfigScope = "config.oam.dev/scope"
    91  	// AnnotationConfigSensitive is the annotation for the sensitization
    92  	AnnotationConfigSensitive = "config.oam.dev/sensitive"
    93  	// AnnotationConfigTemplateNamespace is the annotation for the template namespace
    94  	AnnotationConfigTemplateNamespace = "config.oam.dev/template-namespace"
    95  	// AnnotationConfigDescription is the annotation for config description
    96  	AnnotationConfigDescription = "config.oam.dev/description"
    97  	// AnnotationConfigAlias is the annotation for config alias
    98  	AnnotationConfigAlias = "config.oam.dev/alias"
    99  	// AnnotationConfigDistributionSpec is the annotation key of the application that distributes the configs
   100  	AnnotationConfigDistributionSpec = "config.oam.dev/distribution-spec"
   101  )
   102  
   103  const (
   104  	// StatusDeployed represents the App was deployed
   105  	StatusDeployed = "Deployed"
   106  	// StatusStaging represents the App was changed locally and it's spec is diff from the deployed one, or not deployed at all
   107  	StatusStaging = "Staging"
   108  )
   109  
   110  // Config contains key/value pairs
   111  type Config map[string]string
   112  
   113  // EnvMeta stores the namespace for app environment
   114  type EnvMeta struct {
   115  	Name      string `json:"name"`
   116  	Namespace string `json:"namespace"`
   117  	Labels    string `json:"labels"`
   118  	Current   string `json:"current"`
   119  }
   120  
   121  const (
   122  	// TagCommandType used for tag cli category
   123  	TagCommandType = "commandType"
   124  
   125  	// TagCommandOrder defines the order
   126  	TagCommandOrder = "commandOrder"
   127  
   128  	// TypeStart defines one category
   129  	TypeStart = "Getting Started"
   130  
   131  	// TypeApp defines one category
   132  	TypeApp = "Managing Applications"
   133  
   134  	// TypeCD defines workflow Management operations
   135  	TypeCD = "Continuous Delivery"
   136  
   137  	// TypeExtension defines one category
   138  	TypeExtension = "Managing Extensions"
   139  
   140  	// TypeSystem defines one category
   141  	TypeSystem = "System Tools"
   142  
   143  	// TypeAuxiliary defines auxiliary commands
   144  	TypeAuxiliary = "Auxiliary Tools"
   145  
   146  	// TypePlatform defines platform management commands
   147  	TypePlatform = "Managing Platform"
   148  
   149  	// TypeLegacy defines legacy commands
   150  	TypeLegacy = "Legacy Commands"
   151  )
   152  
   153  // LabelArg is the argument `label` of a definition
   154  const LabelArg = "label"
   155  
   156  // DefaultFilterAnnots are annotations that won't pass to workload or trait
   157  var DefaultFilterAnnots = []string{
   158  	oam.AnnotationInplaceUpgrade,
   159  	oam.AnnotationFilterLabelKeys,
   160  	oam.AnnotationFilterAnnotationKeys,
   161  	oam.AnnotationLastAppliedConfiguration,
   162  }
   163  
   164  // ConfigType is the type of config
   165  type ConfigType string
   166  
   167  const (
   168  	// TerraformProvider is the config type for terraform provider
   169  	TerraformProvider = "terraform-provider"
   170  	// DexConnector is the config type for dex connector
   171  	DexConnector = "dex-connector"
   172  	// ImageRegistry is the config type for image registry
   173  	ImageRegistry = "image-registry"
   174  	// HelmRepository is the config type for Helm chart repository
   175  	HelmRepository = "helm-repository"
   176  	// CatalogConfigDistribution is the catalog type
   177  	CatalogConfigDistribution = "config-distribution"
   178  )
   179  
   180  const (
   181  	// TerraformComponentPrefix is the prefix of component type of terraform-xxx
   182  	TerraformComponentPrefix = "terraform-"
   183  
   184  	// ProviderAppPrefix is the prefix of the application to create a Terraform Provider
   185  	ProviderAppPrefix = "config-terraform-provider"
   186  	// ProviderNamespace is the namespace of Terraform Cloud Provider
   187  	ProviderNamespace = "default"
   188  	// VelaCoreConfig is to mark application, config and its secret or Terraform provider lelong to a KubeVela config
   189  	VelaCoreConfig = "velacore-config"
   190  )
   191  
   192  const (
   193  	// LabelSourceOfTruth describes the source of this app
   194  	LabelSourceOfTruth = "app.oam.dev/source-of-truth"
   195  
   196  	// FromCR means the data source of truth is from k8s CR
   197  	FromCR = "from-k8s-resource"
   198  	// FromUX means the data source of truth is from velaux data store
   199  	FromUX = "from-velaux"
   200  	// FromInner means the data source of truth is from KubeVela inner usage
   201  	// the configuration that don't want to be synced
   202  	// the addon application should be synced, but set to readonly mode
   203  	FromInner = "from-inner-system"
   204  )