Commit 36266a6e by chenxx

update all2

1 parent 2af1c64c
......@@ -30,19 +30,20 @@
|------|-------------|------|---------|:--------:|
| <a name="input_app_log_path"></a> [app\_log\_path](#input\_app\_log\_path) | @label "应用日志路径" @group "Advanced" | `string` | `"/data/java_log"` | no |
| <a name="input_app_log_path_volume_name"></a> [app\_log\_path\_volume\_name](#input\_app\_log\_path\_volume\_name) | 应用日志挂载卷名,名字只能使用-,例: abc-22 abc-cc | `string` | `"app-log-path"` | no |
| <a name="input_args"></a> [args](#input\_args) | 属于那个环境,例子:dev,test,beta,release | `string` | `"test"` | no |
| <a name="input_args"></a> [args](#input\_args) | 属于那个环境,例子:dev,test,beta,release | `list(string)` | <pre>[<br> "release"<br>]</pre> | no |
| <a name="input_domain_name"></a> [domain\_name](#input\_domain\_name) | 域名 | `string` | `""` | no |
| <a name="input_env"></a> [env](#input\_env) | Name and value pairs to set as the environment variables | `map(string)` | `{}` | no |
| <a name="input_hosts"></a> [hosts](#input\_hosts) | (Optional) host aliases 手动配置域名到hosts | `list(object({ hostname = list(string), ip = string }))` | `[]` | no |
| <a name="input_image"></a> [image](#input\_image) | Docker image name | `string` | n/a | yes |
| <a name="input_ingress_switch"></a> [ingress\_switch](#input\_ingress\_switch) | choise ingress switch | <pre>object({<br> switch = optional(string)<br> path_type = optional(string)<br> path = optional(string)<br> domain_name = optional(string)<br> })</pre> | <pre>{<br> "domain_name": null,<br> "path": "/",<br> "path_type": "ImplementationSpecific",<br> "switch": "off"<br>}</pre> | no |
| <a name="input_limit_cpu"></a> [limit\_cpu](#input\_limit\_cpu) | CPU limit. e.g. 0.5, 1, 2 | `string` | `"1"` | no |
| <a name="input_limit_memory"></a> [limit\_memory](#input\_limit\_memory) | Memory limit. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi | `string` | `"1G"` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the deployment resource. Auto-generated if empty. | `string` | n/a | yes |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace to deploy. Auto-generated if empty. | `string` | n/a | yes |
| <a name="input_ports"></a> [ports](#input\_ports) | Service ports to expose | `list(number)` | <pre>[<br> 6666<br>]</pre> | no |
| <a name="input_limit_cpu"></a> [limit\_cpu](#input\_limit\_cpu) | CPU limit. e.g. 0.5, 1, 2 | `string` | `"0.5"` | no |
| <a name="input_limit_memory"></a> [limit\_memory](#input\_limit\_memory) | Memory limit. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi | `string` | `"512Mi"` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the deployment resource. Auto-generated if empty. | `string` | `""` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace to deploy. Auto-generated if empty. | `string` | `"default"` | no |
| <a name="input_path"></a> [path](#input\_path) | 访问路径 | `string` | `"/"` | no |
| <a name="input_path_type"></a> [path\_type](#input\_path\_type) | Path type for ingress rule | `string` | `"ImplementationSpecific"` | no |
| <a name="input_ports"></a> [ports](#input\_ports) | Service ports to expose | `list(number)` | n/a | yes |
| <a name="input_replicas"></a> [replicas](#input\_replicas) | Replicas to deploy | `number` | `1` | no |
| <a name="input_request_cpu"></a> [request\_cpu](#input\_request\_cpu) | CPU request. e.g. 0.5, 1, 2 | `string` | `"0.2"` | no |
| <a name="input_request_memory"></a> [request\_memory](#input\_request\_memory) | Memory request. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi | `string` | `"512Mi"` | no |
| <a name="input_request_cpu"></a> [request\_cpu](#input\_request\_cpu) | CPU request. e.g. 0.5, 1, 2 | `string` | `"0.1"` | no |
| <a name="input_request_memory"></a> [request\_memory](#input\_request\_memory) | Memory request. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi | `string` | `"128Mi"` | no |
| <a name="input_restart_policy"></a> [restart\_policy](#input\_restart\_policy) | Restart policy for all containers within the pod. One of Always, OnFailure, Never | `string` | `"Always"` | no |
| <a name="input_walrus_metadata_namespace_name"></a> [walrus\_metadata\_namespace\_name](#input\_walrus\_metadata\_namespace\_name) | Walrus metadata namespace name. | `string` | `""` | no |
| <a name="input_walrus_metadata_service_name"></a> [walrus\_metadata\_service\_name](#input\_walrus\_metadata\_service\_name) | Walrus metadata service name. | `string` | `""` | no |
......
......@@ -25,7 +25,7 @@ module "deployment" {
image = var.image
replicas = var.replicas
restart_policy = var.restart_policy
args = [var.args]
args = var.args
resources = {
request_cpu = var.request_cpu == "" ? null : var.request_cpu
limit_cpu = var.limit_cpu == "" ? null : var.limit_cpu
......@@ -62,13 +62,6 @@ module "deployment" {
#affinity: default=true
prevent_deploy_on_the_same_node = var.prevent_deploy_on_the_same_node
#RollingUpdate
rolling_update = [
{
"max_surge" = var.max_surge,
"max_unavailable" = var.max_unavailable
}
]
}
......@@ -93,24 +86,18 @@ module "service" {
}
module "ingress" {
count = var.ingress_switch.switch == "on" ? 1 : 0
source = "./modules/ingress/kubernetes"
ingress_name = local.name
service_namespace = local.namespace
service_name = local.name
# annotations = {
# "nginx.ingress.kubernetes.io/proxy-send-timeout" = "360"
# "nginx.ingress.kubernetes.io/proxy-read-timeout" = "360"
# }
annotations = var.ingress_switch.annotations
rule = [
annotations = var.annotations
rule = [
{
domain = var.ingress_switch.domain_name
domain = var.domain_name
external_port = var.ports[0] // Service port
path = var.ingress_switch.path
path_type = var.ingress_switch.path_type
path = var.path
path_type = var.path_type
}
]
......
......@@ -195,9 +195,8 @@ variable "rolling_update" {
variable "wait_for_rollout" {
default = true
}
variable "prevent_deploy_on_the_same_node" {
description = "Pod pod_anti_affinity rule, which prevents deploy same pod on one node."
type = bool
default = true
default = false
}
\ No newline at end of file
......@@ -2,6 +2,6 @@ terraform {
required_version = ">= 0.14.8"
required_providers {
kubernetes = "2.27.0"
kubernetes = ">= 2.1.0"
}
}
\ No newline at end of file
......@@ -10,7 +10,6 @@ resource "kubernetes_ingress_v1" "ingress" {
ingress_class_name = var.ingress_class_name
dynamic "rule" {
for_each = var.rule
content {
host = "${lookup(rule.value, "sub_domain", "")}${lookup(rule.value, "domain", var.domain_name)}"
......
......@@ -10,5 +10,5 @@ output "ports" {
output "ingress" {
description = "访问入口ingress"
value = try(var.ingress_switch.domain_name, "未配置域名")
value = var.domain_name
}
......@@ -7,8 +7,7 @@ components:
type: object
required:
- image
- name
- namespace
- ports
properties:
image:
title: Image
......@@ -17,33 +16,16 @@ components:
x-walrus-ui:
group: Basic
order: 1
namespace:
title: Namespace
type: string
description: Namespace to deploy. Auto-generated if empty.
x-walrus-ui:
group: Basic
order: 2
name:
title: Name
type: string
description: Name of the deployment resource. Auto-generated if empty.
x-walrus-ui:
group: Basic
order: 3
ports:
title: Ports
type: array
description: Service ports to expose
default:
- 6666
items:
type: number
nullable: true
x-walrus-ui:
colSpan: 12
group: Advanced
order: 4
group: Basic
order: 2
env:
title: Env
type: object
......@@ -54,8 +36,8 @@ components:
type: string
x-walrus-ui:
colSpan: 12
group: Advanced
order: 5
group: Basic
order: 3
replicas:
title: Replicas
type: number
......@@ -63,72 +45,61 @@ components:
default: 1
nullable: true
x-walrus-ui:
group: Advanced
order: 6
group: Basic
order: 4
request_cpu:
title: Request Cpu
type: string
description: CPU request. e.g. 0.5, 1, 2
default: ""
enum:
- 0.2
- 0.3
- 0.4
- 0.5
- 1
- 2
nullable: true
x-walrus-ui:
group: Resources
order: 7
group: Basic
order: 5
request_memory:
title: Request Memory
type: string
description: Memory request. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi
default: 512Mi
enum:
- 128Mi
- 512Mi
- 1Gi
- 2Gi
- 3Gi
- 4Gi
default: 128Mi
nullable: true
x-walrus-ui:
group: Resources
order: 8
group: Basic
order: 6
limit_cpu:
title: Limit Cpu
type: string
description: CPU limit. e.g. 0.5, 1, 2
default: ""
enum:
- 0.2
- 0.3
- 0.4
- 0.5
- 1
- 2
- 3
nullable: true
x-walrus-ui:
group: Resources
order: 9
group: Basic
order: 7
limit_memory:
title: Limit Memory
type: string
description: Memory limit. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi
default: 1Gi
enum:
- 128Mi
- 512Mi
- 1Gi
- 2Gi
- 3Gi
- 4Gi
default: 512Mi
nullable: true
x-walrus-ui:
group: Basic
order: 8
namespace:
title: Namespace
type: string
description: Namespace to deploy. Auto-generated if empty.
default: default
nullable: true
x-walrus-ui:
group: Basic
order: 9
name:
title: Name
type: string
description: Name of the deployment resource. Auto-generated if empty.
default: ""
nullable: true
x-walrus-ui:
group: Resources
group: Basic
order: 10
walrus_metadata_service_name:
title: Walrus Metadata Service Name
......@@ -138,7 +109,6 @@ components:
nullable: true
x-walrus-ui:
group: Basic
hidden: true
order: 11
walrus_metadata_namespace_name:
title: Walrus Metadata Namespace Name
......@@ -148,7 +118,6 @@ components:
nullable: true
x-walrus-ui:
group: Basic
hidden: true
order: 12
app_log_path_volume_name:
title: App Log Path Volume Name
......@@ -157,7 +126,7 @@ components:
default: app-log-path
nullable: true
x-walrus-ui:
group: Advanced
group: Basic
order: 13
app_log_path:
title: App Log Path
......@@ -165,7 +134,7 @@ components:
default: /data/java_log
nullable: true
x-walrus-ui:
group: Advanced
group: Basic
order: 14
restart_policy:
title: Restart Policy
......@@ -175,96 +144,48 @@ components:
default: Always
nullable: true
x-walrus-ui:
group: Advanced
group: Basic
order: 15
args:
title: Args
type: string
description: 属于那个环境,例子:dev,test,beta,release, gh_release, gh_beta, testcdp,
testscrm
type: array
description: 属于那个环境,例子:dev,test,beta,release
default:
- test
enum:
- dev
- test
- beta
- release
- gh_release
- gh_beta
- testcdp
- testscrm
items:
type: string
nullable: true
x-walrus-ui:
colSpan: 12
group: Advanced
group: Basic
order: 16
ingress_switch:
title: Ingress Switch
type: object
description: choise ingress switch
default:
annotations: {}
domain_name: null
path: /
path_type: ImplementationSpecific
switch: "off"
domain_name:
title: Domain Name
type: string
description: 域名
default: ""
nullable: true
properties:
annotations:
additionalProperties:
type: object
x-walrus-ui:
colSpan: 12
showIf: switch=on
nullable: true
title: Annotations
type: object
x-walrus-ui:
colSpan: 12
order: 5
showIf: switch=on
domain_name:
nullable: true
title: Domain Name
type: string
x-walrus-ui:
order: 4
showIf: switch=on
path:
default: /
nullable: true
title: Path
type: string
x-walrus-ui:
order: 3
showIf: switch=on
path_type:
default: ImplementationSpecific
enum:
- ImplementationSpecific
- Exact
- Prefix
nullable: true
title: Path Type
type: string
x-walrus-ui:
order: 2
showIf: switch=on
switch:
enum:
- "off"
- "on"
nullable: true
title: Switch
type: string
x-walrus-ui:
order: 1
x-walrus-ui:
colSpan: 12
group: Ingress
group: Basic
order: 17
path_type:
title: Path Type
type: string
description: Path type for ingress rule
default: ImplementationSpecific
nullable: true
x-walrus-ui:
group: Basic
order: 18
path:
title: Path
type: string
description: 访问路径
default: /
nullable: true
x-walrus-ui:
group: Basic
order: 19
hosts:
title: Hosts
type: array
......@@ -294,8 +215,17 @@ components:
nullable: true
x-walrus-ui:
colSpan: 12
group: Advanced
order: 18
group: Basic
order: 20
annotations:
title: Annotations
type: object
description: (Optional) Custom Annotations
nullable: true
x-walrus-ui:
colSpan: 12
group: Basic
order: 21
prevent_deploy_on_the_same_node:
title: Prevent Deploy On The Same Node
type: boolean
......@@ -304,31 +234,8 @@ components:
default: true
nullable: true
x-walrus-ui:
group: Advanced
order: 20
max_surge:
title: Max Surge
type: number
description: Rolling update config params. Present only if strategy_update
= RollingUpdate max_surge
default: 1
nullable: true
x-walrus-ui:
group: Advanced
order: 21
max_unavailable:
title: Max Unavailable
type: number
description: Rolling update config params. Present only if strategy_update
= RollingUpdate max_unavailable
default: 0
nullable: true
x-walrus-ui:
group: Advanced
group: Basic
order: 22
x-walrus-ui:
groupOrder:
- Basic
- Resourced
- Advanced
- Ingress
......@@ -4,27 +4,11 @@ variable "image" {
type = string
description = "Docker image name"
}
# @label "Namespace"
# @group "Basic"
variable "namespace" {
type = string
description = "Namespace to deploy. Auto-generated if empty."
}
# @label "Deployment Name"
# @group "Advanced"
variable "name" {
type = string
description = "Name of the deployment resource. Auto-generated if empty."
}
# @label "Ports"
# @group "Basic"
variable "ports" {
type = list(number)
description = "Service ports to expose"
default = [6666]
}
# @label "Environment Variables"
# @options ["dev", "test", "release", "beta"]
......@@ -55,7 +39,7 @@ variable "request_cpu" {
variable "request_memory" {
type = string
description = "Memory request. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi"
default = "512Mi"
default = "128Mi"
}
# @group "Resources"
# @options ["0.2","0.3", "0.5","1", "2"]
......@@ -71,10 +55,22 @@ variable "limit_cpu" {
variable "limit_memory" {
type = string
description = "Memory limit. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi"
default = "1G"
default = "512Mi"
}
# @label "Namespace"
# @group "Advanced"
variable "namespace" {
type = string
description = "Namespace to deploy. Auto-generated if empty."
default = "default"
}
# @label "Deployment Name"
# @group "Advanced"
variable "name" {
type = string
description = "Name of the deployment resource. Auto-generated if empty."
default = ""
}
# @hidden
variable "walrus_metadata_service_name" {
type = string
......@@ -117,58 +113,54 @@ variable "restart_policy" {
# @options ["dev", "test", "beta", "release"]
# @group "Advanced"
variable "args" {
type = string
type = list(string)
description = "属于那个环境,例子:dev,test,beta,release"
default = "test"
default = ["release"]
}
# @label "chiose ingress switch on or off"
# @options ["on", "off"]
# @group "Ingress"
variable "ingress_switch" {
type = object({
switch = optional(string)
path_type = optional(string)
path = optional(string)
domain_name = optional(string)
annotations = optional(map(any))
})
default = {
switch = "off"
path_type = "ImplementationSpecific"
path = "/"
domain_name = null
annotations = {}
}
description = "choise ingress switch"
# @label "域名名字"
# @group "ingress"
variable "domain_name" {
type = string
description = "域名"
default = ""
}
# @label "host aliases 手动配置域名到hosts"
# @group "Advanced"
# @label "path_type"
# @options ["ImplementationSpecific","Exact","Prefix"]
# @group "ingress"
variable "path_type" {
type = string
description = "Path type for ingress rule"
default = "ImplementationSpecific"
}
# @label "path"
# @group "ingress"
variable "path" {
type = string
description = "访问路径"
default = "/"
}
# @label "path"
# @group "advance"
variable "hosts" {
type = list(object({ hostname = list(string), ip = string }))
description = "(Optional) host aliases 手动配置域名到hosts"
description = "(Optional) Add /etc/hosts records to pods"
default = []
}
# @label "annotations"
# @group "advance"
variable "annotations" {
description = "(Optional) Custom Annotations"
default = null
}
# @label "affinity"
# @group "advance"
variable "prevent_deploy_on_the_same_node" {
description = "Pod pod_anti_affinity rule, which prevents deploy same pod on one node."
type = bool
default = false
}
# @label "max_surge"
# @group "advance"
variable "max_surge" {
description = "Rolling update config params. Present only if strategy_update = RollingUpdate max_surge"
default = 1
default = true
}
# @label "max_unavailable"
# @group "advance"
variable "max_unavailable" {
description = "Rolling update config params. Present only if strategy_update = RollingUpdate max_unavailable"
default = 0
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!