Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into sebastian/prod-2981-s…
Browse files Browse the repository at this point in the history
…et-up-catalog-pipeline
  • Loading branch information
floreks committed Dec 20, 2024
2 parents 6627f34 + a10d5be commit 8459dc5
Show file tree
Hide file tree
Showing 31 changed files with 82 additions and 39 deletions.
2 changes: 1 addition & 1 deletion resources/monitoring/services/agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
namespace: monitoring
git:
folder: helm/monitoring
ref: main
ref: [[ or .Context.Branch "main" ]]
configurationRef:
name: basic-auth-prom
namespace: infra
Expand Down
2 changes: 1 addition & 1 deletion resources/monitoring/services/mgmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
namespace: monitoring
git:
folder: helm/monitoring
ref: main
ref: [[ or .Context.Branch "main" ]]
configurationRef:
name: basic-auth-prom
namespace: infra
Expand Down
2 changes: 1 addition & 1 deletion resources/policy/services/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
namespace: policy
git:
folder: resources/policy/bundles/{{ context.bundle }}
ref: main
ref: [[ or .Context.Branch "main" ]]
repositoryRef:
kind: GitRepository
name: infra
Expand Down
2 changes: 1 addition & 1 deletion resources/policy/services/constraints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
namespace: policy
git:
folder: resources/policy/constraints
ref: main
ref: [[ or .Context.Branch "main" ]]
repositoryRef:
kind: GitRepository
name: infra
Expand Down
2 changes: 1 addition & 1 deletion setup/cert-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
namespace: cert-manager
git:
folder: helm-values
ref: main
ref: [[ or .Context.Branch "main" ]]
repositoryRef:
kind: GitRepository
name: infra
Expand Down
2 changes: 1 addition & 1 deletion setup/console.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
namespace: plrl-console
git:
folder: helm-values
ref: main
ref: [[ or .Context.Branch "main" ]]
repositoryRef:
kind: GitRepository
name: infra
Expand Down
2 changes: 1 addition & 1 deletion setup/flux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
namespace: flux
git:
folder: helm-values
ref: main
ref: [[ or .Context.Branch "main" ]]
repositoryRef:
kind: GitRepository
name: infra
Expand Down
4 changes: 4 additions & 0 deletions setup/pr-automation/cluster-creator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ spec:
title: "Adding {{ context.cloud }} cluster: {{ context.name }}"
message: "Adding {{ context.cloud }} cluster {{ context.name }} and registering it with Plural"
identifier: [[ .Identifier ]] # REPLACEME with your own repo slug
branch: [[ or .Context.Branch "main" ]]
configuration:
- name: name
type: STRING
Expand All @@ -42,3 +43,6 @@ spec:
values:
- dev
- prd
- name: branch
type: STRING
documentation: name for the current branch
1 change: 1 addition & 0 deletions setup/pr-automation/gatekeeper-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ spec:
title: "Setup OPA gatekeeper and install the {{ context.bundle }} policy bundle"
message: "Setup OPA gatekeeper and install the {{ context.bundle }} policy bundle"
identifier: [[ .Identifier ]] # REPLACEME with your own repo slug
branch: [[ or .Context.Branch "main" ]]
configuration:
- name: bundle
type: ENUM
Expand Down
1 change: 1 addition & 0 deletions setup/pr-automation/prometheus/prom-agent-creator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ spec:
title: "Setup prometheus agent for metrics shipping"
message: "Setup prometheus agent for metrics shipping"
identifier: [[ .Identifier ]] # REPLACEME with your own repo slug
branch: [[ or .Context.Branch "main" ]]
configuration:
- name: cluster
type: STRING
Expand Down
1 change: 1 addition & 0 deletions setup/pr-automation/prometheus/prom-creator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ spec:
title: "Setup a prometheus cluster for fleetwide metrics"
message: "Setup a prometheus cluster for fleetwide metrics in {{ context.cluster }}"
identifier: [[ .Identifier ]] # REPLACEME with your own repo slug
branch: [[ or .Context.Branch "main" ]]
configuration:
- name: cluster
type: STRING
Expand Down
2 changes: 1 addition & 1 deletion setup/runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
namespace: plural-runtime
git:
folder: helm-values
ref: main
ref: [[ or .Context.Branch "main" ]]
repositoryRef:
kind: GitRepository
name: infra
Expand Down
2 changes: 1 addition & 1 deletion templates/blob/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
namespace: infra
git:
folder: services/blobstores
ref: main
ref: {{ context.branch | default "main" }}
repositoryRef:
kind: GitRepository
name: infra
Expand Down
2 changes: 1 addition & 1 deletion templates/blob/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
name: mgmt
namespace: infra
git:
ref: main
ref: {{ context.branch | default "main" }}
folder: terraform/modules/blob/{{ context.type }}
variables:
region: {{ context.region }}
Expand Down
2 changes: 1 addition & 1 deletion templates/clusters/clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
namespace: infra
git:
folder: services/clusters
ref: main
ref: {{ context.branch | default "main" }}
repositoryRef:
kind: GitRepository
name: infra
Expand Down
2 changes: 1 addition & 1 deletion templates/clusters/stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
name: mgmt
namespace: infra
git:
ref: main
ref: {{ context.branch | default "main" }}
folder: terraform/modules/clusters/{{ context.cloud }}
environment:
- name: TF_VAR_cluster
Expand Down
3 changes: 2 additions & 1 deletion templates/providers/apps/gcp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 6.10.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down Expand Up @@ -44,4 +45,4 @@ data "kubernetes_secret" "console-auth" {
provider "plural" {
console_url = "https://console.{{ .Subdomain }}"
access_token = data.kubernetes_secret.console-auth.data.access-token
}
}
3 changes: 2 additions & 1 deletion templates/providers/bootstrap/gcp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 6.10.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down Expand Up @@ -44,4 +45,4 @@ provider "helm" {

provider "plural" {
use_cli = true # If you want to have a Plural stack manage your console, comment this out and use the `actor` field
}
}
10 changes: 8 additions & 2 deletions templates/setup/cd.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
locals {
context = yamldecode(data.local_sensitive_file.context.content)
workspace = yamldecode(data.local_sensitive_file.workspace.content)
branch = local.workspace.spec.context.Branch == null ? "main" : local.workspace.spec.context.Branch
}

