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

[Blueprints, all, CI]: Kubeconfig file improvements #169

Merged
merged 4 commits into from
Jun 24, 2024
Merged
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
1 change: 1 addition & 0 deletions .cloudbees/workflows/bp-tf-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ env:
company = "CloudBees Inc."
}
suffix = "ci-v4"
ci = true

jobs:
init:
Expand Down
1 change: 1 addition & 0 deletions blueprints/01-getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ This blueprint presents the minimum setup to run CloudBees CI on Amazon EKS: One
|------|-------------|------|---------|:--------:|
| hosted_zone | Amazon Route 53 hosted zone. CloudBees CI applications are configured to use subdomains in this hosted zone. | `string` | n/a | yes |
| trial_license | CloudBees CI trial license details for evaluation. | `map(string)` | n/a | yes |
| ci | Running in a CI Service vs locally. False when running locally, true when running in a CI service | `bool` | `false` | no |
| suffix | Unique suffix to assign to all resources. | `string` | `""` | no |
| tags | Tags to apply to resources. | `map(string)` | `{}` | no |

Expand Down
8 changes: 3 additions & 5 deletions blueprints/01-getting-started/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,11 @@ resource "kubernetes_storage_class_v1" "gp3" {

}

resource "null_resource" "create_kubeconfig" {

# Kubeconfig
resource "terraform_data" "create_kubeconfig" {
depends_on = [module.eks]

triggers = {
always_run = timestamp()
}
triggers_replace = var.ci ? [timestamp()] : []

provisioner "local-exec" {
command = "aws eks update-kubeconfig --name ${module.eks.cluster_name} --region ${local.region} --kubeconfig ${local.kubeconfig_file_path}"
Expand Down
4 changes: 0 additions & 4 deletions blueprints/01-getting-started/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ terraform {
source = "hashicorp/helm"
version = ">= 2.5.1"
}
null = {
source = "hashicorp/null"
version = ">= 3.1.0"
}
}

}
Expand Down
6 changes: 6 additions & 0 deletions blueprints/01-getting-started/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ variable "suffix" {
error_message = "The suffix cannot contain more than 10 characters."
}
}

variable "ci" {
description = "Running in a CI Service vs locally. False when running locally, true when running in a CI service"
default = false
type = bool
}
1 change: 1 addition & 0 deletions blueprints/02-at-scale/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ This blueprint divides scalable Node Groups for different types of workloads:
|------|-------------|------|---------|:--------:|
| hosted_zone | Amazon Route 53 hosted zone. CloudBees CI applications are configured to use subdomains in this hosted zone. | `string` | n/a | yes |
| trial_license | CloudBees CI trial license details for evaluation. | `map(string)` | n/a | yes |
| ci | Running in a CI Service vs locally. False when running locally, true when running in a CI service, | `bool` | `false` | no |
| gh_token | GitHub token for the CloudBees operations center credential GH-User-token, that is created via CloudBees CasC. | `string` | `"ExampleToken1234"` | no |
| gh_user | GitHub user for the CloudBees operations center credential GH-User-token, that is created via CloudBees CasC. | `string` | `"exampleUser"` | no |
| suffix | Unique suffix to assign to all resources. When adding the suffix, changes are required in CloudBees CI for the validation phase. | `string` | `""` | no |
Expand Down
9 changes: 3 additions & 6 deletions blueprints/02-at-scale/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -643,14 +643,11 @@ resource "kubernetes_storage_class_v1" "efs" {
}

# Kubeconfig

resource "null_resource" "create_kubeconfig" {

resource "terraform_data" "create_kubeconfig" {
depends_on = [module.eks]

triggers = {
always_run = timestamp()
}
triggers_replace = var.ci ? [timestamp()] : []

provisioner "local-exec" {
command = "aws eks update-kubeconfig --name ${module.eks.cluster_name} --region ${local.region} --kubeconfig ${local.kubeconfig_file_path}"
}
Expand Down
5 changes: 0 additions & 5 deletions blueprints/02-at-scale/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ terraform {
version = ">= 0.7.1"
}

null = {
source = "hashicorp/null"
version = ">= 3.1.0"
}

random = {
source = "hashicorp/random"
version = ">= 3.6.1"
Expand Down
6 changes: 6 additions & 0 deletions blueprints/02-at-scale/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ variable "gh_token" {
default = "ExampleToken1234"
type = string
}

variable "ci" {
description = "Running in a CI Service vs locally. False when running locally, true when running in a CI service,"
default = false
type = bool
}
1 change: 0 additions & 1 deletion values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
Subdomain: true
OperationsCenter:
JavaOpts: >-
-Dcom.cloudbees.masterprovisioning.kubernetes.KubernetesMasterProvisioning.deleteClaim=true
-Duser.timezone=Etc/UTC
-XX:InitialRAMPercentage=50.0
-XX:MaxRAMPercentage=50.0
Expand Down