Commit ed07d6f3 authored by Noelia Jimenez's avatar Noelia Jimenez Committed by Pierre Smeyers
Browse files

fix: make namespace implicit and overridable

No longer use the explicit helmfile --namespace CLI option.
Simply use as a default (already associated to the Kube context).
This allows releases deploying to different namespaces.
parent 04af3eb7
Loading
Loading
Loading
Loading
+4 −15
Original line number Diff line number Diff line
@@ -523,11 +523,6 @@ stages:
    helmfile_opts=${TRACE+--debug}
    helmfile_opts="$helmfile_opts --file ${HELMFILE_PATH}"

    if [ -n "$kube_namespace" ]; then
      log_info "--- using \\e[32mnamespace\\e[0m: \\e[33;1m${kube_namespace}\\e[0m"
      helmfile_opts="$helmfile_opts --namespace $kube_namespace"
    fi

    if [ -n "$environment_type" ]; then
      log_info "--- using \\e[32mhelmfile environment\\e[0m: \\e[33;1m${environment_type}\\e[0m"
      helmfile_opts="$helmfile_opts --environment $environment_type"
@@ -568,6 +563,8 @@ stages:
    log_info "--- \$environment_type: \\e[33;1m${environment_type}\\e[0m"
    log_info "--- \$environment_name: \\e[33;1m${environment_name}\\e[0m"

    kubectl config set-context --current --namespace="$kube_namespace"

    # maybe execute pre delete script
    prescript="$HELMFILE_SCRIPTS_DIR/helmfile-pre-delete.sh"
    if [[ -f "$prescript" ]]; then
@@ -580,11 +577,6 @@ stages:
    helmfile_opts=${TRACE+--debug}    
    helmfile_opts="$helmfile_opts --file ${HELMFILE_PATH}"

    if [ -n "$kube_namespace" ]; then
      log_info "--- using \\e[32mnamespace\\e[0m: \\e[33;1m${kube_namespace}\\e[0m"
      helmfile_opts="$helmfile_opts --namespace $kube_namespace"
    fi

    if [ -n "$environment_type" ]; then
      log_info "--- using \\e[32mhelmfile environment\\e[0m: \\e[33;1m${environment_type}\\e[0m"
      helmfile_opts="$helmfile_opts --environment $environment_type"
@@ -613,14 +605,11 @@ stages:
    log_info "--- \$environment_name: \\e[33;1m${environment_name}\\e[0m"
    log_info "--- \$environment_type: \\e[33;1m${environment_type}\\e[0m"

    kubectl config set-context --current --namespace="$kube_namespace"

    helmfile_opts=""
    helmfile_opts="$helmfile_opts --file ${HELMFILE_PATH}"

    if [ -n "$kube_namespace" ]; then
      log_info "--- using \\e[32mnamespace\\e[0m: \\e[33;1m${kube_namespace}\\e[0m"
      helmfile_opts="$helmfile_opts --namespace $kube_namespace"
    fi

    if [ -n "$environment_type" ]; then
      log_info "--- using \\e[32mhelmfile environment\\e[0m: \\e[33;1m${environment_type}\\e[0m"
      helmfile_opts="$helmfile_opts --environment $environment_type"