Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
terraform_module
/
scrm_standard_template
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c9a6154a
authored
Jan 19, 2024
by
chenxx
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
update
1 parent
805c969e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
328 additions
and
49 deletions
README.md
main.tf
outputs.tf
schema.yaml
variables.tf
README.md
View file @
c9a6154
...
@@ -31,16 +31,15 @@
...
@@ -31,16 +31,15 @@
|
<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"
></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_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 |
`list(string)`
|
<pre>
[
<br> "release"<br>
]
</pre>
| 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_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) Add /etc/hosts records to pods |
`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_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`
|
`"0.5"`
| 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_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_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`
|
`"default"`
| no |
|
<a
name=
"input_namespace"
></a>
[
namespace
](
#input\_namespace
)
| Namespace to deploy. Auto-generated if empty. |
`string`
| n/a | yes |
|
<a
name=
"input_path"
></a>
[
path
](
#input\_path
)
| 访问路径 |
`string`
|
`"/"`
| no |
|
<a
name=
"input_ports"
></a>
[
ports
](
#input\_ports
)
| Service ports to expose |
`list(number)`
|
<pre>
[
<br> "6666"<br>
]
</pre>
| 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_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.1"`
| 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_request_memory"
></a>
[
request\_memory
](
#input\_request\_memory
)
| Memory request. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi |
`string`
|
`"128Mi"`
| no |
...
...
main.tf
View file @
c9a6154
...
@@ -50,6 +50,9 @@ module "deployment" {
...
@@ -50,6 +50,9 @@ module "deployment" {
}
}
]
]
#domian map
host_aliases = var.hosts
}
}
...
@@ -74,6 +77,7 @@ module "service" {
...
@@ -74,6 +77,7 @@ module "service" {
}
}
module "ingress" {
module "ingress" {
count = var.ingress_switch.switch == "on" ? 1 : 0
source = "./modules/ingress/kubernetes"
source = "./modules/ingress/kubernetes"
ingress_name = local.name
ingress_name = local.name
...
@@ -82,10 +86,10 @@ module "ingress" {
...
@@ -82,10 +86,10 @@ module "ingress" {
rule = [
rule = [
{
{
domain = var.domain_name
domain = var.
ingress_switch.
domain_name
external_port = var.ports[0] // Service port
external_port = var.ports[0] // Service port
path = var.path
path = var.
ingress_switch.
path
path_type = var.path_type
path_type = var.
ingress_switch.
path_type
}
}
]
]
...
...
outputs.tf
View file @
c9a6154
...
@@ -10,5 +10,5 @@ output "ports" {
...
@@ -10,5 +10,5 @@ output "ports" {
output "ingress" {
output "ingress" {
description = "访问入口ingress"
description = "访问入口ingress"
value =
var.domain_name
value =
try(var.ingress_switch.domain_name, "未配置域名")
}
}
schema.yaml
0 → 100644
View file @
c9a6154
openapi
:
3.0.3
info
:
title
:
OpenAPI schema for template .
components
:
schemas
:
variables
:
type
:
object
required
:
-
image
-
name
-
namespace
-
args
properties
:
image
:
title
:
Image
type
:
string
description
:
Docker image name
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
:
Basic
order
:
4
env
:
title
:
Env
type
:
object
description
:
Name and value pairs to set as the environment variables
default
:
{}
nullable
:
true
additionalProperties
:
type
:
string
x-walrus-ui
:
colSpan
:
12
group
:
Basic
order
:
5
replicas
:
title
:
Replicas
type
:
number
description
:
Replicas to deploy
default
:
1
nullable
:
true
x-walrus-ui
:
group
:
Basic
order
:
6
request_cpu
:
title
:
Request Cpu
type
:
string
description
:
CPU request. e.g. 0.5, 1, 2
default
:
"
0.3"
enum
:
-
0.2
-
0.3
-
0.4
-
0.5
-
1
-
2
nullable
:
true
x-walrus-ui
:
group
:
Resources
order
:
7
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
nullable
:
true
x-walrus-ui
:
group
:
Resources
order
:
8
limit_cpu
:
title
:
Limit Cpu
type
:
string
description
:
CPU limit. e.g. 0.5, 1, 2
default
:
"
0.5"
enum
:
-
0.2
-
0.3
-
0.4
-
0.5
-
1
-
2
-
3
nullable
:
true
x-walrus-ui
:
group
:
Resources
order
:
9
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
nullable
:
true
x-walrus-ui
:
group
:
Resources
order
:
10
walrus_metadata_service_name
:
title
:
Walrus Metadata Service Name
type
:
string
description
:
Walrus metadata service name.
default
:
"
"
nullable
:
true
x-walrus-ui
:
group
:
Basic
hidden
:
true
order
:
11
walrus_metadata_namespace_name
:
title
:
Walrus Metadata Namespace Name
type
:
string
description
:
Walrus metadata namespace name.
default
:
"
"
nullable
:
true
x-walrus-ui
:
group
:
Basic
hidden
:
true
order
:
12
app_log_path_volume_name
:
title
:
App Log Path Volume Name
type
:
string
description
:
'
应用日志挂载卷名,名字只能使用-,例:
abc-22
abc-cc'
default
:
app-log-path
nullable
:
true
x-walrus-ui
:
group
:
Advanced
order
:
13
app_log_path
:
title
:
App Log Path
type
:
string
default
:
/data/java_log
nullable
:
true
x-walrus-ui
:
group
:
Advanced
order
:
14
restart_policy
:
title
:
Restart Policy
type
:
string
description
:
Restart policy for all containers within the pod. One of Always,
OnFailure, Never
default
:
Always
nullable
:
true
x-walrus-ui
:
group
:
Advanced
order
:
15
args
:
title
:
Args
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
:
Basic
order
:
16
ingress_switch
:
title
:
Ingress Switch
type
:
object
description
:
choise ingress switch
default
:
domain_name
:
null
path
:
/
path_type
:
ImplementationSpecific
switch
:
"
off"
nullable
:
true
properties
:
domain_name
:
nullable
:
true
title
:
Domain Name
type
:
string
x-walrus-ui
:
order
:
4
path
:
nullable
:
true
title
:
Path
type
:
string
x-walrus-ui
:
order
:
3
path_type
:
nullable
:
true
title
:
Path Type
type
:
string
x-walrus-ui
:
order
:
2
switch
:
nullable
:
true
title
:
Switch
type
:
string
x-walrus-ui
:
order
:
1
x-walrus-ui
:
colSpan
:
12
group
:
Ingress
order
:
17
hosts
:
title
:
Hosts
type
:
array
description
:
(Optional) Add /etc/hosts records to pods
default
:
[]
items
:
properties
:
hostname
:
items
:
type
:
string
title
:
Hostname
type
:
array
x-walrus-ui
:
colSpan
:
12
order
:
1
ip
:
title
:
Ip
type
:
string
x-walrus-ui
:
order
:
2
required
:
-
hostname
-
ip
type
:
object
x-walrus-ui
:
colSpan
:
12
nullable
:
true
x-walrus-ui
:
colSpan
:
12
group
:
Advanced
order
:
18
x-walrus-ui
:
groupOrder
:
-
Basic
-
Resourced
-
Advanced
-
Ingress
variables.tf
View file @
c9a6154
...
@@ -4,11 +4,27 @@ variable "image" {
...
@@ -4,11 +4,27 @@ variable "image" {
type = string
type = string
description = "Docker image name"
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"
# @label "Ports"
# @group "Basic"
# @group "Basic"
variable "ports" {
variable "ports" {
type = list(number)
type = list(number)
description = "Service ports to expose"
description = "Service ports to expose"
default = ["6666"]
}
}
# @label "Environment Variables"
# @label "Environment Variables"
# @options ["dev", "test", "release", "beta"]
# @options ["dev", "test", "release", "beta"]
...
@@ -57,20 +73,8 @@ variable "limit_memory" {
...
@@ -57,20 +73,8 @@ variable "limit_memory" {
description = "Memory limit. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi"
description = "Memory limit. e.g. 128Mi, 512Mi, 1Gi, 2Gi, 4Gi"
default = "512Mi"
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
# @hidden
variable "walrus_metadata_service_name" {
variable "walrus_metadata_service_name" {
type = string
type = string
...
@@ -85,7 +89,6 @@ variable "walrus_metadata_namespace_name" {
...
@@ -85,7 +89,6 @@ variable "walrus_metadata_namespace_name" {
}
}
# @label "应用日志挂载卷名"
# @label "应用日志挂载卷名"
# @group "Advanced"
# @group "Advanced"
variable "app_log_path_volume_name" {
variable "app_log_path_volume_name" {
...
@@ -119,32 +122,27 @@ variable "args" {
...
@@ -119,32 +122,27 @@ variable "args" {
default = ["release"]
default = ["release"]
}
}
# @label "域名名字"
# @label "chiose ingress switch on or off"
# @group "ingress"
# @options ["on", "off"]
variable "domain_name" {
# @group "Ingress"
type = string
variable "ingress_switch" {
description = "域名"
type = object({
default = ""
switch = optional(string)
path_type = optional(string)
path = optional(string)
domain_name = optional(string)
})
default = {
switch = "off"
path_type = "ImplementationSpecific"
path = "/"
domain_name = null
}
description = "choise ingress switch"
}
}
# @label "path_type"
# @label "host aliases 手动配置域名到hosts"
# @options ["ImplementationSpecific","Exact","Prefix"]
# @group "Advanced"
# @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" {
variable "hosts" {
type = list(object({ hostname = list(string), ip = string }))
type = list(object({ hostname = list(string), ip = string }))
description = "(Optional) Add /etc/hosts records to pods"
description = "(Optional) Add /etc/hosts records to pods"
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment