-
Notifications
You must be signed in to change notification settings - Fork 99
Fix stale kind cluster setup for certs and valkey #146
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
Open
Nina Polshakova (npolshakova)
wants to merge
1
commit into
agent-substrate:main
Choose a base branch
from
npolshakova:fix-stale-kind-cluster-setup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,6 +62,8 @@ function usage() { | |
| echo " --deploy-ate-system Deploy core system (CRDs, atelet, apiserver)" | ||
| echo " --delete-ate-system Delete core system" | ||
| echo " --delete-all Delete core system and all registered demos" | ||
| echo " --refresh-local-certs Regenerate local cert/JWT prerequisites and restart cert consumers" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably figure out how to fix this generally so it doesn't require manual intervention, kind aside, cc Grant McCloskey (@MushuEE) Julian Gutierrez Oschmann (@juli4n) (anyone is welcome to look at this please, I just know these two are looking at valkey) |
||
| echo " --reset-local-valkey Delete local kind Valkey state so the cluster can be reinitialized" | ||
| echo "" | ||
| echo "Infrastructure components:" | ||
| echo "" | ||
|
|
@@ -199,6 +201,83 @@ create_api_server_env_vars() { | |
| | run_kubectl apply -f - | ||
| } | ||
|
|
||
| rollout_restart_if_exists() { | ||
| local kind="$1" | ||
| local namespace="$2" | ||
| local name="$3" | ||
|
|
||
| if run_kubectl get "${kind}" -n "${namespace}" "${name}" >/dev/null 2>&1; then | ||
| run_kubectl rollout restart "${kind}/${name}" -n "${namespace}" | ||
| fi | ||
| } | ||
|
|
||
| refresh_local_certs() { | ||
| log_step "refresh_local_certs" | ||
|
|
||
| run_kubectl create namespace ate-system --dry-run=client -o yaml \ | ||
| | run_kubectl apply -f - | ||
| run_kubectl create namespace podcertificate-controller-system --dry-run=client -o yaml \ | ||
| | run_kubectl apply -f - | ||
|
|
||
| # Drop issued pod certificates and trust bundles so kubelet and the local | ||
| # signer have to request and publish certs from the regenerated pools. | ||
| run_kubectl delete podcertificaterequests --all -A --ignore-not-found || true | ||
| run_kubectl delete clustertrustbundles \ | ||
| podidentity.podcert.ate.dev:identity:primary-bundle \ | ||
| servicedns.podcert.ate.dev:identity:primary-bundle \ | ||
| --ignore-not-found || true | ||
|
|
||
| # Force regenerated local cert, JWT, and API server config material. | ||
| run_kubectl delete secret -n ate-system \ | ||
| session-id-jwt-pool \ | ||
| session-id-ca-pool \ | ||
| valkey-ca-certs \ | ||
| --ignore-not-found | ||
| run_kubectl delete secret -n podcertificate-controller-system \ | ||
| service-dns-ca-pool \ | ||
| pod-identity-ca-pool \ | ||
| --ignore-not-found | ||
| run_kubectl delete configmap -n ate-system ate-api-server-envvars --ignore-not-found | ||
|
|
||
| create_jwt_authority_pool_secret | ||
| create_session_id_ca_pool_secret | ||
| create_podcertificate_controller_cas | ||
| create_valkey_ca_certs_secret | ||
| create_api_server_env_vars | ||
|
|
||
| # Restart components that mount or cache generated cert material. The Valkey | ||
| # init job is recreated on the next system deploy if needed. | ||
| run_kubectl delete job -n ate-system valkey-cluster-init --ignore-not-found | ||
| rollout_restart_if_exists deployment podcertificate-controller-system podcertificate-controller | ||
| rollout_restart_if_exists statefulset ate-system valkey-cluster | ||
| rollout_restart_if_exists deployment ate-system ate-api-server-deployment | ||
| rollout_restart_if_exists deployment ate-system ate-controller | ||
| rollout_restart_if_exists deployment ate-system atenet-router | ||
| rollout_restart_if_exists deployment ate-system dns | ||
| rollout_restart_if_exists daemonset ate-system atelet | ||
| } | ||
|
|
||
| reset_local_valkey() { | ||
| log_step "reset_local_valkey" | ||
|
|
||
| if [[ "${ATE_INSTALL_KIND:-false}" != "true" ]]; then | ||
| echo "--reset-local-valkey is only supported for the kind installer. Use hack/install-ate-kind.sh." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # This intentionally destroys the local control-plane database. It is meant | ||
| # for kind/dev recovery when Valkey Cluster persisted stale pod IPs in | ||
| # nodes.conf after pod recreation. | ||
| run_kubectl delete job -n ate-system valkey-cluster-init --ignore-not-found | ||
|
|
||
| if run_kubectl get statefulset -n ate-system valkey-cluster >/dev/null 2>&1; then | ||
| run_kubectl scale statefulset/valkey-cluster -n ate-system --replicas=0 | ||
| run_kubectl wait --for=delete pod -n ate-system -l app=valkey-cluster --timeout=2m || true | ||
| fi | ||
|
|
||
| run_kubectl delete pvc -n ate-system -l app=valkey-cluster --ignore-not-found | ||
| } | ||
|
|
||
| ensure_crds() { | ||
| log_step "ensure_crds" | ||
| if run_kubectl get crd workerpools.ate.dev actortemplates.ate.dev >/dev/null 2>&1; then | ||
|
|
@@ -376,6 +455,8 @@ while [[ "$#" -gt 0 ]]; do | |
| --deploy-ate-system) deploy_ate_system ;; | ||
| --delete-ate-system) delete_ate_system ;; | ||
| --delete-all) delete_all ;; | ||
| --refresh-local-certs) refresh_local_certs ;; | ||
| --reset-local-valkey) reset_local_valkey ;; | ||
|
|
||
| --deploy-atelet) deploy_atelet ;; | ||
| --deploy-ate-apiserver) deploy_ate_apiserver ;; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is a chance the issue exists for non
kindversion too. Yesterday I tried to re-deploy ate-api and it failed. It was complaining on expired token at startup. Deleting everything and installing from scratch solved the issue.