Skip to content

Commit

Permalink
Remove custom .kube config and add Garafana IP printout
Browse files Browse the repository at this point in the history
  • Loading branch information
zalbiraw committed Apr 23, 2024
1 parent 3d279c5 commit b0d047f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ jobs:
cd deployments
terraform init
terraform apply \
--var="kubernetes_config_path='../.kube/config'" \
--var="kubernetes_config_context=gke" \
--var="kubernetes_config_context=performance-testing-gke" \
--var="analytics_enabled=${{ inputs.analytics_enabled }}" \
--var="auth_enabled=${{ inputs.auth_enabled }}" \
--var="quota_enabled=${{ inputs.quota_enabled }}" \
Expand All @@ -97,8 +96,17 @@ jobs:
cd deployments
terraform init
terraform apply \
--var="kubernetes_config_path='../.kube/config'" \
--var="kubernetes_config_context=gke" \
--var="kubernetes_config_context=performance-testing-gke" \
--var="tests_timestamp_enabled=${{ inputs.tests_timestamp_enabled }}" \
--var="tests_httpbin_enabled=${{ inputs.tests_httpbin_enabled }}" \
--auto-approve
- name: Access to Grafana Dashboard
run: |
echo "###################################################################
echo "#
echo "# http://$(kubectl get svc -n dependencies grafana -ojsonpath='{.status.loadBalancer.ingress[0].ip}')"
echo "# Username: Admin"
echo "# Password: topsecretpassword"
echo "#
echo "###################################################################
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
**/.kube
**/.DS_Store
**/.terraform.lock.hcl
**/.terraform
Expand Down
3 changes: 1 addition & 2 deletions deployments/main.tfvars.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
kubernetes_config_path = "../.kube/config"
kubernetes_config_context = "gke"
kubernetes_config_context = "performance-testing-gke"

analytics_enabled = false
auth_enabled = false
Expand Down
6 changes: 2 additions & 4 deletions modules/clouds/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,11 @@ data "aws_eks_cluster_auth" "this" {
resource "null_resource" "kube_config" {
provisioner "local-exec" {
command = <<EOT
export KUBECONFIG=../.kube/config
[[ $(kubectl config get-contexts eks | wc -l) -eq 2 ]] && kubectl config delete-context eks
[[ $(kubectl config get-contexts performance-testing-eks | wc -l) -eq 2 ]] && kubectl config delete-context performance-testing-eks
aws eks --region ${var.cluster_location} update-kubeconfig --name ${module.eks.cluster_name}
kubectl config rename-context $(kubectl config current-context) eks
kubectl config rename-context $(kubectl config current-context) performance-testing-eks
EOT
}

Expand Down
9 changes: 4 additions & 5 deletions modules/clouds/azure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,13 @@ resource "azurerm_kubernetes_cluster_node_pool" "this" {
resource "null_resource" "kube_config" {
provisioner "local-exec" {
command = <<EOT
export KUBECONFIG=../.kube/config
[[ $(kubectl config get-contexts performance-testing-aks | wc -l) -eq 2 ]] && kubectl config delete-context performance-testing-aks
[[ $(kubectl config get-contexts aks | wc -l) -eq 2 ]] && kubectl config delete-context aks
az aks get-credentials --resource-group ${azurerm_resource_group.this.name} \
az aks get-credentials \
--resource-group ${azurerm_resource_group.this.name} \
--name ${azurerm_kubernetes_cluster.this.name}
kubectl config rename-context $(kubectl config current-context) aks
kubectl config rename-context $(kubectl config current-context) performance-testing-aks
EOT
}

Expand Down
6 changes: 2 additions & 4 deletions modules/clouds/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,13 @@ resource "google_container_node_pool" "this" {
resource "null_resource" "kube_config" {
provisioner "local-exec" {
command = <<EOT
export KUBECONFIG=../.kube/config
[[ $(kubectl config get-contexts gke | wc -l) -eq 2 ]] && kubectl config delete-context gke
[[ $(kubectl config get-contexts performance-testing-gke | wc -l) -eq 2 ]] && kubectl config delete-context performance-testing-gke
gcloud container clusters get-credentials ${google_container_cluster.this.name} \
--region ${google_container_cluster.this.location} \
--project ${google_container_cluster.this.project}
kubectl config rename-context $(kubectl config current-context) gke
kubectl config rename-context $(kubectl config current-context) performance-testing-gke
EOT
}

Expand Down
3 changes: 1 addition & 2 deletions tests/main.tfvars.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
kubernetes_config_path = "../.kube/config"
kubernetes_config_context = "gke"
kubernetes_config_context = "performance-testing-gke"

tyk_enabled = true
kong_enabled = false
Expand Down

0 comments on commit b0d047f

Please sign in to comment.