deploy: configure NC01 HWLAB monitor exposure

This commit is contained in:
root
2026-07-08 05:34:11 +02:00
parent 5dfb78f000
commit a328aa909e
41 changed files with 2522 additions and 110 deletions
@@ -70,6 +70,23 @@ prepare_gitea_api_base() {
export UNIDESK_PAC_GITEA_API_BASE_URL
}
resolve_service_url_to_cluster_ip() {
value="$1"
hostport=$(printf '%s' "$value" | sed -n 's#^http://\([^/]*\).*$#\1#p')
if ! printf '%s' "$hostport" | grep -q '\.svc\.cluster\.local'; then
printf '%s' "$value"
return
fi
host=${hostport%%:*}
port=${hostport##*:}
if [ "$port" = "$hostport" ]; then port=80; fi
service=${host%%.*}
rest=${host#*.}
namespace=${rest%%.*}
cluster_ip=$(kubectl -n "$namespace" get svc "$service" -o jsonpath='{.spec.clusterIP}')
printf '%s' "$value" | sed "s#^http://$hostport#http://$cluster_ip:$port#"
}
gitea_api() {
method="$1"
path="$2"
@@ -118,6 +135,7 @@ NODE
}
repository_manifest() {
repository_url=$(resolve_service_url_to_cluster_ip "$UNIDESK_PAC_REPOSITORY_URL")
cat <<EOF
apiVersion: pipelinesascode.tekton.dev/v1alpha1
kind: Repository
@@ -129,7 +147,7 @@ metadata:
app.kubernetes.io/part-of: $UNIDESK_PAC_PART_OF
unidesk.ai/spec: $UNIDESK_PAC_SPEC
spec:
url: $UNIDESK_PAC_REPOSITORY_URL
url: $repository_url
git_provider:
type: gitea
url: $UNIDESK_PAC_GITEA_BASE_URL