mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 20:04:31 +00:00
Itemized changes:
1. knoe-auth: New cluster-internal KDC and SSO gateway service
- Created etc/init_knoe_auth.sh based on init_kdc.sh with knoe-auth naming
- Namespace defaults to SERVICE_NAMESPACE (knoe-system)
- ConfigMap: knoe-auth-kdc-config, Secret: knoe-auth-secrets
- Legacy cleanup removes old auth/dog/authority deployments
2. Orchestration: knoe-auth initializes before CloudNativePG
- Updated prole.sh to insert init_knoe_auth.sh as step 2 (before CNPG)
- Renumbered all subsequent initialization steps
3. Kong routing: Updated init_kong.sh to route to knoe-auth in SERVICE_NAMESPACE
4. Comment/reference updates for knoe-auth
- Updated init_common_services.sh, init_service_layer.sh, init_kerberos.sh
5. prole-db renamed to knoe-db across the entire codebase
- Renamed prole-db/ directory to knoe-db/
- Renamed all prole-db Kubernetes manifests (deploy/opentofu, k8s/)
- Renamed scripts: docker-root-knoe-db.sh, docker-run-knoe-db.sh, test-cnpg-knoe-db.sh
- Renamed etc/init_prole-db-reset.sh to etc/init_knoe-db-reset.sh
- Renamed etc/prole-db-passwwd.sh to etc/knoe-db-passwwd.sh
- Renamed mock_val counterparts accordingly
- Renamed tests/etc/test_init_prole-db-reset.sh to test_init_knoe-db-reset.sh
- Renamed docs/prole-db-documentation-mcp-architecture.md to knoe-db variant
- Renamed modes/k3d/prole-db/ to modes/k3d/knoe-db/
- Renamed prole-db.iml to knoe-db.iml
6. Configuration updates
- Updated conf/dev, conf/prod, conf/test, conf/service prole.cfg files
- Updated conf/port-mapping.cfg
- Updated etc/prole_cfg.sh and mock_val/prole_cfg.sh
- Updated service/prole.cfg
7. Kubernetes manifests and deploy configuration
- Updated deploy/opentofu/k3s ArgoCD application YAMLs
- Updated kong-configmap.yaml and kustomization.yaml
- Updated k3s/kong-config.yml and prole-resources.yaml
- Updated prole-mssql-db deployment YAMLs
- Updated supabase helm render and deploy scripts
8. Infrastructure and GCP Terraform
- Updated deploy/gcp/terraform: folders, groups, IAM, service-projects
9. Python/installer code updates
- Updated knoe/core: actions, build_context, controller, env, milestones
- Updated knoe/milestone.py
- Updated knoe/ui/screens: cfg, database, database_options, deploy, docker,
navigation, security, services, validate
- Updated knoe.spec, status.py
10. Shell script updates
- Updated etc/: build_db, init_cloudnative_pg, init_cnpg_backup,
init_db_manager, init_forgejo, init_gitlab, init_monitoring, init_openbao,
init_port_forwards, init_postgrest, init_supabase_ports, status
- Updated mock_val/ counterparts for all above scripts
- Updated prole-net/init-prole-dns.sh
- Updated bin/prole-kpf.sh, gitea/deploy.sh, supabase/deploy.sh
11. Test updates
- Updated tests/etc/: test_init_cloudnative_pg*, test_init_cnpg_backup*,
test_init_kdc*, test_init_kerberos*, test_init_kong*, test_prole_cfg*
- Updated tests/installer/: test_actions_helpers, test_cfg_save_kubecontext,
test_controller, test_core_classes, test_milestones, test_milestones_extended,
test_namespace_propagation
- Updated tests/: test_database_options, test_navigation,
test_render_supabase_hostname, test_docker_build_fix,
test_all_prole_home_fixes, silent_install_test, final_test
12. Documentation updates
- Updated docs/: DOCKER-BUILD-FIX, PROLE-CFG-SECRETS, PROLE-HOME-DIRECTORY,
build-system, patent
- Updated scan/network_description.txt
- Updated pom.xml
13. Miscellaneous script updates
- Updated root-level: _adopt_replica_pvcs, _fix_replica_merlin, _import_pi,
_patch_cluster, _prebind_pvcs, _rebind_d002, _rebind_d002b, test_resolve
- Updated scripts/generate_spec.py
Co-authored-by: Junie <junie@jetbrains.com>
192 lines
4.2 KiB
Bash
192 lines
4.2 KiB
Bash
#!/usr/bin/env bash
|
|
# Regression test for etc/init_kerberos.sh in k3s mode with real KDC endpoint.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
PROLE_HOME=$(cd "$SCRIPT_DIR/../.." && pwd)
|
|
SOURCE_ETC_DIR="$PROLE_HOME/etc"
|
|
|
|
TMP_DIR=$(mktemp -d)
|
|
trap 'rm -rf "$TMP_DIR"' EXIT
|
|
|
|
WORK_DIR="$TMP_DIR/work"
|
|
BIN_DIR="$TMP_DIR/bin"
|
|
mkdir -p "$WORK_DIR/etc" "$WORK_DIR/conf" "$BIN_DIR"
|
|
|
|
cp "$SOURCE_ETC_DIR/init_kerberos.sh" "$WORK_DIR/etc/init_kerberos.sh"
|
|
cp "$SOURCE_ETC_DIR/prole_cfg.sh" "$WORK_DIR/etc/prole_cfg.sh"
|
|
chmod +x "$WORK_DIR/etc/init_kerberos.sh"
|
|
|
|
cat <<EOF > "$WORK_DIR/etc/init_kerberos_test.sh"
|
|
#!/usr/bin/env bash
|
|
exit 0
|
|
EOF
|
|
chmod +x "$WORK_DIR/etc/init_kerberos_test.sh"
|
|
|
|
cat <<EOF > "$WORK_DIR/env.sh"
|
|
#!/usr/bin/env bash
|
|
export PROLE_HOME="$WORK_DIR"
|
|
export PROLE_CONF="$WORK_DIR/conf"
|
|
EOF
|
|
|
|
cat <<EOF > "$WORK_DIR/conf/prole.cfg"
|
|
[globals]
|
|
prole.home = $WORK_DIR
|
|
prole.mode = k3s
|
|
EOF
|
|
|
|
export KUBECTL_LOG="$TMP_DIR/kubectl.log"
|
|
export KUBECTL_PAYLOAD_LOG="$TMP_DIR/kubectl-payload.log"
|
|
|
|
cat <<'EOF' > "$BIN_DIR/kubectl"
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
args=("$@")
|
|
printf '%s\n' "${args[*]}" >> "${KUBECTL_LOG}"
|
|
|
|
sub=""
|
|
sub_idx=-1
|
|
i=0
|
|
while [[ $i -lt ${#args[@]} ]]; do
|
|
case "${args[$i]}" in
|
|
-n|--namespace|--context|--kubeconfig)
|
|
i=$((i + 2))
|
|
;;
|
|
--namespace=*|--context=*|--kubeconfig=*)
|
|
i=$((i + 1))
|
|
;;
|
|
-*)
|
|
i=$((i + 1))
|
|
;;
|
|
*)
|
|
sub="${args[$i]}"
|
|
sub_idx=$i
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
|
|
case "$sub" in
|
|
get)
|
|
resource="${args[$((sub_idx + 1))]:-}"
|
|
if [[ "$resource" == "namespace" ]]; then
|
|
exit 1
|
|
fi
|
|
if [[ "$resource" == "pods" ]]; then
|
|
printf ''
|
|
exit 0
|
|
fi
|
|
exit 0
|
|
;;
|
|
create)
|
|
resource="${args[$((sub_idx + 1))]:-}"
|
|
if [[ "$resource" == "namespace" ]]; then
|
|
exit 0
|
|
fi
|
|
if [[ "$resource" == "configmap" ]]; then
|
|
cat <<YAML
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: prole-krb5-conf
|
|
YAML
|
|
exit 0
|
|
fi
|
|
exit 0
|
|
;;
|
|
apply)
|
|
payload="$(cat || true)"
|
|
printf '%s\n' "$payload" >> "${KUBECTL_PAYLOAD_LOG}"
|
|
|
|
case " ${args[*]} " in
|
|
*" --validate=false "*)
|
|
;;
|
|
*)
|
|
echo "error: error validating \"STDIN\": error validating data: failed to download openapi: the server has asked for the client to provide credentials" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
if [[ "$payload" == *"name: prole-kdc-egress"* ]]; then
|
|
if [[ "$payload" != *"cidr: 10.0.0.3/32"* ]]; then
|
|
echo "missing expected kdc cidr in NetworkPolicy payload" >&2
|
|
exit 1
|
|
fi
|
|
if [[ "$payload" == *"cidr: 0.0.0.0/0"* ]]; then
|
|
echo "unexpected broad egress cidr in NetworkPolicy payload" >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
exit 0
|
|
;;
|
|
wait|exec|delete|rollout|patch|config)
|
|
exit 0
|
|
;;
|
|
*)
|
|
exit 0
|
|
;;
|
|
esac
|
|
EOF
|
|
chmod +x "$BIN_DIR/kubectl"
|
|
|
|
cat <<'EOF' > "$BIN_DIR/curl"
|
|
#!/usr/bin/env bash
|
|
exit 0
|
|
EOF
|
|
chmod +x "$BIN_DIR/curl"
|
|
|
|
cat <<'EOF' > "$BIN_DIR/jq"
|
|
#!/usr/bin/env bash
|
|
exit 0
|
|
EOF
|
|
chmod +x "$BIN_DIR/jq"
|
|
|
|
export PATH="$BIN_DIR:$PATH"
|
|
|
|
export PROLE_HOME="$WORK_DIR"
|
|
export PROLE_CONF="$WORK_DIR/conf"
|
|
export NAMESPACE="knoe-db-a0001"
|
|
export SERVICE_NAMESPACE="default"
|
|
export PROLE_MODE="k3s"
|
|
export KRB5_REALM="PROLE.ORG"
|
|
export KRB5_KDC="10.0.0.3"
|
|
export KRB5_ADMIN="10.0.0.3"
|
|
export KRB5_PASSWORD="test-password"
|
|
|
|
if "$WORK_DIR/etc/init_kerberos.sh" test >"$TMP_DIR/stdout" 2>"$TMP_DIR/stderr"; then
|
|
:
|
|
else
|
|
echo "FAILURE: init_kerberos.sh test exited non-zero"
|
|
cat "$TMP_DIR/stderr"
|
|
exit 1
|
|
fi
|
|
|
|
if ! grep -q "Using KDC endpoint for test: 10.0.0.3" "$TMP_DIR/stdout"; then
|
|
echo "FAILURE: expected real KDC endpoint log line not found"
|
|
cat "$TMP_DIR/stdout"
|
|
exit 1
|
|
fi
|
|
|
|
if ! grep -q "apply --validate=false" "$KUBECTL_LOG"; then
|
|
echo "FAILURE: expected kubectl apply --validate=false invocation not found"
|
|
cat "$KUBECTL_LOG"
|
|
exit 1
|
|
fi
|
|
|
|
if ! grep -q "apply --validate=false -n knoe-db-a0001 -f -" "$KUBECTL_LOG"; then
|
|
echo "FAILURE: expected KDC policy apply in resolved namespace not found"
|
|
cat "$KUBECTL_LOG"
|
|
exit 1
|
|
fi
|
|
|
|
if grep -q "apply --validate=false -n default -f -" "$KUBECTL_LOG"; then
|
|
echo "FAILURE: unexpected KDC policy apply against default namespace"
|
|
cat "$KUBECTL_LOG"
|
|
exit 1
|
|
fi
|
|
|
|
echo "SUCCESS"
|