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

docs(deploy): switching cluster context #1278

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

deer-wmde
Copy link
Contributor

This PR adjusts the docs: Switching cluster contexts used to be not needed in order to deploy changes, but nowadays it is.

Copy link
Contributor

@dati18 dati18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

necessary change!

@m90
Copy link
Member

m90 commented Nov 21, 2023

but nowadays it is

Is it? I am under the impression it's not necessary for me right now, and I also can still run make diff and get diffs for both staging and production.

@deer-wmde
Copy link
Contributor Author

but nowadays it is

Is it? I am under the impression it's not necessary for me right now, and I also can still run make diff and get diffs for both staging and production.

I'm pretty sure it is required sometimes, but I'm not clear what the edge cases are. Maybe we can observe and clarify in the docs

@deer-wmde
Copy link
Contributor Author

Ran into it again, here's a messy partial CLI log that shows the problem: In this case helmfile fails when comparing prometheus-operator.yaml unless I switch the context

0 12:55 » deer@wmde102295 ~/wbaas/deploy (main) (minikube-wbaas)
 $ make diff-staging
cd ./tf/env/staging && terraform plan
random_password.redis-password: Refreshing state... [id=none]
..................
module.staging-buckets.data.google_iam_policy.transfer_job: Read complete after 0s [id=1171907850]
module.staging-buckets.google_storage_bucket_iam_policy.policy: Refreshing state... [id=b/wikibase-dev-static-backup]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
cd ./k8s/helmfile && helmfile --environment staging diff --context 5
Adding repo jetstack https://charts.jetstack.io
"jetstack" has been added to your repositories

Comparing release=cert-manager, chart=jetstack/cert-manager
Comparing release=prometheus-operator-crds, chart=prometheus-community/prometheus-operator-crds
in ./helmfile.yaml: in .helmfiles[1]: in ./prometheus-operator.yaml: command "/home/deer/.asdf/shims/helm" exited with non-zero status:

PATH:
  /home/deer/.asdf/shims/helm

ARGS:
  0: helm (4 bytes)
  1: diff (4 bytes)
  2: upgrade (7 bytes)
  3: --allow-unreleased (18 bytes)
  4: prometheus-operator-crds (24 bytes)
  5: prometheus-community/prometheus-operator-crds (45 bytes)
  6: --version (9 bytes)
  7: 2.0.0 (5 bytes)
  8: --namespace (11 bytes)
  9: monitoring (10 bytes)
  10: --color (7 bytes)
  11: --context (9 bytes)
  12: 5 (1 bytes)
  13: --reset-values (14 bytes)

ERROR:
  exit status 1

EXIT STATUS
  1

STDERR:
  Error: Failed to get release prometheus-operator-crds in namespace monitoring: exit status 1: Error: Kubernetes cluster unreachable: Get "https://192.168.49.2:8443/version": dial tcp 192.168.49.2:8443: connect: no route to host
  Error: plugin "diff" exited with error

COMBINED OUTPUT:
  Error: Failed to get release prometheus-operator-crds in namespace monitoring: exit status 1: Error: Kubernetes cluster unreachable: Get "https://192.168.49.2:8443/version": dial tcp 192.168.49.2:8443: connect: no route to host
  Error: plugin "diff" exited with error
make: *** [Makefile:78: diff-staging] Error 1
2 12:56 » deer@wmde102295 ~/wbaas/deploy (main) (minikube-wbaas)
 $ kubectl config use-context gke_wikibase-cloud_europe-west3-a_wbaas-2
Switched to context "gke_wikibase-cloud_europe-west3-a_wbaas-2".
0 12:56 » deer@wmde102295 ~/wbaas/deploy (main) (gke_wikibase-cloud_europe-west3-a_wbaas-2)
 $ make diff-staging
cd ./tf/env/staging && terraform plan
tls_private_key.api-passport: Refreshing state... [id=6422cd9b5c2f8ea8b276d02d1dd8d38b53220af9]
random_password.api-app-jwt-secret: Refreshing state... [id=none]
............................
module.wbaas2-k8s-secrets.kubernetes_secret.sql-secrets-passwords["api-jobs"]: Refreshing state... [id=api-jobs/sql-secrets-passwords]
module.staging-buckets.google_storage_bucket_iam_policy.policy: Refreshing state... [id=b/wikibase-dev-static-backup]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
cd ./k8s/helmfile && helmfile --environment staging diff --context 5
Adding repo jetstack https://charts.jetstack.io
"jetstack" has been added to your repositories