data "local_sensitive_file" "context" {
filename = "${path.module}/../../context.yaml"
}

data "local_sensitive_file" "workspace" {
filename = "${path.module}/../../workspace.yaml"
}

data "plural_cluster" "mgmt" {
handle = "mgmt"
}
Expand All @@ -21,7 +27,7 @@ resource "plural_service_deployment" "apps" {
namespace = "infra"
repository = {
id = plural_git_repository.infra.id
ref = "main"
ref = local.branch
folder = "bootstrap"
}
cluster = {
Expand All @@ -30,4 +36,4 @@ resource "plural_service_deployment" "apps" {

protect = true
templated = true
}
}
4 changes: 2 additions & 2 deletions templates/setup/console.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ resource "helm_release" "console" {
namespace = "plrl-console"
chart = "console"
repository = "https://pluralsh.github.io/console"
version = "0.3.49"
version = "0.3.68"
create_namespace = true
timeout = 600
wait = true
Expand All @@ -89,4 +89,4 @@ resource "helm_release" "console" {

output "identity" {
value = module.mgmt.identity
}
}
9 changes: 8 additions & 1 deletion templates/setup/providers/aws.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
variable "deletion_protection" {
type = bool
default = true
}

module "mgmt" {
source = "./cluster"
cluster_name = "{{ .Cluster }}"
create_db = {{ .RequireDB }}
}
deletion_protection = "${var.deletion_protection}"
}

18 changes: 17 additions & 1 deletion templates/setup/providers/gcp.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
# Variable passthrough to the GCP module in order
# to enable TF_VAR_xxx environment variable usage.
variable "network" {
type = string
description = "The VPC network created to host the cluster in"
default = "plural-network"
}

variable "subnetwork" {
type = string
description = "The subnetwork created to host the cluster in"
default = "plural-subnet"
}

module "mgmt" {
source = "./cluster"
project_id = "{{ .Project }}"
cluster_name = "{{ .Cluster }}"
region = "{{ .Region }}"
create_db = {{ .RequireDB }}
}
network = "${var.network}"
subnetwork = "${var.subnetwork}"
}
2 changes: 1 addition & 1 deletion terraform/clouds/azure/aks.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "aks" {
source = "Azure/aks/azurerm"
version = "7.5.0"
version = "9.2.0"

kubernetes_version = var.kubernetes_version
cluster_name = var.cluster_name
Expand Down
10 changes: 10 additions & 0 deletions terraform/clouds/azure/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">=1.3"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.51.0, < 4.0"
}
}
}
4 changes: 2 additions & 2 deletions terraform/clouds/gcp/gke.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "gke" {
source = "terraform-google-modules/kubernetes-engine/google"
version = "~> 29.0"
version = "~> 33.0"

kubernetes_version = var.kubernetes_version
project_id = var.project_id
Expand Down Expand Up @@ -29,4 +29,4 @@ module "gke" {
google_project_service.dns,
# local.db_created,
]
}
}
4 changes: 2 additions & 2 deletions terraform/clouds/gcp/postgres.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "random_password" "password" {
module "pg" {
count = var.create_db ? 1 : 0
source = "GoogleCloudPlatform/sql-db/google//modules/postgresql"
version = "18.2.0"
version = "~> 22.0"

name = local.db_name
random_instance_name = false
Expand Down Expand Up @@ -63,4 +63,4 @@ module "pg" {
google_project_service.servicenetworking,
google_service_networking_connection.postgres
]
}
}
4 changes: 2 additions & 2 deletions terraform/modules/clusters/gcp/gke.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "gke" {
source = "terraform-google-modules/kubernetes-engine/google"
version = "~> 29.0"
version = "~> 33.0"

kubernetes_version = var.kubernetes_version
project_id = var.project_id
Expand Down Expand Up @@ -29,4 +29,4 @@ module "gke" {
google_project_service.dns,
# local.db_created,
]
}
}
4 changes: 1 addition & 3 deletions terraform/modules/clusters/gcp/plural.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
data "google_client_config" "default" {}

resource "plural_cluster" "this" {
handle = var.cluster
name = var.cluster
Expand All @@ -17,4 +15,4 @@ resource "plural_cluster" "this" {
}

depends_on = [ module.gcp-network ]
}
}
9 changes: 2 additions & 7 deletions terraform/modules/clusters/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ variable "tier" {

variable "region" {
type = string
description = "The region to host the cluster in"
default = "us-east-2"
}

Expand Down Expand Up @@ -46,12 +47,6 @@ variable "project_id" {
default = "pluralsh-test-384515"
}

variable "region" {
type = string
description = "The region to host the cluster in"
default = "us-central1"
}

variable "network" {
type = string
description = "The VPC network created to host the cluster in"
Expand Down Expand Up @@ -99,4 +94,4 @@ variable "ip_range_services_name" {
variable "tags" {
type = map(string)
default = {}
}
}
3 changes: 2 additions & 1 deletion terraform/modules/clusters/gcp/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 6.10.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand All @@ -25,4 +26,4 @@ provider "google" {

data "google_client_config" "default" {}

provider "plural" { }
provider "plural" { }
Loading

0 comments on commit 8459dc5

Please sign in to comment.