Skip to content

Commit

Permalink
all: remove bootstrapping of namespaces
Browse files Browse the repository at this point in the history
This commit removes the bootstrap step used to install namespaces in a
cluster. The step has been integrated into the new helmfile setup and
namespaces are now managed by helm.

Two new releases are added: "admin-namespaces" and
"dev-namespaces", the latter of which is only relevant for wc clusters
and it only includes the "alertmanager" namespace as of now. The
"admin-namespace" includes all admin namespaces execpt for the "kube-*"
namespaces. The "kube-*" namespaces are not managed by helm nor do they
get and PSA annotations set. Futhermore those namespaces are exempted
from the OPA-Gatekeeper validating and mutating webhooks!
  • Loading branch information
OlleLarsson committed Jan 5, 2024
1 parent b8006f7 commit 6ba947e
Show file tree
Hide file tree
Showing 43 changed files with 757 additions and 361 deletions.
3 changes: 0 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ The configuration contains some `set-me`'s that must be configured manually.
> [!important]
> Setting up ingresses properly requires some additional steps documented later in this section.
> [!important]
> Namespaces are not yet managed by `helmfile` so you must first run `./bin/ck8s bootstrap sc|wc`.
Manage apps by using `helmfile` directly and with needs it will pull in all required releases:

```sh
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ Run the script to see what options are available.
#### Examples
- Bootstrap and deploy apps to the workload cluster:
- Deploy apps to the workload cluster:
```bash
./bin/ck8s apply wc
Expand Down
3 changes: 1 addition & 2 deletions bin/apps.bash
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ apps_sc() {
#
# The first few Charts install CRDs, which will make template validation
# fail. CRDs are "changes" to the Kubernetes API, hence validation against
# the Kubernetes API cannot be done. OTOH, manually adding the CRDs during
# bootstrap is error-prone and adds maintenance burden.
# the Kubernetes API cannot be done.
#
# While it would be nice to have some template validation before `helmfile apply`,
# at least Helmfile does "just in time" template validation. Not as nice,
Expand Down
53 changes: 0 additions & 53 deletions bin/bootstrap.bash

This file was deleted.

15 changes: 1 addition & 14 deletions bin/ck8s
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ source "${here}/common.bash"
usage() {
echo "COMMANDS:" 1>&2
echo " init <wc|sc|both> [--generate-new-secrets] initialize the config path" 1>&2
echo " bootstrap <wc|sc> bootstrap the cluster" 1>&2
echo " apps <wc|sc> [--sync] [--skip-template-validate] [--concurrency=<num>] deploy the applications" 1>&2
echo " apply <wc|sc> [--sync] [--skip-template-validate] [--concurrency=<num>] bootstrap and apps" 1>&2
echo " apply <wc|sc> [--sync] [--skip-template-validate] [--concurrency=<num>] deploy the apps" 1>&2
echo " test <wc|sc> [--logging-enabled] test the applications" 1>&2
echo " dry-run <wc|sc> [--kubectl] runs helmfile diff" 1>&2
echo " fix-psp-violations <wc|sc> Checks and restarts pods that violates Pod Security Polices, applicable for new environments" 1>&2
Expand Down Expand Up @@ -65,20 +63,9 @@ case "${1}" in
export CK8S_CLUSTER="${2}"
"${here}/init.bash" "${GEN_NEW_SECRETS}"
;;
bootstrap)
[[ "${2}" =~ ^(wc|sc)$ ]] || usage
check_tools
"${here}/bootstrap.bash" "${2}"
;;
apps)
[[ "${2}" =~ ^(wc|sc)$ ]] || usage
check_tools
"${here}/apps.bash" "${2}" "${SKIP}" "${SYNC}" "${CONCURRENCY}"
;;
apply)
[[ "${2}" =~ ^(wc|sc)$ ]] || usage
check_tools
"${here}/bootstrap.bash" "${2}"
"${here}/apps.bash" "${2}" "${SKIP}" "${SYNC}" "${CONCURRENCY}"
;;
test)
Expand Down
11 changes: 0 additions & 11 deletions bootstrap/bootstrap.sh

This file was deleted.

12 changes: 0 additions & 12 deletions bootstrap/namespaces/bootstrap.sh

This file was deleted.

43 changes: 0 additions & 43 deletions bootstrap/namespaces/helmfile/helmfile.yaml

This file was deleted.

77 changes: 0 additions & 77 deletions bootstrap/namespaces/helmfile/values/namespaces-sc.yaml.gotmpl

This file was deleted.

73 changes: 0 additions & 73 deletions bootstrap/namespaces/helmfile/values/namespaces-wc.yaml.gotmpl

This file was deleted.

16 changes: 0 additions & 16 deletions completion/bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

_ck8s_command_ck8s() {
opts+=("init")
opts+=("bootstrap")
opts+=("apps")
opts+=("apply")
opts+=("test")
opts+=("dry-run")
Expand All @@ -18,20 +16,6 @@ _ck8s_command_ck8s() {
COMPREPLY=($(compgen -W "${opts[*]}" -- ${cur}))
}

_ck8s_command_ck8s_bootstrap() {
local opts=()
opts+=("sc")
opts+=("wc")
COMPREPLY=( $(compgen -W "${opts[*]}" -- ${cur}) )
}

_ck8s_command_ck8s_apps() {
local opts=()
opts+=("sc")
opts+=("wc")
COMPREPLY=( $(compgen -W "${opts[*]}" -- ${cur}) )
}

_ck8s_command_ck8s_apply() {
local opts=()
opts+=("sc")
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions helmfile.d/stacks/harbor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ templates:
installed: {{ and (.Values | get "harbor.enabled" false) (.Values | get "networkPolicies.harbor.enabled" false) }}
labels:
netpol: harbor
needs:
- kube-system/admin-namespaces
values:
- values/networkpolicies/common/common.yaml.gotmpl
- values/networkpolicies/service/harbor.yaml.gotmpl
Expand Down
4 changes: 4 additions & 0 deletions helmfile.d/stacks/hnc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ templates:
- template: networkpolicies
labels:
netpol: hnc
needs:
- kube-system/admin-namespaces
values:
- values/networkpolicies/common/common.yaml.gotmpl
- values/networkpolicies/workload/hnc.yaml.gotmpl
Expand All @@ -23,6 +25,8 @@ templates:
chart: charts/hnc/config-and-crds
version: 0.1.0
name: hnc-config-and-crds
needs:
- kube-system/admin-namespaces
values:
- values/hnc/controller.yaml.gotmpl

Expand Down
Loading

0 comments on commit 6ba947e

Please sign in to comment.