-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a core-infra stack to set up initial service contexts, and other …
…stuff This is generally nice to have, but also will ensure the management console has a service context, alongside the ones we put on the other clusters
- Loading branch information
1 parent
c4cb662
commit 5bc60b2
Showing
16 changed files
with
201 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: deployments.plural.sh/v1alpha1 | ||
kind: InfrastructureStack | ||
metadata: | ||
name: core-infra | ||
spec: | ||
name: core-infra | ||
detach: false | ||
type: TERRAFORM | ||
approval: true | ||
manageState: true | ||
actor: [email protected] | ||
repositoryRef: | ||
name: infra | ||
namespace: infra | ||
clusterRef: | ||
name: mgmt | ||
namespace: infra | ||
variables: | ||
region: [[ .Region ]] | ||
cluster_name: [[ .Cluster ]] | ||
git: | ||
ref: main | ||
folder: terraform/core-infra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# this can be used for provisioning any base infrastructure for your environment, a couple of common usecases: | ||
# * setting up multi-cluster networks | ||
# * setting up dns zones, subdomains, etc | ||
# * configuring Cloud IAM throughout your environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
data "aws_eks_cluster" "mgmt" { | ||
name = var.cluster_name | ||
} | ||
|
||
data "aws_vpc" "mgmt" { | ||
id = one(data.aws_eks_cluster.mgmt.vpc_config).vpc_id | ||
} | ||
|
||
resource "plural_service_context" "mgmt" { | ||
name = "plrl/clusters/mgmt" | ||
configuration = { | ||
cluster_name = var.cluster_name | ||
vpc_id = one(data.aws_eks_cluster.mgmt.vpc_config).vpc_id | ||
subnet_ids = one(data.aws_eks_cluster.mgmt.vpc_config).subnet_ids | ||
vpc_cidr = data.aws_vpc.mgmt.cidr_block | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
variable "region" { | ||
type = string | ||
default = "us-east-2" | ||
} | ||
|
||
variable "cluster_name" { | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
terraform { | ||
required_version = ">= 1.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
} | ||
|
||
plural = { | ||
source = "pluralsh/plural" | ||
version = ">= 0.2.9" | ||
} | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = var.region | ||
} | ||
|
||
|
||
provider "plural" { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# this can be used for provisioning any base infrastructure for your environment, a couple of common usecases: | ||
# * setting up multi-cluster networks | ||
# * setting up dns zones, subdomains, etc | ||
# * configuring Cloud IAM throughout your environment |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
variable "region" { | ||
type = string | ||
default = "us-east-2" | ||
} | ||
|
||
variable "cluster_name" { | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
terraform { | ||
required_version = ">= 1.0" | ||
|
||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
} | ||
kubernetes = { | ||
source = "hashicorp/kubernetes" | ||
version = ">= 2.10" | ||
} | ||
plural = { | ||
source = "pluralsh/plural" | ||
version = ">= 0.2.9" | ||
} | ||
local = { | ||
source = "hashicorp/local" | ||
} | ||
} | ||
} | ||
|
||
provider "google" { | ||
region = var.region | ||
} | ||
|
||
data "google_client_config" "default" {} | ||
|
||
provider "plural" { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# this can be used for provisioning any base infrastructure for your environment, a couple of common usecases: | ||
# * setting up multi-cluster networks | ||
# * setting up dns zones, subdomains, etc | ||
# * configuring Cloud IAM throughout your environment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
data "google_container_cluster" "mgmt" { | ||
name = var.cluster_name | ||
location = var.region | ||
} | ||
|
||
data "google_compute_network" "network" { | ||
name = data.google_container_cluster.mgmt.network | ||
} | ||
|
||
data "google_compute_subnetwork" "subnetwork" { | ||
name = data.google_container_cluster.mgmt.subnetwork | ||
} | ||
|
||
resource "plural_service_context" "mgmt" { | ||
name = "plrl/clusters/mgmt" | ||
configuration = { | ||
cluster_name = var.cluster_name | ||
network = data.google_container_cluster.mgmt.network | ||
subnetwork = data.google_container_cluster.mgmt.subnetwork | ||
cidr = data.google_compute_subnetwork.ip_cidr_range | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
variable "region" { | ||
type = string | ||
default = "us-east-2" | ||
} | ||
|
||
variable "cluster_name" { | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
terraform { | ||
required_version = ">= 1.0" | ||
|
||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
} | ||
kubernetes = { | ||
source = "hashicorp/kubernetes" | ||
version = ">= 2.10" | ||
} | ||
plural = { | ||
source = "pluralsh/plural" | ||
version = ">= 0.2.9" | ||
} | ||
local = { | ||
source = "hashicorp/local" | ||
} | ||
} | ||
} | ||
|
||
provider "google" { | ||
region = var.region | ||
} | ||
|
||
data "google_client_config" "default" {} | ||
|
||
provider "plural" { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
resource "plural_service_context" "mgmt" { | ||
name = "plrl/clusters/${var.cluster_name}" | ||
configuration = { | ||
cluster_name = var.cluster_name | ||
vpc_id = module.vpc.vpc_id | ||
subnet_ids = concat(module.vpc.public_subnets, module.vpc.private_subnets) | ||
private_subnets = module.vpc.private_subnets | ||
public_subnets = module.vpc.public_subnets | ||
vpc_cidr = var.vpc_cidr | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
resource "plural_service_context" "mgmt" { | ||
name = "plrl/clusters/${var.cluster_name}" | ||
|
||
configuration = { | ||
cluster_name = var.cluster_name | ||
network = module.gcp-network.network_name | ||
subnetwork = module.gcp-network.subnets_names[0] | ||
cidr = var.subnet_cidr | ||
} | ||
} |