mirror of
https://github.com/kubevela/kubevela.git
synced 2026-03-02 01:30:47 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d083039a32 | ||
|
|
5e6be649c1 | ||
|
|
706a65beae | ||
|
|
d21a337dd7 | ||
|
|
b53f4f4fdd | ||
|
|
24970cd990 |
@@ -114,6 +114,9 @@ type Terraform struct {
|
||||
// +kubebuilder:validation:Enum:=hcl;json;remote
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// Path is the sub-directory of remote git repository. It's valid when remote is set
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
// ProviderReference specifies the reference to Provider
|
||||
ProviderReference *types.Reference `json:"providerRef,omitempty"`
|
||||
}
|
||||
|
||||
@@ -188,6 +188,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -468,6 +472,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -193,6 +193,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -454,6 +458,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -1232,6 +1232,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1635,6 +1639,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1936,6 +1944,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3360,6 +3372,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3656,6 +3672,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4041,6 +4061,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4305,6 +4329,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4585,6 +4613,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
|
||||
@@ -179,6 +179,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -463,6 +467,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -222,6 +222,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -506,6 +510,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -783,6 +791,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1041,6 +1053,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
|
||||
@@ -151,6 +151,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -188,6 +188,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -468,6 +472,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -148,6 +148,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -193,6 +193,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -454,6 +458,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -16,7 +16,7 @@ data:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: alibaba-provider-secret
|
||||
name: alibaba-account-creds
|
||||
namespace: vela-system
|
||||
stringData:
|
||||
credentials: |
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
application: |
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Kubernetes Terraform Controller for AWS
|
||||
addons.oam.dev/name: terraform/provider-aws
|
||||
name: terraform-provider-aws
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: aws-account-creds
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: aws-account-creds
|
||||
namespace: vela-system
|
||||
stringData:
|
||||
credentials: |
|
||||
awsAccessKeyID: [[ index .Args "AWS_ACCESS_KEY_ID" ]]
|
||||
awsSecretAccessKey: [[ index .Args "AWS_SECRET_ACCESS_KEY" ]]
|
||||
awsSessionToken: [[ index .Args "AWS_SESSION_TOKEN" ]]
|
||||
type: Opaque
|
||||
type: raw
|
||||
- name: aws
|
||||
properties:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: aws
|
||||
namespace: default
|
||||
spec:
|
||||
credentials:
|
||||
secretRef:
|
||||
key: credentials
|
||||
name: aws-account-creds
|
||||
namespace: vela-system
|
||||
source: Secret
|
||||
provider: aws
|
||||
region: '[[ index .Args "AWS_DEFAULT_REGION" ]]'
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Kubernetes Terraform Controller for AWS
|
||||
addons.oam.dev/name: terraform/provider-aws
|
||||
labels:
|
||||
addons.oam.dev/type: terraform-provider-aws
|
||||
name: terraform-provider-aws
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
@@ -23,7 +23,7 @@ data:
|
||||
chart: terraform-controller
|
||||
repoType: helm
|
||||
url: https://charts.kubevela.net/addons
|
||||
version: 0.1.19
|
||||
version: 0.2.6
|
||||
type: helm
|
||||
- name: alibaba-ack
|
||||
properties:
|
||||
@@ -40,199 +40,9 @@ data:
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
module "kubernetes" {
|
||||
source = "github.com/zzxwill/terraform-alicloud-kubernetes"
|
||||
new_nat_gateway = true
|
||||
vpc_name = var.vpc_name
|
||||
vpc_cidr = var.vpc_cidr
|
||||
vswitch_name_prefix = var.vswitch_name_prefix
|
||||
vswitch_cidrs = var.vswitch_cidrs
|
||||
master_instance_types = var.master_instance_types
|
||||
worker_instance_types = var.worker_instance_types
|
||||
k8s_pod_cidr = var.k8s_pod_cidr
|
||||
k8s_service_cidr = var.k8s_service_cidr
|
||||
k8s_worker_number = var.k8s_worker_number
|
||||
cpu_core_count = var.cpu_core_count
|
||||
memory_size = var.memory_size
|
||||
zone_id = var.zone_id
|
||||
k8s_version = var.k8s_version
|
||||
k8s_name_prefix = var.k8s_name_prefix
|
||||
}
|
||||
######################
|
||||
# Instance types variables
|
||||
######################
|
||||
variable "cpu_core_count" {
|
||||
description = "CPU core count is used to fetch instance types."
|
||||
type = number
|
||||
default = 4
|
||||
}
|
||||
variable "memory_size" {
|
||||
description = "Memory size used to fetch instance types."
|
||||
type = number
|
||||
default = 8
|
||||
}
|
||||
######################
|
||||
# VPC variables
|
||||
######################
|
||||
variable "vpc_name" {
|
||||
description = "The vpc name used to create a new vpc when 'vpc_id' is not specified. Default to variable `example_name`"
|
||||
type = string
|
||||
default = "tf-k8s-vpc"
|
||||
}
|
||||
variable "vpc_cidr" {
|
||||
description = "The cidr block used to launch a new vpc when 'vpc_id' is not specified."
|
||||
type = string
|
||||
default = "10.0.0.0/8"
|
||||
}
|
||||
######################
|
||||
# VSwitch variables
|
||||
######################
|
||||
variable "vswitch_name_prefix" {
|
||||
type = string
|
||||
description = "The vswitch name prefix used to create several new vswitches. Default to variable 'example_name'."
|
||||
default = "tf-k8s-vsw"
|
||||
}
|
||||
variable "number_format" {
|
||||
description = "The number format used to output."
|
||||
type = string
|
||||
default = "%02d"
|
||||
}
|
||||
variable "vswitch_ids" {
|
||||
description = "List of existing vswitch id."
|
||||
type = list
|
||||
default = []
|
||||
}
|
||||
variable "vswitch_cidrs" {
|
||||
description = "List of cidr blocks used to create several new vswitches when 'vswitch_ids' is not specified."
|
||||
type = list
|
||||
default = [
|
||||
"10.1.0.0/16",
|
||||
"10.2.0.0/16",
|
||||
"10.3.0.0/16"]
|
||||
}
|
||||
variable "k8s_name_prefix" {
|
||||
description = "The name prefix used to create several kubernetes clusters. Default to variable `example_name`"
|
||||
type = string
|
||||
default = "poc"
|
||||
}
|
||||
variable "new_nat_gateway" {
|
||||
type = bool
|
||||
description = "Whether to create a new nat gateway. In this template, a new nat gateway will create a nat gateway, eip and server snat entries."
|
||||
default = true
|
||||
}
|
||||
variable "master_instance_types" {
|
||||
description = "The ecs instance types used to launch master nodes."
|
||||
type = list
|
||||
default = [
|
||||
# hongkong
|
||||
"ecs.sn1ne.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6.xlarge",
|
||||
# hongkong
|
||||
"ecs.c4.xlarge",
|
||||
# hongkong
|
||||
"ecs.c5.xlarge",
|
||||
"ecs.n4.xlarge",
|
||||
# "ecs.n1.large",
|
||||
# "ecs.sn1.large",
|
||||
# "ecs.s6-c1m2.xlarge",
|
||||
# "ecs.c6e.xlarge"
|
||||
]
|
||||
}
|
||||
variable "worker_instance_types" {
|
||||
description = "The ecs instance types used to launch worker nodes."
|
||||
type = list
|
||||
default = [
|
||||
# hongkong
|
||||
"ecs.sn1ne.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6.xlarge",
|
||||
# hongkong
|
||||
"ecs.c4.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6e.xlarge",
|
||||
"ecs.n4.xlarge",
|
||||
// "ecs.n1.large",
|
||||
// "ecs.sn1.large",
|
||||
// "ecs.s6-c1m2.xlarge"
|
||||
]
|
||||
}
|
||||
variable "node_cidr_mask" {
|
||||
type = number
|
||||
description = "The node cidr block to specific how many pods can run on single node. Valid values: [24-28]."
|
||||
default = 24
|
||||
}
|
||||
variable "enable_ssh" {
|
||||
description = "Enable login to the node through SSH."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
variable "install_cloud_monitor" {
|
||||
description = "Install cloud monitor agent on ECS."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
variable "cpu_policy" {
|
||||
type = string
|
||||
description = "kubelet cpu policy. Valid values: 'none','static'. Default to 'none'."
|
||||
default = "none"
|
||||
}
|
||||
variable "proxy_mode" {
|
||||
description = "Proxy mode is option of kube-proxy. Valid values: 'ipvs','iptables'. Default to 'iptables'."
|
||||
type = string
|
||||
default = "iptables"
|
||||
}
|
||||
variable "password" {
|
||||
description = "The password of ECS instance."
|
||||
type = string
|
||||
default = "Just4Test"
|
||||
}
|
||||
variable "k8s_worker_number" {
|
||||
description = "The number of worker nodes in kubernetes cluster."
|
||||
type = number
|
||||
default = 2
|
||||
}
|
||||
# k8s_pod_cidr is only for flannel network
|
||||
variable "k8s_pod_cidr" {
|
||||
description = "The kubernetes pod cidr block. It cannot be equals to vpc's or vswitch's and cannot be in them."
|
||||
type = string
|
||||
default = "172.20.0.0/16"
|
||||
}
|
||||
variable "k8s_service_cidr" {
|
||||
description = "The kubernetes service cidr block. It cannot be equals to vpc's or vswitch's or pod's and cannot be in them."
|
||||
type = string
|
||||
default = "192.168.0.0/16"
|
||||
}
|
||||
variable "k8s_version" {
|
||||
description = "The version of the kubernetes version. Valid values: '1.16.6-aliyun.1','1.14.8-aliyun.1'. Default to '1.16.6-aliyun.1'."
|
||||
type = string
|
||||
default = "1.20.4-aliyun.1"
|
||||
}
|
||||
variable "zone_id" {
|
||||
description = "Availability Zone ID"
|
||||
type = string
|
||||
default = "cn-hongkong-b"
|
||||
# "cn-beijing-a"
|
||||
}
|
||||
output "name" {
|
||||
value = module.kubernetes.name
|
||||
}
|
||||
output "kubeconfig" {
|
||||
value = module.kubernetes.kubeconfig
|
||||
}
|
||||
output "cluster_ca_cert" {
|
||||
value = module.kubernetes.cluster_ca_cert
|
||||
}
|
||||
output "client_cert" {
|
||||
value = module.kubernetes.client_cert
|
||||
}
|
||||
output "client_key" {
|
||||
value = module.kubernetes.client_key
|
||||
}
|
||||
output "api_server_internet" {
|
||||
value = module.kubernetes.api_server_internet
|
||||
}
|
||||
configuration: https://github.com/kubevela-contrib/terraform-modules.git
|
||||
path: alibaba/cs/dedicated-kubernetes
|
||||
type: remote
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
@@ -304,7 +114,7 @@ data:
|
||||
terraform:
|
||||
configuration: |
|
||||
module "rds" {
|
||||
source = "terraform-alicloud-modules/rds/alicloud"
|
||||
source = "github.com/kubevela-contrib/terraform-alicloud-rds"
|
||||
engine = "MySQL"
|
||||
engine_version = "8.0"
|
||||
instance_type = "rds.mysql.c1.large"
|
||||
@@ -312,6 +122,8 @@ data:
|
||||
instance_name = var.instance_name
|
||||
account_name = var.account_name
|
||||
password = var.password
|
||||
allocate_public_connection = var.allocate_public_connection
|
||||
security_ips = ["0.0.0.0/0",]
|
||||
}
|
||||
|
||||
output "DB_NAME" {
|
||||
@@ -329,6 +141,9 @@ data:
|
||||
output "DB_PASSWORD" {
|
||||
value = var.password
|
||||
}
|
||||
output "DB_PUBLIC_HOST" {
|
||||
value = module.rds.db_public_connection_string
|
||||
}
|
||||
|
||||
variable "instance_name" {
|
||||
description = "RDS instance name"
|
||||
@@ -347,6 +162,52 @@ data:
|
||||
type = string
|
||||
default = "Xyfff83jfewGGfaked"
|
||||
}
|
||||
|
||||
variable "allocate_public_connection" {
|
||||
description = "Whether to allocate public connection for a RDS instance."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: aws-s3
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for AWS S3
|
||||
labels:
|
||||
type: terraform
|
||||
name: aws-s3
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
resource "aws_s3_bucket" "bucket-acl" {
|
||||
bucket = var.bucket
|
||||
acl = var.acl
|
||||
}
|
||||
|
||||
output "BUCKET_NAME" {
|
||||
value = aws_s3_bucket.bucket-acl.bucket_domain_name
|
||||
}
|
||||
|
||||
variable "bucket" {
|
||||
description = "S3 bucket name"
|
||||
default = "vela-website"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "acl" {
|
||||
description = "S3 bucket ACL"
|
||||
default = "private"
|
||||
type = string
|
||||
}
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
|
||||
@@ -16,7 +16,13 @@ spec:
|
||||
)
|
||||
|
||||
apply: op.#Apply & {
|
||||
value: parameter
|
||||
value: parameter.value
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the value of the object
|
||||
value: {...}
|
||||
// +usage=Specify the cluster of the object
|
||||
cluster: *"" | string
|
||||
}
|
||||
parameter: {}
|
||||
|
||||
|
||||
113
charts/vela-core/templates/defwithtemplate/nocalhost.yaml
Normal file
113
charts/vela-core/templates/defwithtemplate/nocalhost.yaml
Normal file
@@ -0,0 +1,113 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/nocalhost.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: nocalhost develop configuration.
|
||||
name: nocalhost
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- '*'
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
patch: metadata: annotations: {
|
||||
"dev.nocalhost/application-name": context.appName
|
||||
"dev.nocalhost/application-namespace": context.namespace
|
||||
"dev.nocalhost": json.Marshal({
|
||||
containers: [
|
||||
{
|
||||
name: context.name
|
||||
dev: {
|
||||
if parameter.gitUrl != _|_ {
|
||||
gitUrl: parameter.gitUrl
|
||||
}
|
||||
image: parameter.image
|
||||
shell: parameter.shell
|
||||
workDir: parameter.workDir
|
||||
if parameter.storageClass != _|_ {
|
||||
storageClass: parameter.storageClass
|
||||
}
|
||||
resources: {
|
||||
limits: parameter.resources.limits
|
||||
requests: parameter.resources.requests
|
||||
}
|
||||
if parameter.persistentVolumeDirs != _|_ {
|
||||
persistentVolumeDirs: [
|
||||
for v in parameter.persistentVolumeDirs {
|
||||
path: v.path
|
||||
capacity: v.capacity
|
||||
},
|
||||
]
|
||||
}
|
||||
if parameter.command != _|_ {
|
||||
command: parameter.command
|
||||
}
|
||||
if parameter.debug != _|_ {
|
||||
debug: parameter.debug
|
||||
}
|
||||
hotReload: parameter.hotReload
|
||||
if parameter.sync != _|_ {
|
||||
sync: parameter.sync
|
||||
}
|
||||
if parameter.env != _|_ {
|
||||
env: [
|
||||
for v in parameter.env {
|
||||
name: v.name
|
||||
value: v.value
|
||||
},
|
||||
]
|
||||
}
|
||||
if parameter.portForward != _|_ {
|
||||
portForward: parameter.portForward
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
parameter: {
|
||||
gitUrl?: string
|
||||
image: string
|
||||
shell: *"bash" | string
|
||||
workDir: *"/home/nocalhost-dev" | string
|
||||
storageClass?: string
|
||||
command?: {
|
||||
run?: [...string]
|
||||
debug?: [...string]
|
||||
}
|
||||
debug?: remoteDebugPort?: int
|
||||
hotReload: *true | bool
|
||||
sync: {
|
||||
type: *"send" | string
|
||||
filePattern?: [...string]
|
||||
ignoreFilePattern?: [...string]
|
||||
}
|
||||
env?: [...{
|
||||
name: string
|
||||
value: string
|
||||
}]
|
||||
portForward?: [...string]
|
||||
persistentVolumeDirs?: [...{
|
||||
path: string
|
||||
capacity: string
|
||||
}]
|
||||
resources: {
|
||||
limits: {
|
||||
memory: *"2Gi" | string
|
||||
cpu: *"2" | string
|
||||
}
|
||||
requests: {
|
||||
memory: *"512Mi" | string
|
||||
cpu: *"0.5" | string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ spec:
|
||||
}
|
||||
}
|
||||
}
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
}
|
||||
if parameter.apiVersion != _|_ || parameter.kind != _|_ {
|
||||
@@ -42,6 +43,7 @@ spec:
|
||||
}
|
||||
}
|
||||
}
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,5 +56,7 @@ spec:
|
||||
name: string
|
||||
// +usage=Specify the namespace of the object
|
||||
namespace?: string
|
||||
// +usage=Specify the cluster of the object
|
||||
cluster: *"" | string
|
||||
}
|
||||
|
||||
|
||||
@@ -1232,6 +1232,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1635,6 +1639,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1936,6 +1944,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3360,6 +3372,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3656,6 +3672,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4041,6 +4061,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4305,6 +4329,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4585,6 +4613,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
|
||||
@@ -222,6 +222,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -506,6 +510,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -783,6 +791,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1041,6 +1053,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
|
||||
@@ -151,6 +151,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -188,6 +188,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -468,6 +472,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -148,6 +148,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -193,6 +193,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -454,6 +458,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -16,7 +16,13 @@ spec:
|
||||
)
|
||||
|
||||
apply: op.#Apply & {
|
||||
value: parameter
|
||||
value: parameter.value
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the value of the object
|
||||
value: {...}
|
||||
// +usage=Specify the cluster of the object
|
||||
cluster: *"" | string
|
||||
}
|
||||
parameter: {}
|
||||
|
||||
|
||||
113
charts/vela-minimal/templates/defwithtemplate/nocalhost.yaml
Normal file
113
charts/vela-minimal/templates/defwithtemplate/nocalhost.yaml
Normal file
@@ -0,0 +1,113 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/nocalhost.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: nocalhost develop configuration.
|
||||
name: nocalhost
|
||||
namespace: {{.Values.systemDefinitionNamespace}}
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- '*'
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
patch: metadata: annotations: {
|
||||
"dev.nocalhost/application-name": context.appName
|
||||
"dev.nocalhost/application-namespace": context.namespace
|
||||
"dev.nocalhost": json.Marshal({
|
||||
containers: [
|
||||
{
|
||||
name: context.name
|
||||
dev: {
|
||||
if parameter.gitUrl != _|_ {
|
||||
gitUrl: parameter.gitUrl
|
||||
}
|
||||
image: parameter.image
|
||||
shell: parameter.shell
|
||||
workDir: parameter.workDir
|
||||
if parameter.storageClass != _|_ {
|
||||
storageClass: parameter.storageClass
|
||||
}
|
||||
resources: {
|
||||
limits: parameter.resources.limits
|
||||
requests: parameter.resources.requests
|
||||
}
|
||||
if parameter.persistentVolumeDirs != _|_ {
|
||||
persistentVolumeDirs: [
|
||||
for v in parameter.persistentVolumeDirs {
|
||||
path: v.path
|
||||
capacity: v.capacity
|
||||
},
|
||||
]
|
||||
}
|
||||
if parameter.command != _|_ {
|
||||
command: parameter.command
|
||||
}
|
||||
if parameter.debug != _|_ {
|
||||
debug: parameter.debug
|
||||
}
|
||||
hotReload: parameter.hotReload
|
||||
if parameter.sync != _|_ {
|
||||
sync: parameter.sync
|
||||
}
|
||||
if parameter.env != _|_ {
|
||||
env: [
|
||||
for v in parameter.env {
|
||||
name: v.name
|
||||
value: v.value
|
||||
},
|
||||
]
|
||||
}
|
||||
if parameter.portForward != _|_ {
|
||||
portForward: parameter.portForward
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
parameter: {
|
||||
gitUrl?: string
|
||||
image: string
|
||||
shell: *"bash" | string
|
||||
workDir: *"/home/nocalhost-dev" | string
|
||||
storageClass?: string
|
||||
command?: {
|
||||
run?: [...string]
|
||||
debug?: [...string]
|
||||
}
|
||||
debug?: remoteDebugPort?: int
|
||||
hotReload: *true | bool
|
||||
sync: {
|
||||
type: *"send" | string
|
||||
filePattern?: [...string]
|
||||
ignoreFilePattern?: [...string]
|
||||
}
|
||||
env?: [...{
|
||||
name: string
|
||||
value: string
|
||||
}]
|
||||
portForward?: [...string]
|
||||
persistentVolumeDirs?: [...{
|
||||
path: string
|
||||
capacity: string
|
||||
}]
|
||||
resources: {
|
||||
limits: {
|
||||
memory: *"2Gi" | string
|
||||
cpu: *"2" | string
|
||||
}
|
||||
requests: {
|
||||
memory: *"512Mi" | string
|
||||
cpu: *"0.5" | string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ spec:
|
||||
}
|
||||
}
|
||||
}
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
}
|
||||
if parameter.apiVersion != _|_ || parameter.kind != _|_ {
|
||||
@@ -42,6 +43,7 @@ spec:
|
||||
}
|
||||
}
|
||||
}
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,5 +56,7 @@ spec:
|
||||
name: string
|
||||
// +usage=Specify the namespace of the object
|
||||
namespace?: string
|
||||
// +usage=Specify the cluster of the object
|
||||
cluster: *"" | string
|
||||
}
|
||||
|
||||
|
||||
157
docs/examples/nocalhost/nocalhost.yaml
Normal file
157
docs/examples/nocalhost/nocalhost.yaml
Normal file
@@ -0,0 +1,157 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: bookinfo
|
||||
spec:
|
||||
components:
|
||||
- name: productpage
|
||||
type: webservice
|
||||
properties:
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/bookinfo/productpage:latest
|
||||
port: 9080
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
port:
|
||||
- 9080
|
||||
- type: nocalhost
|
||||
properties:
|
||||
gitUrl: https://github.com/nocalhost/bookinfo-productpage.git
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/dev-images/python:3.7.7-slim-productpage-with-pydevd
|
||||
shell: "bash"
|
||||
workDir: "/opt/work"
|
||||
resources:
|
||||
limits:
|
||||
memory: 1Gi
|
||||
cpu: "1"
|
||||
requests:
|
||||
memory: 512Mi
|
||||
cpu: "0.5"
|
||||
debug:
|
||||
remoteDebugPort: 9009
|
||||
hotReload: true
|
||||
sync:
|
||||
type: send
|
||||
filePattern:
|
||||
- ./
|
||||
ignoreFilePattern:
|
||||
- .git
|
||||
- .idea
|
||||
command:
|
||||
run:
|
||||
- sh
|
||||
- run.sh
|
||||
debug:
|
||||
- sh
|
||||
- debug.sh
|
||||
env:
|
||||
- name: "foo"
|
||||
value: "bar"
|
||||
portForward:
|
||||
- 39080:9080
|
||||
|
||||
- name: authors
|
||||
type: webservice
|
||||
properties:
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/bookinfo/authors:latest
|
||||
port: 9080
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
port:
|
||||
- 9080
|
||||
- type: nocalhost
|
||||
properties:
|
||||
gitUrl: https://github.com/nocalhost/bookinfo-authors.git
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/dev-images/golang:latest
|
||||
command:
|
||||
run:
|
||||
- sh
|
||||
- run.sh
|
||||
debug:
|
||||
- sh
|
||||
- debug.sh
|
||||
debug:
|
||||
remoteDebugPort: 9009
|
||||
|
||||
- name: details
|
||||
type: webservice
|
||||
properties:
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/bookinfo/details:latest
|
||||
port: 9080
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
port:
|
||||
- 9080
|
||||
- type: nocalhost
|
||||
properties:
|
||||
gitUrl: https://github.com/nocalhost/bookinfo-details.git
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/dev-images/ruby:2.7.1-slim
|
||||
command:
|
||||
run:
|
||||
- sh
|
||||
- run.sh
|
||||
debug:
|
||||
- sh
|
||||
- debug.sh
|
||||
sync:
|
||||
filePattern:
|
||||
- ./
|
||||
ignoreFilePattern:
|
||||
- .git
|
||||
- .idea
|
||||
|
||||
- name: ratings
|
||||
type: webservice
|
||||
properties:
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/bookinfo/ratings:latest
|
||||
port: 9080
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
port:
|
||||
- 9080
|
||||
- type: nocalhost
|
||||
properties:
|
||||
gitUrl: https://github.com/nocalhost/bookinfo-ratings.git
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/dev-images/node:12.18.1-slim
|
||||
command:
|
||||
run:
|
||||
- sh
|
||||
- run.sh
|
||||
debug:
|
||||
- sh
|
||||
- debug.sh
|
||||
|
||||
- name: reviews
|
||||
type: webservice
|
||||
properties:
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/bookinfo/reviews:latest
|
||||
port: 9080
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
port:
|
||||
- 9080
|
||||
- type: nocalhost
|
||||
properties:
|
||||
gitUrl: https://github.com/nocalhost/bookinfo-reviews.git
|
||||
image: nocalhost-docker.pkg.coding.net/nocalhost/dev-images/java:latest
|
||||
command:
|
||||
run:
|
||||
- sh
|
||||
- run.sh
|
||||
debug:
|
||||
- sh
|
||||
- debug.sh
|
||||
debug:
|
||||
remoteDebugPort: 5005
|
||||
sync:
|
||||
filePattern:
|
||||
- ./
|
||||
ignoreFilePattern:
|
||||
- .git
|
||||
- .idea
|
||||
- .gradle
|
||||
- build
|
||||
@@ -21,18 +21,21 @@ spec:
|
||||
- name: apply-pvc
|
||||
type: apply-object
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: myclaim
|
||||
namespace: default
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 8Gi
|
||||
storageClassName: standard
|
||||
value:
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: myclaim
|
||||
namespace: default
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 8Gi
|
||||
storageClassName: standard
|
||||
# for multi-cluster
|
||||
# cluster: my-cluster
|
||||
- name: apply-server
|
||||
type: apply-component
|
||||
properties:
|
||||
|
||||
@@ -23,6 +23,8 @@ spec:
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
name: my-cm-name
|
||||
# for multi cluster
|
||||
# cluster: my-cluster
|
||||
- name: apply
|
||||
type: apply-component
|
||||
inputs:
|
||||
|
||||
4
go.mod
4
go.mod
@@ -34,7 +34,7 @@ require (
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.1
|
||||
github.com/oam-dev/cluster-gateway v1.1.2
|
||||
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28
|
||||
github.com/oam-dev/terraform-controller v0.2.4
|
||||
github.com/oam-dev/terraform-controller v0.2.6
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/onsi/ginkgo v1.16.4
|
||||
github.com/onsi/gomega v1.16.0
|
||||
@@ -45,7 +45,7 @@ require (
|
||||
github.com/spf13/cobra v1.2.1
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/tidwall/gjson v1.6.8
|
||||
github.com/tidwall/gjson v1.9.3
|
||||
github.com/wercker/stern v0.0.0-20190705090245-4fa46dd6987f
|
||||
github.com/wonderflow/cert-manager-api v1.0.3
|
||||
go.mongodb.org/mongo-driver v1.5.1
|
||||
|
||||
16
go.sum
16
go.sum
@@ -1206,8 +1206,8 @@ github.com/oam-dev/stern v1.13.0-alpha h1:EVjM8Qvh6LssB6t4RZrjf9DtCq1cz+/cy6OF7f
|
||||
github.com/oam-dev/stern v1.13.0-alpha/go.mod h1:AOkvfFUv0Arz7GBi0jz7S0Jsu4K/kdvSjNsnRt1+BIg=
|
||||
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28 h1:tD8HiFKnt0jnwdTWjeqUnfnUYLD/+Nsmj8ZGIxqDWiU=
|
||||
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28/go.mod h1:Mu8i0/DdplvnjwRbAYPsc8+LRR27n/mp8VWdkN10GzE=
|
||||
github.com/oam-dev/terraform-controller v0.2.4 h1:yGgIzm2EWNghuRutnChrRfhMjdlU/jE/cLfBizCgE24=
|
||||
github.com/oam-dev/terraform-controller v0.2.4/go.mod h1:wd4rnqnJzz274Sg1/qoeIhBx1rvTZ/ECzXoMff0ucR0=
|
||||
github.com/oam-dev/terraform-controller v0.2.6 h1:aoEj4sfxDMBdTkM5uKYmjVFOgjhYeYBm0xzdRb4+Xu0=
|
||||
github.com/oam-dev/terraform-controller v0.2.6/go.mod h1:xFSCd3Nwuh6P1HEpx5jDnLzN35T9hoH53zdojDYE6LI=
|
||||
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
|
||||
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
|
||||
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
|
||||
@@ -1511,13 +1511,13 @@ github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG
|
||||
github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM=
|
||||
github.com/tetafro/godot v1.4.7/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8=
|
||||
github.com/thanos-io/thanos v0.11.0/go.mod h1:N/Yes7J68KqvmY+xM6J5CJqEvWIvKSR5sqGtmuD6wDc=
|
||||
github.com/tidwall/gjson v1.6.8 h1:CTmXMClGYPAmln7652e69B7OLXfTi5ABcPPwjIWUv7w=
|
||||
github.com/tidwall/gjson v1.6.8/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
|
||||
github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
|
||||
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/gjson v1.9.3 h1:hqzS9wAHMO+KVBBkLxYdkEeeFHuqr95GfClRLKlgK0E=
|
||||
github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
||||
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk=
|
||||
github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
|
||||
github.com/tklauser/go-sysconf v0.3.4/go.mod h1:Cl2c8ZRWfHD5IrfHo9VN+FX9kCFjIOyVklgXycLB6ek=
|
||||
|
||||
@@ -1232,6 +1232,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1635,6 +1639,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1936,6 +1944,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3360,6 +3372,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -3656,6 +3672,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4041,6 +4061,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4305,6 +4329,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -4585,6 +4613,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote
|
||||
git repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
|
||||
@@ -179,6 +179,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -463,6 +467,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -222,6 +222,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -506,6 +510,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -783,6 +791,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
@@ -1041,6 +1053,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git
|
||||
repository. It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference
|
||||
to Provider
|
||||
|
||||
@@ -151,6 +151,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -188,6 +188,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -468,6 +472,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -148,6 +148,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -193,6 +193,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
@@ -454,6 +458,10 @@ spec:
|
||||
configuration:
|
||||
description: Configuration is Terraform Configuration
|
||||
type: string
|
||||
path:
|
||||
description: Path is the sub-directory of remote git repository.
|
||||
It's valid when remote is set
|
||||
type: string
|
||||
providerRef:
|
||||
description: ProviderReference specifies the reference to
|
||||
Provider
|
||||
|
||||
@@ -669,6 +669,7 @@ func generateTerraformConfigurationWorkload(wl *Workload, ns string) (*unstructu
|
||||
configuration.Spec.JSON = wl.FullTemplate.Terraform.Configuration
|
||||
case "remote":
|
||||
configuration.Spec.Remote = wl.FullTemplate.Terraform.Configuration
|
||||
configuration.Spec.Path = wl.FullTemplate.Terraform.Path
|
||||
}
|
||||
|
||||
if wl.FullTemplate.Terraform.ProviderReference != nil {
|
||||
|
||||
@@ -26,8 +26,6 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam/testutil"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
@@ -40,6 +38,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/utils/pointer"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
"sigs.k8s.io/yaml"
|
||||
@@ -52,6 +51,7 @@ import (
|
||||
velatypes "github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/controller/utils"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/testutil"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
common2 "github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
)
|
||||
@@ -2069,6 +2069,51 @@ var _ = Describe("Test Application Controller", func() {
|
||||
}))
|
||||
})
|
||||
|
||||
It("app record execution state with controllerRevision", func() {
|
||||
ns := &corev1.Namespace{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "vela-test-app-trace",
|
||||
},
|
||||
}
|
||||
|
||||
app := appwithNoTrait.DeepCopy()
|
||||
app.Name = "vela-test-app-trace"
|
||||
app.SetNamespace(ns.Name)
|
||||
Expect(k8sClient.Create(ctx, ns)).Should(BeNil())
|
||||
Expect(k8sClient.Create(ctx, app)).Should(BeNil())
|
||||
|
||||
appKey := client.ObjectKey{
|
||||
Name: app.Name,
|
||||
Namespace: app.Namespace,
|
||||
}
|
||||
|
||||
testutil.ReconcileOnceAfterFinalizer(reconciler, reconcile.Request{NamespacedName: appKey})
|
||||
checkApp := &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
Expect(checkApp.Status.Phase).Should(BeEquivalentTo(common.ApplicationRunning))
|
||||
web := &v1.Deployment{}
|
||||
Expect(k8sClient.Get(ctx, client.ObjectKey{
|
||||
Name: "myweb2",
|
||||
Namespace: app.Namespace,
|
||||
}, web)).Should(BeNil())
|
||||
web.Spec.Replicas = pointer.Int32(0)
|
||||
Expect(k8sClient.Update(ctx, web)).Should(BeNil())
|
||||
|
||||
checkApp.Status.Workflow = nil
|
||||
Expect(k8sClient.Update(ctx, checkApp)).Should(BeNil())
|
||||
testutil.ReconcileOnceAfterFinalizer(reconciler, reconcile.Request{NamespacedName: appKey})
|
||||
checkApp = &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(ctx, appKey, checkApp)).Should(BeNil())
|
||||
Expect(checkApp.Status.Phase).Should(BeEquivalentTo(common.ApplicationRunning))
|
||||
|
||||
checkWeb := &v1.Deployment{}
|
||||
Expect(k8sClient.Get(ctx, client.ObjectKey{
|
||||
Name: "myweb2",
|
||||
Namespace: app.Namespace,
|
||||
}, checkWeb)).Should(BeNil())
|
||||
Expect(*(checkWeb.Spec.Replicas)).Should(BeEquivalentTo(int32(0)))
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
const (
|
||||
|
||||
@@ -241,7 +241,7 @@ func (a *AppManifestsDispatcher) applyAndRecordManifests(ctx context.Context, ma
|
||||
ctrlUIDs = append(ctrlUIDs, rt.UID)
|
||||
}
|
||||
|
||||
applyOpts := []apply.ApplyOption{apply.MustBeControllableByAny(ctrlUIDs)}
|
||||
applyOpts := []apply.ApplyOption{apply.MustBeControllableByAny(ctrlUIDs), apply.NotUpdateRenderHashEqual()}
|
||||
ownerRef := metav1.OwnerReference{
|
||||
APIVersion: v1beta1.SchemeGroupVersion.String(),
|
||||
Kind: reflect.TypeOf(v1beta1.ResourceTracker{}).Name(),
|
||||
|
||||
@@ -693,7 +693,7 @@ func (e *GenerationUnchanged) Error() string {
|
||||
// applyOnceOnly is an ApplyOption that controls the applying mechanism for workload and trait.
|
||||
// More detail refers to the ApplyOnceOnlyMode type annotation
|
||||
func applyOnceOnly(ac *v1alpha2.ApplicationConfiguration, mode core.ApplyOnceOnlyMode) apply.ApplyOption {
|
||||
return func(_ context.Context, existing, desired runtime.Object) error {
|
||||
return apply.MakeCustomApplyOption(func(existing, desired client.Object) error {
|
||||
if mode == core.ApplyOnceOnlyOff {
|
||||
return nil
|
||||
}
|
||||
@@ -791,5 +791,5 @@ func applyOnceOnly(ac *v1alpha2.ApplicationConfiguration, mode core.ApplyOnceOnl
|
||||
}
|
||||
// its spec is not changed, return an error to abort applying it
|
||||
return &GenerationUnchanged{}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -311,8 +311,11 @@ func openBaiscLit(root ast.Node) {
|
||||
field, ok := node.(*ast.Field)
|
||||
if ok {
|
||||
v := field.Value
|
||||
if lit, ok := v.(*ast.BasicLit); ok {
|
||||
switch lit := v.(type) {
|
||||
case *ast.BasicLit:
|
||||
field.Value = ast.NewBinExpr(token.OR, &ast.UnaryExpr{X: lit, Op: token.MUL}, ast.NewIdent("_"))
|
||||
case *ast.ListLit:
|
||||
field.Value = ast.NewBinExpr(token.OR, &ast.UnaryExpr{X: lit, Op: token.MUL}, ast.NewList(&ast.Ellipsis{}))
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -248,6 +248,7 @@ b: "foo"
|
||||
b1: string
|
||||
c: true
|
||||
c1: bool
|
||||
arr: [1,2]
|
||||
top: _
|
||||
bottom: _|_
|
||||
`)
|
||||
@@ -258,6 +259,7 @@ b: *"foo" | _
|
||||
b1: string
|
||||
c: *true | _
|
||||
c1: bool
|
||||
arr: *[1, 2] | [...]
|
||||
top: _
|
||||
bottom: _|_
|
||||
`)
|
||||
|
||||
@@ -19,18 +19,25 @@ package apply
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/controller/utils"
|
||||
"github.com/oam-dev/kubevela/pkg/oam/util"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
const (
|
||||
// LabelRenderHash is the label that record the hash value of the rendering resource.
|
||||
LabelRenderHash = "oam.dev/render-hash"
|
||||
)
|
||||
|
||||
// Applicator applies new state to an object or create it if not exist.
|
||||
// It uses the same mechanism as `kubectl apply`, that is, for each resource being applied,
|
||||
// computing a three-way diff merge in client side based on its current state, modified stated,
|
||||
@@ -40,11 +47,15 @@ type Applicator interface {
|
||||
Apply(context.Context, client.Object, ...ApplyOption) error
|
||||
}
|
||||
|
||||
type applyAction struct {
|
||||
skipUpdate bool
|
||||
}
|
||||
|
||||
// ApplyOption is called before applying state to the object.
|
||||
// ApplyOption is still called even if the object does NOT exist.
|
||||
// If the object does not exist, `existing` will be assigned as `nil`.
|
||||
// nolint: golint
|
||||
type ApplyOption func(ctx context.Context, existing, desired runtime.Object) error
|
||||
type ApplyOption func(act *applyAction, existing, desired client.Object) error
|
||||
|
||||
// NewAPIApplicator creates an Applicator that applies state to an
|
||||
// object or creates the object if not exist.
|
||||
@@ -57,13 +68,13 @@ func NewAPIApplicator(c client.Client) *APIApplicator {
|
||||
}
|
||||
|
||||
type creator interface {
|
||||
createOrGetExisting(context.Context, client.Client, client.Object, ...ApplyOption) (client.Object, error)
|
||||
createOrGetExisting(context.Context, *applyAction, client.Client, client.Object, ...ApplyOption) (client.Object, error)
|
||||
}
|
||||
|
||||
type creatorFn func(context.Context, client.Client, client.Object, ...ApplyOption) (client.Object, error)
|
||||
type creatorFn func(context.Context, *applyAction, client.Client, client.Object, ...ApplyOption) (client.Object, error)
|
||||
|
||||
func (fn creatorFn) createOrGetExisting(ctx context.Context, c client.Client, o client.Object, ao ...ApplyOption) (client.Object, error) {
|
||||
return fn(ctx, c, o, ao...)
|
||||
func (fn creatorFn) createOrGetExisting(ctx context.Context, act *applyAction, c client.Client, o client.Object, ao ...ApplyOption) (client.Object, error) {
|
||||
return fn(ctx, act, c, o, ao...)
|
||||
}
|
||||
|
||||
type patcher interface {
|
||||
@@ -95,7 +106,12 @@ func loggingApply(msg string, desired client.Object) {
|
||||
|
||||
// Apply applies new state to an object or create it if not exist
|
||||
func (a *APIApplicator) Apply(ctx context.Context, desired client.Object, ao ...ApplyOption) error {
|
||||
existing, err := a.createOrGetExisting(ctx, a.c, desired, ao...)
|
||||
_, err := generateRenderHash(desired)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
applyAct := new(applyAction)
|
||||
existing, err := a.createOrGetExisting(ctx, applyAct, a.c, desired, ao...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -104,9 +120,15 @@ func (a *APIApplicator) Apply(ctx context.Context, desired client.Object, ao ...
|
||||
}
|
||||
|
||||
// the object already exists, apply new state
|
||||
if err := executeApplyOptions(ctx, existing, desired, ao); err != nil {
|
||||
if err := executeApplyOptions(applyAct, existing, desired, ao); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if applyAct.skipUpdate {
|
||||
loggingApply("skip update", desired)
|
||||
return nil
|
||||
}
|
||||
|
||||
loggingApply("patching object", desired)
|
||||
patch, err := a.patcher.patch(existing, desired)
|
||||
if err != nil {
|
||||
@@ -115,12 +137,34 @@ func (a *APIApplicator) Apply(ctx context.Context, desired client.Object, ao ...
|
||||
return errors.Wrapf(a.c.Patch(ctx, desired, patch), "cannot patch object")
|
||||
}
|
||||
|
||||
func generateRenderHash(desired client.Object) (string, error) {
|
||||
if desired == nil {
|
||||
return "", nil
|
||||
}
|
||||
desiredHash, err := utils.ComputeSpecHash(desired)
|
||||
if err != nil {
|
||||
return "", errors.Wrap(err, "compute desired hash")
|
||||
}
|
||||
util.AddLabels(desired, map[string]string{
|
||||
LabelRenderHash: desiredHash,
|
||||
})
|
||||
return desiredHash, nil
|
||||
}
|
||||
|
||||
func getRenderHash(existing client.Object) string {
|
||||
labels := existing.GetLabels()
|
||||
if labels == nil {
|
||||
return ""
|
||||
}
|
||||
return labels[LabelRenderHash]
|
||||
}
|
||||
|
||||
// createOrGetExisting will create the object if it does not exist
|
||||
// or get and return the existing object
|
||||
func createOrGetExisting(ctx context.Context, c client.Client, desired client.Object, ao ...ApplyOption) (client.Object, error) {
|
||||
func createOrGetExisting(ctx context.Context, act *applyAction, c client.Client, desired client.Object, ao ...ApplyOption) (client.Object, error) {
|
||||
var create = func() (client.Object, error) {
|
||||
// execute ApplyOptions even the object doesn't exist
|
||||
if err := executeApplyOptions(ctx, nil, desired, ao); err != nil {
|
||||
if err := executeApplyOptions(act, nil, desired, ao); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := addLastAppliedConfigAnnotation(desired); err != nil {
|
||||
@@ -147,22 +191,44 @@ func createOrGetExisting(ctx context.Context, c client.Client, desired client.Ob
|
||||
return existing, nil
|
||||
}
|
||||
|
||||
func executeApplyOptions(ctx context.Context, existing, desired runtime.Object, aos []ApplyOption) error {
|
||||
func executeApplyOptions(act *applyAction, existing, desired client.Object, aos []ApplyOption) error {
|
||||
// if existing is nil, it means the object is going to be created.
|
||||
// ApplyOption function should handle this situation carefully by itself.
|
||||
for _, fn := range aos {
|
||||
if err := fn(ctx, existing, desired); err != nil {
|
||||
if err := fn(act, existing, desired); err != nil {
|
||||
return errors.Wrap(err, "cannot apply ApplyOption")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NotUpdateRenderHashEqual if the render hash of new object equal to the old hash, should not apply.
|
||||
func NotUpdateRenderHashEqual() ApplyOption {
|
||||
return func(act *applyAction, existing, desired client.Object) error {
|
||||
if existing == nil || desired == nil {
|
||||
return nil
|
||||
}
|
||||
newSt, ok := desired.(*unstructured.Unstructured)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
oldSt := existing.(*unstructured.Unstructured)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
if getRenderHash(existing) == getRenderHash(desired) {
|
||||
*newSt = *oldSt
|
||||
act.skipUpdate = true
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// MustBeControllableBy requires that the new object is controllable by an
|
||||
// object with the supplied UID. An object is controllable if its controller
|
||||
// reference includes the supplied UID.
|
||||
func MustBeControllableBy(u types.UID) ApplyOption {
|
||||
return func(_ context.Context, existing, _ runtime.Object) error {
|
||||
return func(_ *applyAction, existing, _ client.Object) error {
|
||||
if existing == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -180,7 +246,7 @@ func MustBeControllableBy(u types.UID) ApplyOption {
|
||||
// MustBeControllableByAny requires that the new object is controllable by any of the object with
|
||||
// the supplied UID.
|
||||
func MustBeControllableByAny(ctrlUIDs []types.UID) ApplyOption {
|
||||
return func(_ context.Context, existing, _ runtime.Object) error {
|
||||
return func(_ *applyAction, existing, _ client.Object) error {
|
||||
if existing == nil || len(ctrlUIDs) == 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -206,3 +272,10 @@ func MustBeControllableByAny(ctrlUIDs []types.UID) ApplyOption {
|
||||
return errors.Errorf("existing object is not controlled by any of UID %q", ctrlUIDs)
|
||||
}
|
||||
}
|
||||
|
||||
// MakeCustomApplyOption let user can generate applyOption that restrict change apply action.
|
||||
func MakeCustomApplyOption(f func(existing, desired client.Object) error) ApplyOption {
|
||||
return func(act *applyAction, existing, desired client.Object) error {
|
||||
return f(existing, desired)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func TestAPIApplicator(t *testing.T) {
|
||||
args: args{
|
||||
existing: existing,
|
||||
ao: []ApplyOption{
|
||||
func(ctx context.Context, existing, desired runtime.Object) error {
|
||||
func(_ *applyAction, existing, desired client.Object) error {
|
||||
return errFake
|
||||
},
|
||||
},
|
||||
@@ -137,7 +137,7 @@ func TestAPIApplicator(t *testing.T) {
|
||||
for caseName, tc := range cases {
|
||||
t.Run(caseName, func(t *testing.T) {
|
||||
a := &APIApplicator{
|
||||
creator: creatorFn(func(_ context.Context, _ client.Client, _ client.Object, _ ...ApplyOption) (client.Object, error) {
|
||||
creator: creatorFn(func(_ context.Context, _ *applyAction, _ client.Client, _ client.Object, _ ...ApplyOption) (client.Object, error) {
|
||||
return tc.args.existing, tc.args.creatorErr
|
||||
}),
|
||||
patcher: patcherFn(func(c, m client.Object) (client.Patch, error) {
|
||||
@@ -220,7 +220,7 @@ func TestCreator(t *testing.T) {
|
||||
},
|
||||
},
|
||||
ao: []ApplyOption{
|
||||
func(ctx context.Context, existing, desired runtime.Object) error {
|
||||
func(_ *applyAction, existing, desired client.Object) error {
|
||||
return errFake
|
||||
},
|
||||
},
|
||||
@@ -236,7 +236,7 @@ func TestCreator(t *testing.T) {
|
||||
args: args{
|
||||
desired: desired,
|
||||
ao: []ApplyOption{
|
||||
func(ctx context.Context, existing, desired runtime.Object) error {
|
||||
func(_ *applyAction, existing, desired client.Object) error {
|
||||
return errFake
|
||||
},
|
||||
},
|
||||
@@ -294,7 +294,8 @@ func TestCreator(t *testing.T) {
|
||||
|
||||
for caseName, tc := range cases {
|
||||
t.Run(caseName, func(t *testing.T) {
|
||||
result, err := createOrGetExisting(ctx, tc.c, tc.args.desired, tc.args.ao...)
|
||||
act := new(applyAction)
|
||||
result, err := createOrGetExisting(ctx, act, tc.c, tc.args.desired, tc.args.ao...)
|
||||
if diff := cmp.Diff(tc.want.existing, result); diff != "" {
|
||||
t.Errorf("\n%s\ncreateOrGetExisting(...): -want , +got \n%s\n", tc.reason, diff)
|
||||
}
|
||||
@@ -309,11 +310,10 @@ func TestCreator(t *testing.T) {
|
||||
func TestMustBeControllableBy(t *testing.T) {
|
||||
uid := types.UID("very-unique-string")
|
||||
controller := true
|
||||
ctx := context.TODO()
|
||||
|
||||
cases := map[string]struct {
|
||||
reason string
|
||||
current runtime.Object
|
||||
current client.Object
|
||||
u types.UID
|
||||
want error
|
||||
}{
|
||||
@@ -356,7 +356,8 @@ func TestMustBeControllableBy(t *testing.T) {
|
||||
for name, tc := range cases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
ao := MustBeControllableBy(tc.u)
|
||||
err := ao(ctx, tc.current, nil)
|
||||
act := new(applyAction)
|
||||
err := ao(act, tc.current, nil)
|
||||
if diff := cmp.Diff(tc.want, err, test.EquateErrors()); diff != "" {
|
||||
t.Errorf("\n%s\nMustBeControllableBy(...)(...): -want error, +got error\n%s\n", tc.reason, diff)
|
||||
}
|
||||
@@ -368,7 +369,7 @@ func TestMustBeControllableByAny(t *testing.T) {
|
||||
ctrlByAny := []types.UID{"owner1", "owner2"}
|
||||
cases := map[string]struct {
|
||||
reason string
|
||||
current runtime.Object
|
||||
current client.Object
|
||||
want error
|
||||
}{
|
||||
"NoExistingObject": {
|
||||
@@ -418,7 +419,8 @@ func TestMustBeControllableByAny(t *testing.T) {
|
||||
for name, tc := range cases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
ao := MustBeControllableByAny(ctrlByAny)
|
||||
err := ao(context.TODO(), tc.current, nil)
|
||||
act := new(applyAction)
|
||||
err := ao(act, tc.current, nil)
|
||||
if diff := cmp.Diff(tc.want, err, test.EquateErrors()); diff != "" {
|
||||
t.Errorf("\n%s\nMustBeControllableByAny(...)(...): -want error, +got error\n%s\n", tc.reason, diff)
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ type WorkflowContext struct {
|
||||
store corev1.ConfigMap
|
||||
components map[string]*ComponentManifest
|
||||
vars *value.Value
|
||||
modified bool
|
||||
}
|
||||
|
||||
// GetComponent Get ComponentManifest from workflow context.
|
||||
@@ -70,7 +71,11 @@ func (wf *WorkflowContext) PatchComponent(name string, patchValue *value.Value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return component.Patch(patchValue)
|
||||
if err := component.Patch(patchValue); err != nil {
|
||||
return err
|
||||
}
|
||||
wf.modified = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetVar get variable from workflow context.
|
||||
@@ -87,7 +92,11 @@ func (wf *WorkflowContext) SetVar(v *value.Value, paths ...string) error {
|
||||
if err := wf.vars.FillRaw(str, paths...); err != nil {
|
||||
return err
|
||||
}
|
||||
return wf.vars.Error()
|
||||
if err := wf.vars.Error(); err != nil {
|
||||
return err
|
||||
}
|
||||
wf.modified = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// MakeParameter make 'value' with interface{}
|
||||
@@ -106,6 +115,9 @@ func (wf *WorkflowContext) MakeParameter(parameter interface{}) (*value.Value, e
|
||||
|
||||
// Commit the workflow context and persist it's content.
|
||||
func (wf *WorkflowContext) Commit() error {
|
||||
if !wf.modified {
|
||||
return nil
|
||||
}
|
||||
if err := wf.writeToStore(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -303,6 +315,7 @@ func newContext(cli client.Client, ns, app string) (*WorkflowContext, error) {
|
||||
cli: cli,
|
||||
store: store,
|
||||
components: map[string]*ComponentManifest{},
|
||||
modified: true,
|
||||
}
|
||||
var err error
|
||||
wfCtx.vars, err = value.NewValue("", nil, "")
|
||||
|
||||
@@ -249,6 +249,10 @@ func (e *engine) steps(wfCtx wfContext.Context, taskRunners []wfTypes.TaskRunner
|
||||
|
||||
e.updateStepStatus(status)
|
||||
|
||||
if err := wfCtx.Commit(); err != nil {
|
||||
return errors.WithMessage(err, "commit workflow context")
|
||||
}
|
||||
|
||||
if status.Phase != common.WorkflowStepPhaseSucceeded {
|
||||
if e.isDag() {
|
||||
continue
|
||||
@@ -256,10 +260,6 @@ func (e *engine) steps(wfCtx wfContext.Context, taskRunners []wfTypes.TaskRunner
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := wfCtx.Commit(); err != nil {
|
||||
return errors.WithMessage(err, "commit workflow context")
|
||||
}
|
||||
|
||||
e.finishStep(operation)
|
||||
if e.needStop() {
|
||||
return nil
|
||||
|
||||
@@ -20,6 +20,8 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/cue/model/value"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
@@ -332,6 +334,31 @@ var _ = Describe("Test Workflow", func() {
|
||||
}},
|
||||
})).Should(BeEquivalentTo(""))
|
||||
})
|
||||
|
||||
It("step commit data without success", func() {
|
||||
app, runners := makeTestCase([]oamcore.WorkflowStep{
|
||||
{
|
||||
Name: "s1",
|
||||
Type: "wait-with-set-var",
|
||||
},
|
||||
{
|
||||
Name: "s2",
|
||||
Type: "success",
|
||||
},
|
||||
})
|
||||
wf := NewWorkflow(app, k8sClient, common.WorkflowModeStep)
|
||||
state, err := wf.ExecuteSteps(context.Background(), revision, runners)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(state).Should(BeEquivalentTo(common.WorkflowStateExecuting))
|
||||
Expect(app.Status.Workflow.Steps[0].Phase).Should(BeEquivalentTo(common.WorkflowStepPhaseRunning))
|
||||
wfCtx, err := wfContext.LoadContext(k8sClient, app.Namespace, app.Name)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
v, err := wfCtx.GetVar("saved")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
saved, err := v.CueValue().Bool()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(saved).Should(BeEquivalentTo(true))
|
||||
})
|
||||
})
|
||||
|
||||
func makeTestCase(steps []oamcore.WorkflowStep) (*oamcore.Application, []wfTypes.TaskRunner) {
|
||||
@@ -401,6 +428,16 @@ func makeRunner(name string, tpy string) wfTypes.TaskRunner {
|
||||
Phase: common.WorkflowStepPhaseRunning,
|
||||
}, &wfTypes.Operation{}, errors.New("error for test")
|
||||
}
|
||||
case "wait-with-set-var":
|
||||
run = func(ctx wfContext.Context, options *wfTypes.TaskRunOptions) (common.WorkflowStepStatus, *wfTypes.Operation, error) {
|
||||
v, _ := value.NewValue(`saved: true`, nil, "")
|
||||
err := ctx.SetVar(v)
|
||||
return common.WorkflowStepStatus{
|
||||
Name: name,
|
||||
Type: "wait-with-set-var",
|
||||
Phase: common.WorkflowStepPhaseRunning,
|
||||
}, &wfTypes.Operation{}, err
|
||||
}
|
||||
|
||||
default:
|
||||
run = func(ctx wfContext.Context, options *wfTypes.TaskRunOptions) (common.WorkflowStepStatus, *wfTypes.Operation, error) {
|
||||
|
||||
@@ -13,7 +13,7 @@ spec:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: alibaba-provider-secret
|
||||
name: alibaba-account-creds
|
||||
namespace: vela-system
|
||||
stringData:
|
||||
credentials: |
|
||||
|
||||
49
vela-templates/addons/auto-gen/terraform-provider-aws.yaml
Normal file
49
vela-templates/addons/auto-gen/terraform-provider-aws.yaml
Normal file
@@ -0,0 +1,49 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Kubernetes Terraform Controller for AWS
|
||||
addons.oam.dev/name: terraform/provider-aws
|
||||
name: terraform-provider-aws
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: aws-account-creds
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: aws-account-creds
|
||||
namespace: vela-system
|
||||
stringData:
|
||||
credentials: |
|
||||
awsAccessKeyID: [[ index .Args "AWS_ACCESS_KEY_ID" ]]
|
||||
awsSecretAccessKey: [[ index .Args "AWS_SECRET_ACCESS_KEY" ]]
|
||||
awsSessionToken: [[ index .Args "AWS_SESSION_TOKEN" ]]
|
||||
type: Opaque
|
||||
type: raw
|
||||
- name: aws
|
||||
properties:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: aws
|
||||
namespace: default
|
||||
spec:
|
||||
credentials:
|
||||
secretRef:
|
||||
key: credentials
|
||||
name: aws-account-creds
|
||||
namespace: vela-system
|
||||
source: Secret
|
||||
provider: aws
|
||||
region: '[[ index .Args "AWS_DEFAULT_REGION" ]]'
|
||||
type: raw
|
||||
status:
|
||||
rollout:
|
||||
batchRollingState: ""
|
||||
currentBatch: 0
|
||||
lastTargetAppRevision: ""
|
||||
rollingState: ""
|
||||
upgradedReadyReplicas: 0
|
||||
upgradedReplicas: 0
|
||||
@@ -20,7 +20,7 @@ spec:
|
||||
chart: terraform-controller
|
||||
repoType: helm
|
||||
url: https://charts.kubevela.net/addons
|
||||
version: 0.1.19
|
||||
version: 0.2.6
|
||||
type: helm
|
||||
- name: alibaba-ack
|
||||
properties:
|
||||
@@ -37,199 +37,9 @@ spec:
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
module "kubernetes" {
|
||||
source = "github.com/zzxwill/terraform-alicloud-kubernetes"
|
||||
new_nat_gateway = true
|
||||
vpc_name = var.vpc_name
|
||||
vpc_cidr = var.vpc_cidr
|
||||
vswitch_name_prefix = var.vswitch_name_prefix
|
||||
vswitch_cidrs = var.vswitch_cidrs
|
||||
master_instance_types = var.master_instance_types
|
||||
worker_instance_types = var.worker_instance_types
|
||||
k8s_pod_cidr = var.k8s_pod_cidr
|
||||
k8s_service_cidr = var.k8s_service_cidr
|
||||
k8s_worker_number = var.k8s_worker_number
|
||||
cpu_core_count = var.cpu_core_count
|
||||
memory_size = var.memory_size
|
||||
zone_id = var.zone_id
|
||||
k8s_version = var.k8s_version
|
||||
k8s_name_prefix = var.k8s_name_prefix
|
||||
}
|
||||
######################
|
||||
# Instance types variables
|
||||
######################
|
||||
variable "cpu_core_count" {
|
||||
description = "CPU core count is used to fetch instance types."
|
||||
type = number
|
||||
default = 4
|
||||
}
|
||||
variable "memory_size" {
|
||||
description = "Memory size used to fetch instance types."
|
||||
type = number
|
||||
default = 8
|
||||
}
|
||||
######################
|
||||
# VPC variables
|
||||
######################
|
||||
variable "vpc_name" {
|
||||
description = "The vpc name used to create a new vpc when 'vpc_id' is not specified. Default to variable `example_name`"
|
||||
type = string
|
||||
default = "tf-k8s-vpc"
|
||||
}
|
||||
variable "vpc_cidr" {
|
||||
description = "The cidr block used to launch a new vpc when 'vpc_id' is not specified."
|
||||
type = string
|
||||
default = "10.0.0.0/8"
|
||||
}
|
||||
######################
|
||||
# VSwitch variables
|
||||
######################
|
||||
variable "vswitch_name_prefix" {
|
||||
type = string
|
||||
description = "The vswitch name prefix used to create several new vswitches. Default to variable 'example_name'."
|
||||
default = "tf-k8s-vsw"
|
||||
}
|
||||
variable "number_format" {
|
||||
description = "The number format used to output."
|
||||
type = string
|
||||
default = "%02d"
|
||||
}
|
||||
variable "vswitch_ids" {
|
||||
description = "List of existing vswitch id."
|
||||
type = list
|
||||
default = []
|
||||
}
|
||||
variable "vswitch_cidrs" {
|
||||
description = "List of cidr blocks used to create several new vswitches when 'vswitch_ids' is not specified."
|
||||
type = list
|
||||
default = [
|
||||
"10.1.0.0/16",
|
||||
"10.2.0.0/16",
|
||||
"10.3.0.0/16"]
|
||||
}
|
||||
variable "k8s_name_prefix" {
|
||||
description = "The name prefix used to create several kubernetes clusters. Default to variable `example_name`"
|
||||
type = string
|
||||
default = "poc"
|
||||
}
|
||||
variable "new_nat_gateway" {
|
||||
type = bool
|
||||
description = "Whether to create a new nat gateway. In this template, a new nat gateway will create a nat gateway, eip and server snat entries."
|
||||
default = true
|
||||
}
|
||||
variable "master_instance_types" {
|
||||
description = "The ecs instance types used to launch master nodes."
|
||||
type = list
|
||||
default = [
|
||||
# hongkong
|
||||
"ecs.sn1ne.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6.xlarge",
|
||||
# hongkong
|
||||
"ecs.c4.xlarge",
|
||||
# hongkong
|
||||
"ecs.c5.xlarge",
|
||||
"ecs.n4.xlarge",
|
||||
# "ecs.n1.large",
|
||||
# "ecs.sn1.large",
|
||||
# "ecs.s6-c1m2.xlarge",
|
||||
# "ecs.c6e.xlarge"
|
||||
]
|
||||
}
|
||||
variable "worker_instance_types" {
|
||||
description = "The ecs instance types used to launch worker nodes."
|
||||
type = list
|
||||
default = [
|
||||
# hongkong
|
||||
"ecs.sn1ne.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6.xlarge",
|
||||
# hongkong
|
||||
"ecs.c4.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6e.xlarge",
|
||||
"ecs.n4.xlarge",
|
||||
// "ecs.n1.large",
|
||||
// "ecs.sn1.large",
|
||||
// "ecs.s6-c1m2.xlarge"
|
||||
]
|
||||
}
|
||||
variable "node_cidr_mask" {
|
||||
type = number
|
||||
description = "The node cidr block to specific how many pods can run on single node. Valid values: [24-28]."
|
||||
default = 24
|
||||
}
|
||||
variable "enable_ssh" {
|
||||
description = "Enable login to the node through SSH."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
variable "install_cloud_monitor" {
|
||||
description = "Install cloud monitor agent on ECS."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
variable "cpu_policy" {
|
||||
type = string
|
||||
description = "kubelet cpu policy. Valid values: 'none','static'. Default to 'none'."
|
||||
default = "none"
|
||||
}
|
||||
variable "proxy_mode" {
|
||||
description = "Proxy mode is option of kube-proxy. Valid values: 'ipvs','iptables'. Default to 'iptables'."
|
||||
type = string
|
||||
default = "iptables"
|
||||
}
|
||||
variable "password" {
|
||||
description = "The password of ECS instance."
|
||||
type = string
|
||||
default = "Just4Test"
|
||||
}
|
||||
variable "k8s_worker_number" {
|
||||
description = "The number of worker nodes in kubernetes cluster."
|
||||
type = number
|
||||
default = 2
|
||||
}
|
||||
# k8s_pod_cidr is only for flannel network
|
||||
variable "k8s_pod_cidr" {
|
||||
description = "The kubernetes pod cidr block. It cannot be equals to vpc's or vswitch's and cannot be in them."
|
||||
type = string
|
||||
default = "172.20.0.0/16"
|
||||
}
|
||||
variable "k8s_service_cidr" {
|
||||
description = "The kubernetes service cidr block. It cannot be equals to vpc's or vswitch's or pod's and cannot be in them."
|
||||
type = string
|
||||
default = "192.168.0.0/16"
|
||||
}
|
||||
variable "k8s_version" {
|
||||
description = "The version of the kubernetes version. Valid values: '1.16.6-aliyun.1','1.14.8-aliyun.1'. Default to '1.16.6-aliyun.1'."
|
||||
type = string
|
||||
default = "1.20.4-aliyun.1"
|
||||
}
|
||||
variable "zone_id" {
|
||||
description = "Availability Zone ID"
|
||||
type = string
|
||||
default = "cn-hongkong-b"
|
||||
# "cn-beijing-a"
|
||||
}
|
||||
output "name" {
|
||||
value = module.kubernetes.name
|
||||
}
|
||||
output "kubeconfig" {
|
||||
value = module.kubernetes.kubeconfig
|
||||
}
|
||||
output "cluster_ca_cert" {
|
||||
value = module.kubernetes.cluster_ca_cert
|
||||
}
|
||||
output "client_cert" {
|
||||
value = module.kubernetes.client_cert
|
||||
}
|
||||
output "client_key" {
|
||||
value = module.kubernetes.client_key
|
||||
}
|
||||
output "api_server_internet" {
|
||||
value = module.kubernetes.api_server_internet
|
||||
}
|
||||
configuration: https://github.com/kubevela-contrib/terraform-modules.git
|
||||
path: alibaba/cs/dedicated-kubernetes
|
||||
type: remote
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
@@ -301,7 +111,7 @@ spec:
|
||||
terraform:
|
||||
configuration: |
|
||||
module "rds" {
|
||||
source = "terraform-alicloud-modules/rds/alicloud"
|
||||
source = "github.com/kubevela-contrib/terraform-alicloud-rds"
|
||||
engine = "MySQL"
|
||||
engine_version = "8.0"
|
||||
instance_type = "rds.mysql.c1.large"
|
||||
@@ -309,6 +119,8 @@ spec:
|
||||
instance_name = var.instance_name
|
||||
account_name = var.account_name
|
||||
password = var.password
|
||||
allocate_public_connection = var.allocate_public_connection
|
||||
security_ips = ["0.0.0.0/0",]
|
||||
}
|
||||
|
||||
output "DB_NAME" {
|
||||
@@ -326,6 +138,9 @@ spec:
|
||||
output "DB_PASSWORD" {
|
||||
value = var.password
|
||||
}
|
||||
output "DB_PUBLIC_HOST" {
|
||||
value = module.rds.db_public_connection_string
|
||||
}
|
||||
|
||||
variable "instance_name" {
|
||||
description = "RDS instance name"
|
||||
@@ -344,6 +159,52 @@ spec:
|
||||
type = string
|
||||
default = "Xyfff83jfewGGfaked"
|
||||
}
|
||||
|
||||
variable "allocate_public_connection" {
|
||||
description = "Whether to allocate public connection for a RDS instance."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
type: raw
|
||||
- name: aws-s3
|
||||
properties:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for AWS S3
|
||||
labels:
|
||||
type: terraform
|
||||
name: aws-s3
|
||||
namespace: vela-system
|
||||
spec:
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
resource "aws_s3_bucket" "bucket-acl" {
|
||||
bucket = var.bucket
|
||||
acl = var.acl
|
||||
}
|
||||
|
||||
output "BUCKET_NAME" {
|
||||
value = aws_s3_bucket.bucket-acl.bucket_domain_name
|
||||
}
|
||||
|
||||
variable "bucket" {
|
||||
description = "S3 bucket name"
|
||||
default = "vela-website"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "acl" {
|
||||
description = "S3 bucket ACL"
|
||||
default = "private"
|
||||
type = string
|
||||
}
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
|
||||
@@ -13,7 +13,7 @@ spec:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: alibaba-provider-secret
|
||||
name: alibaba-account-creds
|
||||
namespace: vela-system
|
||||
type: Opaque
|
||||
stringData:
|
||||
|
||||
51
vela-templates/addons/terraform-provider-aws/template.yaml
Normal file
51
vela-templates/addons/terraform-provider-aws/template.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
addons.oam.dev/description: Kubernetes Terraform Controller for AWS
|
||||
addons.oam.dev/name: terraform/provider-aws
|
||||
name: terraform-provider-aws
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- name: aws-account-creds
|
||||
properties:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: aws-account-creds
|
||||
namespace: vela-system
|
||||
type: Opaque
|
||||
stringData:
|
||||
credentials: |
|
||||
awsAccessKeyID: [[ index .Args "AWS_ACCESS_KEY_ID" ]]
|
||||
awsSecretAccessKey: [[ index .Args "AWS_SECRET_ACCESS_KEY" ]]
|
||||
awsSessionToken: [[ index .Args "AWS_SESSION_TOKEN" ]]
|
||||
type: raw
|
||||
- name: aws
|
||||
type: raw
|
||||
properties:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Provider
|
||||
metadata:
|
||||
name: aws
|
||||
namespace: default
|
||||
spec:
|
||||
provider: aws
|
||||
region: '[[ index .Args "AWS_DEFAULT_REGION" ]]'
|
||||
credentials:
|
||||
source: Secret
|
||||
secretRef:
|
||||
namespace: vela-system
|
||||
name: aws-account-creds
|
||||
key: credentials
|
||||
{{ range .ResourceFiles }}
|
||||
- name: {{ .Name }}
|
||||
type: raw
|
||||
properties:
|
||||
{{ .Content | indent 8 }} {{ end }}
|
||||
{{ range .DefinitionFiles }}
|
||||
- name: {{ .Name }}
|
||||
type: raw
|
||||
properties:
|
||||
{{ .Content | indent 8 }} {{ end }}
|
||||
@@ -14,196 +14,6 @@ spec:
|
||||
kind: Configuration
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
module "kubernetes" {
|
||||
source = "github.com/zzxwill/terraform-alicloud-kubernetes"
|
||||
new_nat_gateway = true
|
||||
vpc_name = var.vpc_name
|
||||
vpc_cidr = var.vpc_cidr
|
||||
vswitch_name_prefix = var.vswitch_name_prefix
|
||||
vswitch_cidrs = var.vswitch_cidrs
|
||||
master_instance_types = var.master_instance_types
|
||||
worker_instance_types = var.worker_instance_types
|
||||
k8s_pod_cidr = var.k8s_pod_cidr
|
||||
k8s_service_cidr = var.k8s_service_cidr
|
||||
k8s_worker_number = var.k8s_worker_number
|
||||
cpu_core_count = var.cpu_core_count
|
||||
memory_size = var.memory_size
|
||||
zone_id = var.zone_id
|
||||
k8s_version = var.k8s_version
|
||||
k8s_name_prefix = var.k8s_name_prefix
|
||||
}
|
||||
######################
|
||||
# Instance types variables
|
||||
######################
|
||||
variable "cpu_core_count" {
|
||||
description = "CPU core count is used to fetch instance types."
|
||||
type = number
|
||||
default = 4
|
||||
}
|
||||
variable "memory_size" {
|
||||
description = "Memory size used to fetch instance types."
|
||||
type = number
|
||||
default = 8
|
||||
}
|
||||
######################
|
||||
# VPC variables
|
||||
######################
|
||||
variable "vpc_name" {
|
||||
description = "The vpc name used to create a new vpc when 'vpc_id' is not specified. Default to variable `example_name`"
|
||||
type = string
|
||||
default = "tf-k8s-vpc"
|
||||
}
|
||||
variable "vpc_cidr" {
|
||||
description = "The cidr block used to launch a new vpc when 'vpc_id' is not specified."
|
||||
type = string
|
||||
default = "10.0.0.0/8"
|
||||
}
|
||||
######################
|
||||
# VSwitch variables
|
||||
######################
|
||||
variable "vswitch_name_prefix" {
|
||||
type = string
|
||||
description = "The vswitch name prefix used to create several new vswitches. Default to variable 'example_name'."
|
||||
default = "tf-k8s-vsw"
|
||||
}
|
||||
variable "number_format" {
|
||||
description = "The number format used to output."
|
||||
type = string
|
||||
default = "%02d"
|
||||
}
|
||||
variable "vswitch_ids" {
|
||||
description = "List of existing vswitch id."
|
||||
type = list
|
||||
default = []
|
||||
}
|
||||
variable "vswitch_cidrs" {
|
||||
description = "List of cidr blocks used to create several new vswitches when 'vswitch_ids' is not specified."
|
||||
type = list
|
||||
default = [
|
||||
"10.1.0.0/16",
|
||||
"10.2.0.0/16",
|
||||
"10.3.0.0/16"]
|
||||
}
|
||||
variable "k8s_name_prefix" {
|
||||
description = "The name prefix used to create several kubernetes clusters. Default to variable `example_name`"
|
||||
type = string
|
||||
default = "poc"
|
||||
}
|
||||
variable "new_nat_gateway" {
|
||||
type = bool
|
||||
description = "Whether to create a new nat gateway. In this template, a new nat gateway will create a nat gateway, eip and server snat entries."
|
||||
default = true
|
||||
}
|
||||
variable "master_instance_types" {
|
||||
description = "The ecs instance types used to launch master nodes."
|
||||
type = list
|
||||
default = [
|
||||
# hongkong
|
||||
"ecs.sn1ne.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6.xlarge",
|
||||
# hongkong
|
||||
"ecs.c4.xlarge",
|
||||
# hongkong
|
||||
"ecs.c5.xlarge",
|
||||
"ecs.n4.xlarge",
|
||||
# "ecs.n1.large",
|
||||
# "ecs.sn1.large",
|
||||
# "ecs.s6-c1m2.xlarge",
|
||||
# "ecs.c6e.xlarge"
|
||||
]
|
||||
}
|
||||
variable "worker_instance_types" {
|
||||
description = "The ecs instance types used to launch worker nodes."
|
||||
type = list
|
||||
default = [
|
||||
# hongkong
|
||||
"ecs.sn1ne.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6.xlarge",
|
||||
# hongkong
|
||||
"ecs.c4.xlarge",
|
||||
# hongkong
|
||||
"ecs.c6e.xlarge",
|
||||
"ecs.n4.xlarge",
|
||||
// "ecs.n1.large",
|
||||
// "ecs.sn1.large",
|
||||
// "ecs.s6-c1m2.xlarge"
|
||||
]
|
||||
}
|
||||
variable "node_cidr_mask" {
|
||||
type = number
|
||||
description = "The node cidr block to specific how many pods can run on single node. Valid values: [24-28]."
|
||||
default = 24
|
||||
}
|
||||
variable "enable_ssh" {
|
||||
description = "Enable login to the node through SSH."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
variable "install_cloud_monitor" {
|
||||
description = "Install cloud monitor agent on ECS."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
variable "cpu_policy" {
|
||||
type = string
|
||||
description = "kubelet cpu policy. Valid values: 'none','static'. Default to 'none'."
|
||||
default = "none"
|
||||
}
|
||||
variable "proxy_mode" {
|
||||
description = "Proxy mode is option of kube-proxy. Valid values: 'ipvs','iptables'. Default to 'iptables'."
|
||||
type = string
|
||||
default = "iptables"
|
||||
}
|
||||
variable "password" {
|
||||
description = "The password of ECS instance."
|
||||
type = string
|
||||
default = "Just4Test"
|
||||
}
|
||||
variable "k8s_worker_number" {
|
||||
description = "The number of worker nodes in kubernetes cluster."
|
||||
type = number
|
||||
default = 2
|
||||
}
|
||||
# k8s_pod_cidr is only for flannel network
|
||||
variable "k8s_pod_cidr" {
|
||||
description = "The kubernetes pod cidr block. It cannot be equals to vpc's or vswitch's and cannot be in them."
|
||||
type = string
|
||||
default = "172.20.0.0/16"
|
||||
}
|
||||
variable "k8s_service_cidr" {
|
||||
description = "The kubernetes service cidr block. It cannot be equals to vpc's or vswitch's or pod's and cannot be in them."
|
||||
type = string
|
||||
default = "192.168.0.0/16"
|
||||
}
|
||||
variable "k8s_version" {
|
||||
description = "The version of the kubernetes version. Valid values: '1.16.6-aliyun.1','1.14.8-aliyun.1'. Default to '1.16.6-aliyun.1'."
|
||||
type = string
|
||||
default = "1.20.4-aliyun.1"
|
||||
}
|
||||
variable "zone_id" {
|
||||
description = "Availability Zone ID"
|
||||
type = string
|
||||
default = "cn-hongkong-b"
|
||||
# "cn-beijing-a"
|
||||
}
|
||||
output "name" {
|
||||
value = module.kubernetes.name
|
||||
}
|
||||
output "kubeconfig" {
|
||||
value = module.kubernetes.kubeconfig
|
||||
}
|
||||
output "cluster_ca_cert" {
|
||||
value = module.kubernetes.cluster_ca_cert
|
||||
}
|
||||
output "client_cert" {
|
||||
value = module.kubernetes.client_cert
|
||||
}
|
||||
output "client_key" {
|
||||
value = module.kubernetes.client_key
|
||||
}
|
||||
output "api_server_internet" {
|
||||
value = module.kubernetes.api_server_internet
|
||||
}
|
||||
configuration: https://github.com/kubevela-contrib/terraform-modules.git
|
||||
type: remote
|
||||
path: alibaba/cs/dedicated-kubernetes
|
||||
|
||||
@@ -16,7 +16,7 @@ spec:
|
||||
terraform:
|
||||
configuration: |
|
||||
module "rds" {
|
||||
source = "terraform-alicloud-modules/rds/alicloud"
|
||||
source = "github.com/kubevela-contrib/terraform-alicloud-rds"
|
||||
engine = "MySQL"
|
||||
engine_version = "8.0"
|
||||
instance_type = "rds.mysql.c1.large"
|
||||
@@ -24,6 +24,8 @@ spec:
|
||||
instance_name = var.instance_name
|
||||
account_name = var.account_name
|
||||
password = var.password
|
||||
allocate_public_connection = var.allocate_public_connection
|
||||
security_ips = ["0.0.0.0/0",]
|
||||
}
|
||||
|
||||
output "DB_NAME" {
|
||||
@@ -41,6 +43,9 @@ spec:
|
||||
output "DB_PASSWORD" {
|
||||
value = var.password
|
||||
}
|
||||
output "DB_PUBLIC_HOST" {
|
||||
value = module.rds.db_public_connection_string
|
||||
}
|
||||
|
||||
variable "instance_name" {
|
||||
description = "RDS instance name"
|
||||
@@ -59,3 +64,9 @@ spec:
|
||||
type = string
|
||||
default = "Xyfff83jfewGGfaked"
|
||||
}
|
||||
|
||||
variable "allocate_public_connection" {
|
||||
description = "Whether to allocate public connection for a RDS instance."
|
||||
type = bool
|
||||
default = true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
name: aws-s3
|
||||
namespace: vela-system
|
||||
annotations:
|
||||
definition.oam.dev/description: Terraform configuration for AWS S3
|
||||
labels:
|
||||
type: terraform
|
||||
spec:
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: terraform.core.oam.dev/v1beta1
|
||||
kind: Configuration
|
||||
schematic:
|
||||
terraform:
|
||||
configuration: |
|
||||
resource "aws_s3_bucket" "bucket-acl" {
|
||||
bucket = var.bucket
|
||||
acl = var.acl
|
||||
}
|
||||
|
||||
output "BUCKET_NAME" {
|
||||
value = aws_s3_bucket.bucket-acl.bucket_domain_name
|
||||
}
|
||||
|
||||
variable "bucket" {
|
||||
description = "S3 bucket name"
|
||||
default = "vela-website"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "acl" {
|
||||
description = "S3 bucket ACL"
|
||||
default = "private"
|
||||
type = string
|
||||
}
|
||||
@@ -33,7 +33,7 @@ spec:
|
||||
repoType: helm
|
||||
url: https://charts.kubevela.net/addons
|
||||
chart: terraform-controller
|
||||
version: 0.1.19
|
||||
version: 0.2.6
|
||||
{{ range .ResourceFiles }}
|
||||
- name: {{ .Name }}
|
||||
type: raw
|
||||
|
||||
@@ -10,7 +10,13 @@ import (
|
||||
}
|
||||
template: {
|
||||
apply: op.#Apply & {
|
||||
value: parameter
|
||||
value: parameter.value
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the value of the object
|
||||
value: {...}
|
||||
// +usage=Specify the cluster of the object
|
||||
cluster: *"" | string
|
||||
}
|
||||
parameter: {}
|
||||
}
|
||||
|
||||
113
vela-templates/definitions/internal/nocalhost.cue
Normal file
113
vela-templates/definitions/internal/nocalhost.cue
Normal file
@@ -0,0 +1,113 @@
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
nocalhost: {
|
||||
type: "trait"
|
||||
annotations: {}
|
||||
labels: {}
|
||||
description: "nocalhost develop configuration."
|
||||
attributes: {
|
||||
podDisruptive: true
|
||||
appliesToWorkloads: ["*"]
|
||||
}
|
||||
}
|
||||
|
||||
template: {
|
||||
patch: {
|
||||
metadata: annotations: {
|
||||
"dev.nocalhost/application-name": context.appName
|
||||
"dev.nocalhost/application-namespace": context.namespace
|
||||
"dev.nocalhost": json.Marshal({
|
||||
"containers": [
|
||||
{
|
||||
"name": context.name
|
||||
"dev": {
|
||||
if parameter.gitUrl != _|_ {
|
||||
"gitUrl": parameter.gitUrl
|
||||
}
|
||||
"image": parameter.image
|
||||
"shell": parameter.shell
|
||||
"workDir": parameter.workDir
|
||||
if parameter.storageClass != _|_ {
|
||||
"storageClass": parameter.storageClass
|
||||
}
|
||||
"resources": {
|
||||
"limits": parameter.resources.limits
|
||||
"requests": parameter.resources.requests
|
||||
}
|
||||
if parameter.persistentVolumeDirs != _|_ {
|
||||
persistentVolumeDirs: [
|
||||
for v in parameter.persistentVolumeDirs {
|
||||
path: v.path
|
||||
capacity: v.capacity
|
||||
},
|
||||
]
|
||||
}
|
||||
if parameter.command != _|_ {
|
||||
"command": parameter.command
|
||||
}
|
||||
if parameter.debug != _|_ {
|
||||
"debug": parameter.debug
|
||||
}
|
||||
"hotReload": parameter.hotReload
|
||||
if parameter.sync != _|_ {
|
||||
sync: parameter.sync
|
||||
}
|
||||
if parameter.env != _|_ {
|
||||
env: [
|
||||
for v in parameter.env {
|
||||
name: v.name
|
||||
value: v.value
|
||||
},
|
||||
]
|
||||
}
|
||||
if parameter.portForward != _|_ {
|
||||
"portForward": parameter.portForward
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
gitUrl?: string
|
||||
image: string
|
||||
shell: *"bash" | string
|
||||
workDir: *"/home/nocalhost-dev" | string
|
||||
storageClass?: string
|
||||
command?: {
|
||||
run?: [...string]
|
||||
debug?: [...string]
|
||||
}
|
||||
debug?: {
|
||||
remoteDebugPort?: int
|
||||
}
|
||||
hotReload: *true | bool
|
||||
sync: {
|
||||
type: *"send" | string
|
||||
filePattern?: [...string]
|
||||
ignoreFilePattern?: [...string]
|
||||
}
|
||||
env?: [...{
|
||||
name: string
|
||||
value: string
|
||||
}]
|
||||
portForward?: [...string]
|
||||
persistentVolumeDirs?: [...{
|
||||
path: string
|
||||
capacity: string
|
||||
}]
|
||||
resources: {
|
||||
limits: {
|
||||
memory: *"2Gi" | string
|
||||
cpu: *"2" | string
|
||||
}
|
||||
requests: {
|
||||
memory: *"512Mi" | string
|
||||
cpu: *"0.5" | string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ template: {
|
||||
}
|
||||
}
|
||||
}
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
}
|
||||
if parameter.apiVersion != _|_ || parameter.kind != _|_ {
|
||||
@@ -36,6 +37,7 @@ template: {
|
||||
}
|
||||
}
|
||||
}
|
||||
cluster: parameter.cluster
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,5 +50,7 @@ template: {
|
||||
name: string
|
||||
// +usage=Specify the namespace of the object
|
||||
namespace?: string
|
||||
// +usage=Specify the cluster of the object
|
||||
cluster: *"" | string
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user