Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cert-manager addon #8

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions _examples/basic/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
locals {
name = "helm-addons-test"
environment = "test"
region = "us-central1"
cluster_version = "1.28.3-gke.1203001"
gcp_project_id = "dev-env-3b53"
cluster_name = "test-cluster"
tags = {
Name = local.name
Environment = local.environment
GithubRepo = "terraform-helm-gke-addons"
GithubOrg = "clouddrove"
}
}
192 changes: 188 additions & 4 deletions _examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,188 @@
# ------------------------------------------------------------------------------
# Resources
# ------------------------------------------------------------------------------
locals {}

provider "google" {
project = local.gcp_project_id
}

###############################################################################
# GCP NETWORKING RESOURCES
###############################################################################


module "vpc" {
source = "terraform-google-modules/network/google"
version = "~> 8.1"

project_id = local.gcp_project_id
network_name = "${local.name}-vpc"
routing_mode = "GLOBAL"

subnets = [
{
subnet_name = "${local.name}-subnet-public-1"
subnet_ip = "10.10.10.0/24"
subnet_region = "us-central1"
},
{
subnet_name = "${local.name}-subnet-private-1"
subnet_ip = "10.10.20.0/24"
subnet_region = "us-central1"
subnet_private_access = "true"
subnet_flow_logs = "true"
description = "This subnet has a description"
},
{
subnet_name = "${local.name}-subnet-private-2"
subnet_ip = "10.10.30.0/24"
subnet_region = "us-central1"
subnet_private_access = "true"
subnet_flow_logs = "true"
description = "This subnet has used for GKE"
}
]

secondary_ranges = {
subnet-public-1 = [
{
range_name = "${local.name}-subnet-private-1-secondary-01"
ip_cidr_range = "192.168.64.0/24"
},
]
}

routes = [
{
name = "egress-internet"
description = "route through IGW to access internet"
destination_range = "0.0.0.0/0"
tags = "egress-inet"
next_hop_internet = "true"
},
]
}

###############################################################################
# GCP GKE
###############################################################################

module "gke" {
source = "terraform-google-modules/kubernetes-engine/google//modules/beta-private-cluster"
# version = "29.0.0"
project_id = local.gcp_project_id
name = local.cluster_name
region = local.region
zones = []
network = module.vpc.network_name
subnetwork = "${local.name}-subnet-private-2"
ip_range_pods = ""
ip_range_services = ""
horizontal_pod_autoscaling = true
http_load_balancing = true
filestore_csi_driver = true
istio = true
create_service_account = true
remove_default_node_pool = true
disable_legacy_metadata_endpoints = false
deletion_protection = false

node_pools = [

{
name = "general-1"
machine_type = "g1-small"
node_locations = "${local.region}-a"
min_count = 1
max_count = 5
local_ssd_count = 0
spot = false
disk_size_gb = 10
disk_type = "pd-standard"
image_type = "ubuntu_containerd"
enable_gcfs = false
enable_gvnic = false
logging_variant = "DEFAULT"
auto_repair = true
auto_upgrade = true
create_service_account = true
preemptible = false
initial_node_count = 1
enable_node_pool_autoscaling = true
},
{
name = "general-2"
machine_type = "g1-small"
node_locations = "${local.region}-b"
min_count = 1
max_count = 3
local_ssd_count = 0
spot = false
disk_size_gb = 10
disk_type = "pd-standard"
image_type = "ubuntu_containerd"
enable_gcfs = false
enable_gvnic = false
logging_variant = "DEFAULT"
auto_repair = true
auto_upgrade = true
create_service_account = true
preemptible = false
initial_node_count = 1
enable_node_pool_autoscaling = false
},
]


node_pools_labels = {
all = {}

default-node-pool = {
default-node-pool = true
}
}

node_pools_metadata = {
all = {}

default-node-pool = {
node-pool-metadata-custom-value = "my-node-pool"
}
}

node_pools_taints = {
all = []

default-node-pool = [
{
key = "default-node-pool"
value = true
effect = "PREFER_NO_SCHEDULE"
},
]
}

node_pools_tags = {
all = []

default-node-pool = [
"default-node-pool",
]
}
}


###############################################################################
# GCP ADDONS
###############################################################################

module "addons" {
source = "../../"

depends_on = [module.gke]
gke_cluster_name = module.gke.name
project_id = local.gcp_project_id
environment = "test"

cluster_autoscaler = false
reloader = false
ingress-nginx = false
certification_manager = false
}
25 changes: 25 additions & 0 deletions _examples/basic/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Retrieve an access token as the Terraform runner
data "google_client_config" "provider" {}

data "google_container_cluster" "my_cluster" {
name = module.gke.name
location = "us-central1"
}

provider "kubernetes" {
host = "https://${data.google_container_cluster.my_cluster.endpoint}"
token = data.google_client_config.provider.access_token
cluster_ca_certificate = base64decode(
data.google_container_cluster.my_cluster.master_auth[0].cluster_ca_certificate,
)
}

provider "helm" {
kubernetes {
host = "https://${data.google_container_cluster.my_cluster.endpoint}"
token = data.google_client_config.provider.access_token
cluster_ca_certificate = base64decode(
data.google_container_cluster.my_cluster.master_auth[0].cluster_ca_certificate
)
}
}
Empty file added _examples/basic/version.tf
Empty file.
7 changes: 7 additions & 0 deletions _examples/complete/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
locals {
name = "dev-vpc"
cluster_name = "my-test-cluster"
region = "us-central1"
# secondary-range-name = "test"
project_id = "cloud-crew-404516"
}
Loading