Skip to content

Commit

Permalink
Fix: backport Terraform releated PR (#2829)
Browse files Browse the repository at this point in the history
- Fix: upgrade terraform controller to v0.2.10 #2827
- Fix: support naming a terraform provider #2794

Signed-off-by: zzxwill <zzxwill@gmail.com>
  • Loading branch information
zzxwill committed Nov 30, 2021
1 parent 493d8bd commit c4c0063
Show file tree
Hide file tree
Showing 36 changed files with 1,422 additions and 1,145 deletions.
9 changes: 6 additions & 3 deletions Makefile
Expand Up @@ -155,7 +155,7 @@ e2e-setup:
helm upgrade --install --create-namespace --namespace vela-system --set image.pullPolicy=IfNotPresent --set image.repository=vela-core-test --set applicationRevisionLimit=5 --set dependCheckWait=10s --set image.tag=$(GIT_COMMIT) --wait kubevela ./charts/vela-core
helm upgrade --install --create-namespace --namespace oam-runtime-system --set image.pullPolicy=IfNotPresent --set image.repository=vela-core-test --set dependCheckWait=10s --set image.tag=$(GIT_COMMIT) --wait oam-runtime ./charts/oam-runtime
bin/vela addon enable fluxcd
bin/vela addon enable terraform-alibaba
bin/vela addon enable terraform-alibaba ALICLOUD_ACCESS_KEY=xxx ALICLOUD_SECRET_KEY=yyy ALICLOUD_REGION=cn-beijing
ginkgo version
ginkgo -v -r e2e/setup

Expand Down Expand Up @@ -259,15 +259,14 @@ core-uninstall: manifests
kubectl delete -f charts/vela-core/crds/

# Generate manifests e.g. CRD, RBAC etc.
manifests: installcue kustomize
manifests: installcue kustomize addon
go generate $(foreach t,pkg apis,./$(t)/...)
# TODO(yangsoon): kustomize will merge all CRD into a whole file, it may not work if we want patch more than one CRD in this way
$(KUSTOMIZE) build config/crd -o config/crd/base/core.oam.dev_applications.yaml
./hack/crd/cleanup.sh
go run ./hack/crd/dispatch/dispatch.go config/crd/base charts/vela-core/crds charts/oam-runtime/crds runtime/ charts/vela-minimal/crds
rm -f config/crd/base/*
./vela-templates/gen_definitions.sh
go run ./vela-templates/gen_addons.go

GOLANGCILINT_VERSION ?= v1.38.0
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
Expand Down Expand Up @@ -351,3 +350,7 @@ check-license-header:

def-install:
./hack/utils/installdefinition.sh

# generate addons to auto-gen and charts
addon:
go run ./vela-templates/gen_addons.go
297 changes: 6 additions & 291 deletions charts/vela-core/templates/addons/terraform-alibaba.yaml
Expand Up @@ -11,322 +11,37 @@ data:
namespace: vela-system
spec:
components:
- name: alibaba-account-creds
- name: alibaba-account-creds-[[ index .Args "providerName" ]]
properties:
apiVersion: v1
kind: Secret
metadata:
name: alibaba-account-creds
name: alibaba-account-creds-[[ index .Args "providerName" ]]
namespace: vela-system
stringData:
credentials: |
accessKeyID: [[ index .Args "ALICLOUD_ACCESS_KEY" ]]
accessKeySecret: [[ index .Args "ALICLOUD_SECRET_KEY" ]]
securityToken: [[ index .Args "ALICLOUD_SECURITY_TOKEN" ]]
type: Opaquehelm
type: Opaque
type: raw
- name: default
- name: alibaba-[[ index .Args "providerName" ]]
properties:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Provider
metadata:
name: default
name: '[[ index .Args "providerName" ]]'
namespace: default
spec:
credentials:
secretRef:
key: credentials
name: alibaba-account-creds
name: alibaba-account-creds-[[ index .Args "providerName" ]]
namespace: vela-system
source: Secret
provider: alibaba
region: '[[ index .Args "ALICLOUD_REGION" ]]'
type: raw
- name: alibaba-redis
properties:
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
Redis
labels:
type: terraform
name: alibaba-redis
namespace: vela-system
spec:
schematic:
terraform:
configuration: https://github.com/kubevela-contrib/terraform-modules/alibaba/redis
type: remote
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
type: raw
- name: alibaba-ack
properties:
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
ACK cluster
labels:
type: terraform
name: alibaba-ack
namespace: vela-system
spec:
schematic:
terraform:
configuration: https://github.com/kubevela-contrib/terraform-modules.git
path: alibaba/cs/dedicated-kubernetes
type: remote
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
type: raw
- name: alibaba-ask
properties:
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
Serverless Kubernetes (ASK)
labels:
type: terraform
name: alibaba-ask
namespace: vela-system
spec:
schematic:
terraform:
configuration: https://github.com/kubevela-contrib/terraform-modules.git
path: alibaba/cs/serverless-kubernetes
type: remote
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
type: raw
- name: alibaba-eip
properties:
apiVersion: core.oam.dev/v1alpha2
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
Elastic IP
labels:
type: terraform
name: alibaba-eip
namespace: vela-system
spec:
schematic:
terraform:
configuration: https://github.com/oam-dev/terraform-alibaba-eip.git
type: remote
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
type: raw
- name: alibaba-oss
properties:
apiVersion: core.oam.dev/v1alpha2
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
OSS object
labels:
type: terraform
name: alibaba-oss
namespace: vela-system
spec:
schematic:
terraform:
configuration: "resource \"alicloud_oss_bucket\" \"bucket-acl\" {\n bucket
= var.bucket\n acl = var.acl\n}\noutput \"BUCKET_NAME\" {\n value
= \"${alicloud_oss_bucket.bucket-acl.bucket}.${alicloud_oss_bucket.bucket-acl.extranet_endpoint}\"\n}\nvariable
\"bucket\" {\n description = \"OSS bucket name\"\n default = \"vela-website\"\n
\ type = string\n}\nvariable \"acl\" {\n description = \"OSS bucket
ACL, supported 'private', 'public-read', 'public-read-write'\"\n default
= \"private\"\n type = string\n} \n"
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
type: raw
- name: alibaba-rds
properties:
apiVersion: core.oam.dev/v1alpha2
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
RDS object
labels:
type: terraform
name: alibaba-rds
namespace: vela-system
spec:
schematic:
terraform:
configuration: |
module "rds" {
source = "github.com/kubevela-contrib/terraform-alicloud-rds"
engine = "MySQL"
engine_version = "8.0"
instance_type = "rds.mysql.c1.large"
instance_storage = "20"
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" {
value = module.rds.this_db_instance_name
}
output "DB_USER" {
value = module.rds.this_db_database_account
}
output "DB_PORT" {
value = module.rds.this_db_instance_port
}
output "DB_HOST" {
value = module.rds.this_db_instance_connection_string
}
output "DB_PASSWORD" {
value = var.password
}
output "DB_PUBLIC_HOST" {
value = module.rds.db_public_connection_string
}
variable "instance_name" {
description = "RDS instance name"
type = string
default = "poc"
}
variable "account_name" {
description = "RDS instance user account name"
type = string
default = "oam"
}
variable "password" {
description = "RDS instance account password"
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: alibaba-sls-project
properties:
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
SLS Project
labels:
type: terraform
name: alibaba-sls-project
namespace: vela-system
spec:
schematic:
terraform:
configuration: https://github.com/kubevela-contrib/terraform-modules.git
path: alibaba/sls/project
type: remote
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
type: raw
- name: alibaba-sls-store
properties:
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
SLS Store
labels:
type: terraform
name: alibaba-sls-store
namespace: vela-system
spec:
schematic:
terraform:
configuration: https://github.com/kubevela-contrib/terraform-modules.git
path: alibaba/sls/store
type: remote
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
type: raw
- name: alibaba-vpc
properties:
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
VPC
labels:
type: terraform
name: alibaba-vpc
namespace: vela-system
spec:
schematic:
terraform:
configuration: https://github.com/kubevela-contrib/terraform-modules.git
path: alibaba/vpc
type: remote
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
type: raw
- name: alibaba-vswitch
properties:
apiVersion: core.oam.dev/v1beta1
kind: ComponentDefinition
metadata:
annotations:
definition.oam.dev/description: Terraform configuration for Alibaba Cloud
VSwitch
labels:
type: terraform
name: alibaba-vswitch
namespace: vela-system
spec:
schematic:
terraform:
configuration: https://github.com/kubevela-contrib/terraform-modules.git
path: alibaba/vswitch
type: remote
workload:
definition:
apiVersion: terraform.core.oam.dev/v1beta1
kind: Configuration
type: raw
workflow:
steps:
- name: ""
Expand Down

0 comments on commit c4c0063

Please sign in to comment.