Comparing release=cert-manager, chart=jetstack/cert-manager
Comparing release=prometheus-operator-crds, chart=prometheus-community/prometheus-operator-crds
Comparing release=istio-base, chart=istio/base
Adding repo wbstack https://wbstack.github.io/charts
"wbstack" has been added to your repositories

Adding repo bitnami https://charts.bitnami.com/bitnami
"bitnami" has been added to your repositories

Adding repo bitnami-legacy https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
"bitnami-legacy" has been added to your repositories

Adding repo cetic https://cetic.github.io/helm-charts
"cetic" has been added to your repositories

Adding repo elastic https://helm.elastic.co
"elastic" has been added to your repositories

Adding repo codecentric https://codecentric.github.io/helm-charts
"codecentric" has been added to your repositories

Adding repo ingress-nginx https://kubernetes.github.io/ingress-nginx
"ingress-nginx" has been added to your repositories

Adding repo prometheus-community https://prometheus-community.github.io/helm-charts
"prometheus-community" has been added to your repositories

Adding repo istio https://istio-release.storage.googleapis.com/charts
"istio" has been added to your repositories

Adding repo minio https://charts.min.io
"minio" has been added to your repositories

Building dependency release=clusterissuers, chart=../../charts/wikibase-cloud-clusterissuers
Building dependency release=certificates, chart=../../charts/certificates
Building dependency release=istio-service-mesh, chart=../../charts/istio-service-mesh
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "minio" chart repository
...Successfully got an update from the "ingress-nginx" chart repository
...Successfully got an update from the "codecentric" chart repository
...Successfully got an update from the "wbstack" chart repository
...Successfully got an update from the "elastic" chart repository
...Successfully got an update from the "cetic" chart repository
...Successfully got an update from the "jetstack" chart repository
...Successfully got an update from the "istio" chart repository
...Successfully got an update from the "prometheus-community" chart repository
...Successfully got an update from the "argo-cd" chart repository
...Successfully got an update from the "bitnami-legacy" chart repository
...Successfully got an update from the "bitnami" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 1 charts
Downloading istiod from repo https://istio-release.storage.googleapis.com/charts
Deleting outdated charts

Comparing release=clusterissuers, chart=../../charts/wikibase-cloud-clusterissuers
Comparing release=certificates, chart=../../charts/certificates
Comparing release=ingress-nginx, chart=ingress-nginx/ingress-nginx
Comparing release=sql, chart=bitnami-legacy/mariadb
Comparing release=elasticsearch-1, chart=bitnami/elasticsearch
Comparing release=redis, chart=bitnami/redis
Comparing release=platform-nginx, chart=bitnami-legacy/nginx
Comparing release=platform-apps-ingress, chart=wbstack/wikibase-ingress
Comparing release=api, chart=wbstack/api
default, api-app-backend, Deployment (apps) has changed:
...
 
...

Comparing release=ui, chart=wbstack/ui
Comparing release=mediawiki-139, chart=wbstack/mediawiki
Comparing release=queryservice-ui, chart=wbstack/queryservice-ui
Comparing release=queryservice, chart=wbstack/queryservice
Comparing release=queryservice-gateway, chart=wbstack/queryservice-gateway
Comparing release=queryservice-updater, chart=wbstack/queryservice-updater
Comparing release=tool-cradle, chart=wbstack/tool-cradle
Comparing release=tool-widar, chart=wbstack/tool-widar
Comparing release=tool-quickstatements, chart=wbstack/tool-quickstatements
Comparing release=wbaas-backup, chart=wbstack/wbaas-backup
default, restore-sql-logic-backup, Pod (v1) has been added:
+ # Source: wbaas-backup/templates/restore-pod.yaml
........................

Comparing release=kube-prometheus-stack, chart=prometheus-community/kube-prometheus-stack
Comparing release=prometheus-elasticsearch-exporter, chart=prometheus-community/prometheus-elasticsearch-exporter
Comparing release=prometheus-elasticsearch-exporter-1, chart=prometheus-community/prometheus-elasticsearch-exporter
Comparing release=istio-service-mesh, chart=../../charts/istio-service-mesh
Listing releases matching ^adminer-cetic$
Listing releases matching ^mailhog$
Listing releases matching ^minio$
0 12:57 » deer@wmde102295 ~/wbaas/deploy (main) (gke_wikibase-cloud_europe-west3-a_wbaas-2)
 $ date
Do 8. Feb 12:57:24 CET 2024
0 12:57 » deer@wmde102295 ~/wbaas/deploy (main) (gke_wikibase-cloud_europe-west3-a_wbaas-2)
 $ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants