Skip to content

Commit

Permalink
temporary disable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Trojan295 committed Sep 23, 2024
1 parent b46d150 commit 570d909
Show file tree
Hide file tree
Showing 11 changed files with 3,515 additions and 65 deletions.
1 change: 0 additions & 1 deletion cmd/proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/metadata"

"cloud-proxy/internal/cloud/gcp"
"cloud-proxy/internal/cloud/gcp/gcpauth"
Expand Down
141 changes: 141 additions & 0 deletions hack/terraform2/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions hack/terraform2/castai.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
data "google_client_config" "default" {}

provider "castai" {
api_url = var.castai_api_url
api_token = var.castai_api_token
}

provider "helm" {
kubernetes {
host = "https://${module.gke.endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(module.gke.ca_certificate)
}
}

# Configure GKE cluster connection using CAST AI gke-cluster module.
module "castai-gke-iam" {
source = "castai/gke-iam/castai"

project_id = var.project_id
gke_cluster_name = var.cluster_name
}

module "castai-gke-cluster" {
source = "castai/gke-cluster/castai"

api_url = var.castai_api_url
castai_api_token = var.castai_api_token
grpc_url = var.castai_grpc_url
wait_for_cluster_ready = true

project_id = var.project_id
gke_cluster_name = var.cluster_name
gke_cluster_location = module.gke.location

gke_credentials = module.castai-gke-iam.private_key
default_node_configuration_name = "default"

node_configurations = {
default = {
disk_cpu_ratio = 25
subnets = [module.vpc.subnets_ids[0]]
}
}

node_templates = {
default_by_castai = {
name = "default-by-castai"
configuration_name = "default"
is_default = true
is_enabled = true
should_taint = false

constraints = {
on_demand = true
spot = true
use_spot_fallbacks = true

enable_spot_diversity = false
spot_diversity_price_increase_limit_percent = 20
}
}
}

depends_on = [module.gke, module.castai-gke-iam]
}

42 changes: 42 additions & 0 deletions hack/terraform2/cloud-proxy.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#resource "google_project_iam_binding" "cloud_proxy_workload_identity_castai" {
# project = var.project_id
# role = "projects/engineering-test-353509/roles/castai.gkeAccess"
# members = [
# "serviceAccount:${var.project_id}.svc.id.goog[castai-agent/castai-cloud-proxy]"
# ]
#}
#
#resource "google_project_iam_binding" "cloud_proxy_workload_identity_service_account" {
# project = var.project_id
# role = "roles/iam.serviceAccountUser"
# members = [
# "serviceAccount:${var.project_id}.svc.id.goog[castai-agent/castai-cloud-proxy]"
# ]
#}

resource "helm_release" "castai_cloud_proxy" {
name = "castai-cloud-proxy"
repository = "https://castai.github.io/helm-charts"
chart = "castai-cloud-proxy"
namespace = "castai-agent"
create_namespace = true
cleanup_on_fail = true
wait = true

set {
name = "castai.clusterID"
value = module.castai-gke-cluster.cluster_id
}

set_sensitive {
name = "castai.apiKey"
value = var.castai_api_token
}

set {
name = "castai.grpcURL"
value = var.castai_grpc_url
}

depends_on = [module.castai-gke-cluster]
}
34 changes: 34 additions & 0 deletions hack/terraform2/gke.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module "gke" {
source = "terraform-google-modules/kubernetes-engine/google"
version = "24.1.0"
project_id = var.project_id
name = var.cluster_name
region = var.cluster_region
//zones = var.cluster_zones
network = module.vpc.network_name
subnetwork = module.vpc.subnets_names[0]
ip_range_pods = local.ip_range_pods
ip_range_services = local.ip_range_services
http_load_balancing = false
network_policy = false
horizontal_pod_autoscaling = true
filestore_csi_driver = false

node_pools = [
{
name = "default-node-pool"
machine_type = "e2-standard-2"
min_count = 1
max_count = 1
local_ssd_count = 0
disk_size_gb = 100
disk_type = "pd-standard"
image_type = "COS_CONTAINERD"
auto_repair = true
auto_upgrade = true
preemptible = false
initial_node_count = 1 # has to be >=2 to successfully deploy CAST AI controller
}
]
}

Loading

0 comments on commit 570d909

Please sign in to comment.