Commit e5180777 by chenxx

init

0 parents
.idea
.terraform
*.tfstate
*.tfstate.backup
*.tfstate.lock.info
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
module "deploy" {
source = "../"
name = var.app_name
namespace = var.app_namespace
image = var.image
internal_port = var.ports
volume_nfs = [
{
path_on_nfs = "/"
nfs_endpoint = "10.10.0.100"
volume_name = var.volume_data
}
]
volume_host_path = [
{
volume_name = var.volume_logs
path_on_node = "/var/log"
},
{
volume_name = var.volume_tmp
path_on_node = "/tmp"
}
]
volume_mount = [
{
mount_path = "/var/jenkins_home"
sub_path = "jenkins"
volume_name = var.volume_data
},
{
mount_path = "/logs"
volume_name = var.volume_logs
},
{
mount_path = "/tmps"
volume_name = var.volume_tmp
},
{
mount_path = "/var/jenkins_home/config.conf"
volume_name = var.volume_config
sub_path = "key1" // Key from configmap
}
]
volume_config_map = [
{
mode = "0777" // Must be a value between 0 and 0777. Defaults to 0644
name = "config-jenkins" // Config map name
volume_name = var.volume_config
}
]
readiness_probe = {
http_get = {
path = "/healthcheck"
port = 80
scheme = "HTTP"
http_header = [
{
name = "test"
value = "test"
},
{
name = "tes"
value = "asd"
}
]
}
success_threshold = 1
failure_threshold = 3
initial_delay_seconds = 10
period_seconds = 30
timeout_seconds = 3
}
}
\ No newline at end of file
variable "app_name" {
default = "jenkins"
}
variable "app_namespace" {
default = "jenkins-ci"
}
variable "image" {
default = "jenkins/jenkins:latest"
}
variable "ports" {
default = [
{
name = "web-access"
internal_port = "8080"
}
]
}
variable "volume_data" {
default = "data"
}
variable "volume_logs" {
default = "logs-from-node"
}
variable "volume_tmp" {
default = "tmp-from-node"
}
variable "volume_config" {
default = "jenkins-configmap"
}
\ No newline at end of file
locals {
labels = var.custom_labels == null ? { app = var.name } : var.custom_labels
env = flatten([
for name, value in var.env : {
name = tostring(name)
value = tostring(value)
}
])
env_field = flatten([
for name, field_path in var.env_field : {
name = tostring(name)
field_path = tostring(field_path)
}
])
env_secret = flatten([
for name, secret in var.env_secret : {
name = tostring(name)
secret_key = try(tostring(secret["key"]), name)
secret_name = try(tostring(secret["name"]), secret)
}
])
}
\ No newline at end of file
This diff is collapsed. Click to expand it.
output "name" {
value = var.name
}
output "namespace" {
value = var.namespace
}
\ No newline at end of file
This diff is collapsed. Click to expand it.
terraform {
required_version = ">= 0.14.8"
required_providers {
kubernetes = ">= 2.1.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!