Free worker CPU reservations for Tetragon through Argo CD rollout
Homelab Main / validate (push) Waiting to run Details
Homelab Main / running-update (push) Blocked by required conditions Details
Homelab Main / debian-ops (push) Blocked by required conditions Details

This commit is contained in:
juvenal.diaz 2026-10-30 20:24:21 -06:00
parent 149a51afb1
commit 8938cb3511
3 changed files with 67 additions and 3 deletions

View File

@ -41,6 +41,21 @@ attempt is not repeated. Authentication, authorization, configuration, and
other errors fail immediately. `LAB_TOFU_K8S_IMPORT_RETRIES` overrides the attempt
limit; certificate verification stays enabled throughout.
The Argo CD target also adopts an existing `argocd` Helm release in its configured
namespace when missing from state, after checking the selected control plane.
It preserves release metadata and does not uninstall the release.
ApplicationSet and the Argo CD server each request 25m CPU, retaining their 300m
limits and existing memory settings. Compared with their previous 100m requests,
this frees 150m on a worker hosting both pods, enough for Tetragon's 125m request
in the observed one-core worker layout. This is a small homelab baseline, not a
guarantee against CPU contention during bursts. Their rolling updates use zero
surge and permit one unavailable replica so a full worker can release the old
reservation before admitting its replacement. A single-replica Argo CD UI or
ApplicationSet controller may be briefly unavailable during its update.
Apply with `LAB_CLUSTER_PROFILE=pimox ./jeannie platform argocd`; the readiness
step waits for the Argo CD rollouts. This does not change worker CPU topology.
## Monitoring during reduced CPU capacity
`platform monitoring` creates the `homelab-monitoring` PriorityClass before

View File

@ -1142,9 +1142,17 @@ resource "helm_release" "argocd" {
nodeSelector = local.argocd_node_selector
affinity = local.argocd_component_affinity.application_set
topologySpreadConstraints = local.argocd_component_topology_spread_constraints.application_set
# Release the old reservation first when the single-core worker is full.
deploymentStrategy = {
type = "RollingUpdate"
rollingUpdate = {
maxSurge = 0
maxUnavailable = 1
}
}
resources = {
requests = {
cpu = "100m"
cpu = "25m"
memory = "256Mi"
}
limits = {
@ -1232,9 +1240,17 @@ resource "helm_release" "argocd" {
nodeSelector = local.argocd_node_selector
affinity = local.argocd_component_affinity.server
topologySpreadConstraints = local.argocd_component_topology_spread_constraints.server
# Avoid waiting for spare CPU before replacing the single replica.
deploymentStrategy = {
type = "RollingUpdate"
rollingUpdate = {
maxSurge = 0
maxUnavailable = 1
}
}
resources = {
requests = {
cpu = "100m"
cpu = "25m"
memory = "256Mi"
}
limits = {
@ -1256,7 +1272,7 @@ resource "null_resource" "argocd_ready" {
version = var.argocd.version
node_selector = jsonencode(local.argocd_node_selector)
controller_resource_profile = "10m|1|2Gi"
readiness_check = "9"
readiness_check = "10"
}
provisioner "local-exec" {

View File

@ -611,6 +611,36 @@ adopt_platform_calico_resources() {
done
}
adopt_platform_argocd_resources() {
local namespace node_exists namespace_exists state_addresses revisions
local expected_node="${LAB_CLUSTER_CONTROL_PLANE_NODE_NAME:-}"
local address="helm_release.argocd"
if [[ -n "${expected_node}" ]]; then
node_exists="$(kubectl --kubeconfig "${KUBECONFIG_PATH}" --request-timeout=10s \
get node "${expected_node}" --ignore-not-found -o name)" || return 1
if [[ -z "${node_exists}" ]]; then
echo "Expected control plane ${expected_node} was not found; refusing Argo CD adoption in this cluster." >&2
return 1
fi
fi
namespace="$(printf '%s\n' 'jsonencode(var.argocd.namespace)' |
tofu -chdir="${REPO_ROOT}/bootstrap/platform" console |
python3 -c 'import json,sys; print(json.loads(json.loads(sys.stdin.read())))')" || return 1
state_addresses="$(platform_read_state_addresses)" || return 1
if grep -Fxq -- "${address}" <<<"${state_addresses}"; then
return 0
fi
namespace_exists="$(kubectl --kubeconfig "${KUBECONFIG_PATH}" --request-timeout=10s \
get namespace "${namespace}" --ignore-not-found -o name)" || return 1
[[ -n "${namespace_exists}" ]] || return 0
revisions="$(kubectl --kubeconfig "${KUBECONFIG_PATH}" --request-timeout=10s \
-n "${namespace}" get secrets -l 'owner=helm,name=argocd' -o name)" || return 1
[[ -n "${revisions}" ]] || return 0
echo "Adopting existing Argo CD Helm release ${namespace}/argocd into ${address}"
platform_import_with_retry "${address}" "${namespace}/argocd" || return 1
}
adopt_platform_existing_resources() {
local stack="bootstrap/platform"
local dashboard_file
@ -929,6 +959,9 @@ run_tofu_stack() {
elif [[ "${target}" == "-target=helm_release.calico_crds" || "${target}" == "-target=helm_release.calico" ]]; then
adopt_platform_calico_resources || return 1
break
elif [[ "${target}" == "-target=helm_release.argocd" ]]; then
adopt_platform_argocd_resources || return 1
break
fi
done
fi