mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 12:03:59 +00:00
chore(scripts): init script updates — gitea, gitlab, kong, monitoring, registry
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
eb8c952523
commit
0d0bad583f
@ -88,7 +88,7 @@ GITEA_PV_NODE_SELECTOR_KEY="${GITEA_PV_NODE_SELECTOR_KEY:-${NODE_SELECTOR_KEY}}"
|
||||
GITEA_PV_NODE="${GITEA_PV_NODE:-${GITEA_NODE_SELECTOR:-}}"
|
||||
GITEA_PV_BASE_DIR="${GITEA_PV_BASE_DIR:-/synology/d005}"
|
||||
GITEA_STORAGE_CLASS="${GITEA_STORAGE_CLASS:-gitea-local-d005}"
|
||||
GITEA_DOMAIN="${GITEA_DOMAIN:-git.knoe.org}"
|
||||
GITEA_DOMAIN="${GITEA_DOMAIN:-git.prole.org}"
|
||||
GITEA_SSH_DOMAIN="${GITEA_SSH_DOMAIN:-$GITEA_DOMAIN}"
|
||||
KNOE_DB_NAMESPACE="${KNOE_DB_NAMESPACE:-${DATABASE_NAMESPACE:-knoe-db}}"
|
||||
KNOE_DB_CLUSTER="${KNOE_DB_CLUSTER:-${CLUSTER_NAME:-knoe-db}}"
|
||||
|
||||
@ -1699,9 +1699,9 @@ check_gitlab_post_apply_blocked() {
|
||||
log "Desired Gitaly state (from CR): nodeSelector=[${desired_gitaly_node_selector}], rendered.global.persistence.storageClass=[${rendered_global_sc:-<unset>}], rendered.gitlab.gitaly.persistence.storageClass=[${rendered_gitlab_gitaly_sc:-<unset>}], rendered.gitaly.persistence.storageClass=[${rendered_chart_gitaly_sc:-<unset>}]"
|
||||
log "Internal script GITALY_STORAGE_CLASS=[${GITALY_STORAGE_CLASS:-}]"
|
||||
|
||||
if [[ "$desired_cr" == *"gandalf.knoe.org"* ]]; then
|
||||
if [[ "$desired_cr" == *"gandalf.prole.org"* ]]; then
|
||||
repair_blocked "GitLab CR contains legacy nodeSelector" \
|
||||
"Desired GitLab CR still contains gandalf.knoe.org. This is a configuration bug."
|
||||
"Desired GitLab CR still contains gandalf.prole.org. This is a configuration bug."
|
||||
fi
|
||||
if [[ "$desired_cr" == *"gitlab-gitaly-static"* ]]; then
|
||||
repair_blocked "GitLab CR contains legacy storageClass" \
|
||||
@ -1733,7 +1733,7 @@ check_gitlab_post_apply_blocked() {
|
||||
live_sts_yaml=$(kubectl -n "$NAMESPACE" get statefulset "$gitaly_sts_name" -o yaml 2>/dev/null || true)
|
||||
if [[ -z "$live_sts_yaml" ]]; then
|
||||
log "Gitaly StatefulSet not found (awaiting operator action)..."
|
||||
elif [[ "$live_sts_yaml" != *"gandalf.knoe.org"* && "$live_sts_yaml" != *"gitlab-gitaly-static"* ]]; then
|
||||
elif [[ "$live_sts_yaml" != *"gandalf.prole.org"* && "$live_sts_yaml" != *"gitlab-gitaly-static"* ]]; then
|
||||
log "Gitaly StatefulSet converged to corrected state (clean nodeSelector/storageClass)."
|
||||
local _live_sc
|
||||
_live_sc=$(echo "$live_sts_yaml" | grep "storageClassName:" | cut -d: -f2 | xargs || true)
|
||||
@ -1760,7 +1760,7 @@ check_gitlab_post_apply_blocked() {
|
||||
if [[ "$converged" == "0" ]]; then
|
||||
local live_sts_yaml
|
||||
live_sts_yaml=$(kubectl -n "$NAMESPACE" get statefulset "$gitaly_sts_name" -o yaml 2>/dev/null || true)
|
||||
if [[ -n "$live_sts_yaml" && ( "$live_sts_yaml" == *"gandalf.knoe.org"* || "$live_sts_yaml" == *"gitlab-gitaly-static"* ) ]]; then
|
||||
if [[ -n "$live_sts_yaml" && ( "$live_sts_yaml" == *"gandalf.prole.org"* || "$live_sts_yaml" == *"gitlab-gitaly-static"* ) ]]; then
|
||||
log "Live StatefulSet still legacy after grace period. Performing explicit replacement..."
|
||||
# We already confirmed desired CR is corrected at the start of this function.
|
||||
kubectl -n "$NAMESPACE" delete statefulset "$gitaly_sts_name" --wait=true 2>/dev/null || true
|
||||
@ -1912,9 +1912,9 @@ check_gitlab_post_apply_blocked() {
|
||||
cleanup_gitlab_wrong_gitaly_template_storage "${GITALY_STORAGE_CLASS:-}" "$live_gitaly_repo_data_template_sc" "$gitaly_pvc_mismatches" "$desired_cr"
|
||||
fi
|
||||
|
||||
if [[ "$gitaly_sts_yaml" == *"gandalf.knoe.org"* ]]; then
|
||||
if [[ "$gitaly_sts_yaml" == *"gandalf.prole.org"* ]]; then
|
||||
repair_blocked "Gitaly using legacy Synology storage" \
|
||||
"Resource: statefulset/${gitaly_sts_name}. Value: nodeSelector contains gandalf.knoe.org. Fix: Ensure GITLAB_STORAGE_NODE is not set in k8s mode."
|
||||
"Resource: statefulset/${gitaly_sts_name}. Value: nodeSelector contains gandalf.prole.org. Fix: Ensure GITLAB_STORAGE_NODE is not set in k8s mode."
|
||||
fi
|
||||
if [[ "$gitaly_sts_yaml" == *"gitlab-gitaly-static"* ]]; then
|
||||
repair_blocked "Gitaly using legacy Synology storage" \
|
||||
@ -2380,7 +2380,7 @@ REDIS_HOST="${GITLAB_REDIS_HOST:-redis-master.${REDIS_NAMESPACE}.svc.cluster.loc
|
||||
REDIS_PORT="${GITLAB_REDIS_PORT:-6379}"
|
||||
|
||||
# GitLab public domain (configurable; default follows deployment mode)
|
||||
_default_gitlab_domain="git.knoe.org"
|
||||
_default_gitlab_domain="git.prole.org"
|
||||
if [[ "$MODE" == "k8s" ]]; then
|
||||
_default_gitlab_domain="git.knoe.dev"
|
||||
fi
|
||||
@ -2418,7 +2418,7 @@ PRIMARY_GITLAB_HOST="${GITLAB_PUBLIC_HOSTS[0]}"
|
||||
GITLAB_DOMAIN="$PRIMARY_GITLAB_HOST"
|
||||
PRIMARY_GITLAB_DOMAIN_ROOT="${PRIMARY_GITLAB_HOST#*.}"
|
||||
if [[ "$PRIMARY_GITLAB_DOMAIN_ROOT" == "$PRIMARY_GITLAB_HOST" || -z "$PRIMARY_GITLAB_DOMAIN_ROOT" ]]; then
|
||||
PRIMARY_GITLAB_DOMAIN_ROOT="knoe.org"
|
||||
PRIMARY_GITLAB_DOMAIN_ROOT="prole.org"
|
||||
fi
|
||||
|
||||
# Public ingress class (k8s/GKE defaults to gce; local clusters keep kong)
|
||||
@ -2513,7 +2513,7 @@ fi
|
||||
# Requires k8s secret 'gitlab-google-oidc' in GITLAB_NAMESPACE with Google
|
||||
# OAuth2 client credentials (client_id, client_secret, redirect_uri).
|
||||
# To disable OIDC: unset FRONTDOOR_HOST before running.
|
||||
_default_auth_hostname="api.knoe.org"
|
||||
_default_auth_hostname="api.prole.org"
|
||||
if [[ "$MODE" == "k8s" ]]; then
|
||||
_default_auth_hostname="api.knoe.dev"
|
||||
fi
|
||||
@ -2891,7 +2891,7 @@ setup_knoe_db_for_gitlab() {
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Clean up any pre-existing Gitea / git.knoe.org configurations
|
||||
# Clean up any pre-existing Gitea / git.prole.org configurations
|
||||
# ---------------------------------------------------------------------------
|
||||
cleanup_gitea() {
|
||||
log "Checking for pre-existing Gitea deployment to remove before GitLab install..."
|
||||
@ -2908,13 +2908,13 @@ cleanup_gitea() {
|
||||
kubectl -n "$gitea_ns" delete deploy/gitea svc/gitea-http svc/gitea-ssh \
|
||||
>/dev/null 2>&1 || true
|
||||
|
||||
# Remove Kong routes/services registered for git.knoe.org (best-effort)
|
||||
# Remove Kong routes/services registered for git.prole.org (best-effort)
|
||||
local kong_ns="${KONG_NAMESPACE:-${NAMESPACE:-kong}}"
|
||||
for res_type in kongplugins kongingresses; do
|
||||
kubectl -n "$gitea_ns" delete "$res_type" --all >/dev/null 2>&1 || true
|
||||
done
|
||||
|
||||
# Remove gitea namespace Ingress objects that route git.knoe.org
|
||||
# Remove gitea namespace Ingress objects that route git.prole.org
|
||||
kubectl -n "$gitea_ns" delete ingress \
|
||||
-l "app.kubernetes.io/name=gitea" >/dev/null 2>&1 || true
|
||||
kubectl -n "$gitea_ns" delete ingress \
|
||||
@ -2945,7 +2945,7 @@ fi
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Always remove gitea if its helm release exists (non-destructive path)
|
||||
# gitea and gitlab both claim git.knoe.org; they cannot coexist.
|
||||
# gitea and gitlab both claim git.prole.org; they cannot coexist.
|
||||
# ---------------------------------------------------------------------------
|
||||
if helm -n "${GITEA_NAMESPACE:-gitea}" status gitea >/dev/null 2>&1; then
|
||||
warn "Gitea release detected — removing to free git.knoe.org for GitLab..."
|
||||
@ -3070,7 +3070,7 @@ fi
|
||||
if [[ "$MODE" == "k8s" ]]; then
|
||||
# In k8s/GKE mode, we do NOT use static storage nodes or nodeSelectors.
|
||||
STORAGE_NODE=""
|
||||
if [[ "$NODE_SELECTOR" == *"gandalf.knoe.org"* ]]; then
|
||||
if [[ "$NODE_SELECTOR" == *"gandalf.prole.org"* ]]; then
|
||||
warn "Stripping legacy nodeSelector '${NODE_SELECTOR}' in k8s mode."
|
||||
NODE_SELECTOR=""
|
||||
fi
|
||||
@ -3719,7 +3719,7 @@ setup_gitlab_storage() {
|
||||
local gitaly_sts_yaml
|
||||
gitaly_sts_yaml=$(kubectl -n "$NAMESPACE" get statefulset "$gitaly_sts_name" -o yaml 2>/dev/null || true)
|
||||
if [[ -n "$gitaly_sts_yaml" ]]; then
|
||||
if [[ "$gitaly_sts_yaml" == *"gandalf.knoe.org"* || "$gitaly_sts_yaml" == *"gitlab-gitaly-static"* ]]; then
|
||||
if [[ "$gitaly_sts_yaml" == *"gandalf.prole.org"* || "$gitaly_sts_yaml" == *"gitlab-gitaly-static"* ]]; then
|
||||
has_legacy=1
|
||||
fi
|
||||
fi
|
||||
@ -3743,7 +3743,7 @@ setup_gitlab_storage() {
|
||||
# Give it a moment to process deletions
|
||||
sleep 2
|
||||
else
|
||||
repair_blocked "Legacy Gitaly PV/PVC still bound to gitlab-gitaly-static / gandalf.knoe.org" \
|
||||
repair_blocked "Legacy Gitaly PV/PVC still bound to gitlab-gitaly-static / gandalf.prole.org" \
|
||||
"Set GITLAB_REPAIR_BLOCKED_AUTOCLEAN=1 to automatically repair by deleting legacy PVC/PV, or run:
|
||||
kubectl -n $NAMESPACE scale sts ${GITLAB_RELEASE}-gitaly --replicas=0
|
||||
kubectl -n $NAMESPACE delete pvc repo-data-gitlab-gitaly-0
|
||||
|
||||
@ -137,9 +137,9 @@ if [[ "${KNOE_MODE:-}" == "k8s" ]]; then
|
||||
else
|
||||
KONG_NAME="${KONG_NAME:-knoe-svc-kong}"
|
||||
KONG_CONFIG_NAME="${KONG_CONFIG_NAME:-knoe-svc-kong-config}"
|
||||
SERVICE_HOSTNAME="${SERVICE_HOSTNAME:-svc.knoe.org}"
|
||||
AUTH_HOSTNAME="${AUTH_HOSTNAME:-api.knoe.org}"
|
||||
GITEA_HOSTNAME="${GITEA_HOSTNAME:-${GITEA_DOMAIN:-git.knoe.org}}"
|
||||
SERVICE_HOSTNAME="${SERVICE_HOSTNAME:-svc.prole.org}"
|
||||
AUTH_HOSTNAME="${AUTH_HOSTNAME:-api.prole.org}"
|
||||
GITEA_HOSTNAME="${GITEA_HOSTNAME:-${GITEA_DOMAIN:-git.prole.org}}"
|
||||
SERVICE_INGRESS_TLS_ENABLED="${SERVICE_INGRESS_TLS_ENABLED:-1}"
|
||||
fi
|
||||
KONG_PROXY_PORT="${KONG_PROXY_PORT:-8000}"
|
||||
|
||||
@ -198,7 +198,7 @@ validate_monitoring_storage_classes() {
|
||||
}
|
||||
|
||||
monitoring_nodes_available() {
|
||||
kubectl get nodes -l "knoe.org/node-role=general" -o name 2>/dev/null | grep -q .
|
||||
kubectl get nodes -l "prole.org/node-role=general" -o name 2>/dev/null | grep -q .
|
||||
}
|
||||
|
||||
resolve_monitoring_primary_node() {
|
||||
@ -207,11 +207,11 @@ resolve_monitoring_primary_node() {
|
||||
printf '%s' "${MONITORING_PRIMARY_NODE}"
|
||||
return 0
|
||||
fi
|
||||
if kubectl get node merlin.knoe.org >/dev/null 2>&1; then
|
||||
printf '%s' "merlin.knoe.org"
|
||||
if kubectl get node merlin.prole.org >/dev/null 2>&1; then
|
||||
printf '%s' "merlin.prole.org"
|
||||
return 0
|
||||
fi
|
||||
node=$(kubectl get nodes -l "knoe.org/node-role=general" -o jsonpath='{.items[0].metadata.name}' 2>/dev/null || true)
|
||||
node=$(kubectl get nodes -l "prole.org/node-role=general" -o jsonpath='{.items[0].metadata.name}' 2>/dev/null || true)
|
||||
if [[ -n "${node:-}" ]]; then
|
||||
printf '%s' "$node"
|
||||
return 0
|
||||
@ -461,7 +461,7 @@ render_node_selector() {
|
||||
local indent="$1"
|
||||
cat <<EOF
|
||||
${indent}nodeSelector:
|
||||
${indent} knoe.org/node-role: general
|
||||
${indent} prole.org/node-role: general
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -492,7 +492,7 @@ render_tolerations() {
|
||||
mode="${KNOE_MODE:-${DEPLOYMENT_MODE:-}}"
|
||||
|
||||
local key value effect
|
||||
key="${MONITORING_TAINT_KEY:-knoe.org/monitoring}"
|
||||
key="${MONITORING_TAINT_KEY:-prole.org/monitoring}"
|
||||
value="${MONITORING_TAINT_VALUE:-true}"
|
||||
effect="${MONITORING_TAINT_EFFECT:-NoSchedule}"
|
||||
|
||||
@ -515,7 +515,7 @@ ${indent} nodeAffinity:
|
||||
${indent} requiredDuringSchedulingIgnoredDuringExecution:
|
||||
${indent} nodeSelectorTerms:
|
||||
${indent} - matchExpressions:
|
||||
${indent} - key: knoe.org/node-role
|
||||
${indent} - key: prole.org/node-role
|
||||
${indent} operator: In
|
||||
${indent} values:
|
||||
${indent} - general
|
||||
@ -1293,7 +1293,7 @@ $(render_tolerations " ")
|
||||
- key: kubernetes.io/hostname
|
||||
operator: NotIn
|
||||
values:
|
||||
- pi.knoe.org
|
||||
- pi.prole.org
|
||||
EOF
|
||||
|
||||
local monitoring_helm_server_side
|
||||
|
||||
@ -189,7 +189,7 @@ resolve_registry_node_selector() {
|
||||
return 0
|
||||
fi
|
||||
# Default: pin to the control-plane node so hostPort:5000 is reachable via
|
||||
# the k3s server host (e.g. myrddin.knoe.org:5000).
|
||||
# the k3s server host (e.g. myrddin.prole.org:5000).
|
||||
resolve_control_plane_node_selector
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user