First pass at setting up GCP deploy config as infrastructure
- Terraform config files to setup cluster, deployments and services - Adds only Searxng deployment and test service in this commit - Makefile to: - Build and push images - Run terraform with correct project configuration - Env file template to help setting .env file with project configs
This commit is contained in:
parent
d9ba36794a
commit
0fedaef537
5 changed files with 286 additions and 0 deletions
59
deploy/gcp/gke-cluster/main.tf
Normal file
59
deploy/gcp/gke-cluster/main.tf
Normal file
|
@ -0,0 +1,59 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
version = "5.28.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "project_id" {
|
||||
description = "The ID of the project in which resources will be deployed."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "name" {
|
||||
description = "The GKE Cluster name"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
description = "The GCP region to deploy to."
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "key_file" {
|
||||
description = "The path to the GCP service account key file."
|
||||
type = string
|
||||
}
|
||||
|
||||
provider "google" {
|
||||
credentials = file(var.key_file)
|
||||
project = var.project_id
|
||||
region = var.region
|
||||
}
|
||||
|
||||
resource "google_container_cluster" "cluster" {
|
||||
name = var.name
|
||||
location = var.region
|
||||
initial_node_count = 1
|
||||
remove_default_node_pool = true
|
||||
}
|
||||
|
||||
resource "google_container_node_pool" "primary_preemptible_nodes" {
|
||||
name = "${google_container_cluster.cluster.name}-node-pool"
|
||||
location = var.region
|
||||
cluster = google_container_cluster.cluster.name
|
||||
node_count = 1
|
||||
|
||||
node_config {
|
||||
machine_type = "n1-standard-4"
|
||||
disk_size_gb = 25
|
||||
spot = true
|
||||
oauth_scopes = [
|
||||
"https://www.googleapis.com/auth/devstorage.read_only",
|
||||
"https://www.googleapis.com/auth/logging.write",
|
||||
"https://www.googleapis.com/auth/monitoring",
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue