Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Add namespace validation and auto-creation
- Add deployment hints for failed deployments
- Add wait for ingress reconciliation
- Only wait for blue deployment when using rolling deployment strategy
Expand Down
21 changes: 21 additions & 0 deletions k8s/scope/build_context
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ K8S_NAMESPACE=$(echo "$CONTEXT" | jq -r --arg default "$K8S_NAMESPACE" '
.providers["container-orchestration"].cluster.namespace // $default
')

echo "Validating namespace $K8S_NAMESPACE exists"

if ! kubectl get namespace "$K8S_NAMESPACE" &> /dev/null; then
echo "Namespace '$K8S_NAMESPACE' does not exist in the cluster."

CREATE_K8S_NAMESPACE_IF_NOT_EXIST="${CREATE_K8S_NAMESPACE_IF_NOT_EXIST:-true}"

if [ "$CREATE_K8S_NAMESPACE_IF_NOT_EXIST" = "true" ]; then
echo "Creating namespace '$K8S_NAMESPACE'..."

kubectl create namespace "$K8S_NAMESPACE" --dry-run=client -o yaml | \
kubectl label -f - nullplatform=true --dry-run=client -o yaml | \
kubectl apply -f -

echo "Namespace '$K8S_NAMESPACE' created successfully."
else
echo "Error: Namespace '$K8S_NAMESPACE' does not exist and CREATE_K8S_NAMESPACE_IF_NOT_EXIST is set to false."
exit 1
fi
fi

USE_ACCOUNT_SLUG=$(echo "$CONTEXT" | jq -r --arg default "$USE_ACCOUNT_SLUG" '
.providers["cloud-providers"].networking.application_domain // $default
')
Expand Down
1 change: 1 addition & 0 deletions k8s/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ provider_categories:
- cloud-providers
configuration:
K8S_NAMESPACE: nullplatform
CREATE_K8S_NAMESPACE_IF_NOT_EXIST: true
DOMAIN: nullapps.io
# PRIVATE_DOMAIN: nullapps.io
USE_ACCOUNT_SLUG: false
Expand Down