Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement(k8s): remove old system garden and improve local-k8s star…
…tup time (#5136) * refactor: move constant `defaultSystemNamespace` to `constants.ts` * chore: helpers for nginx integration * refactor: re-arrange the list of the supported contexts * chore: helper to apply manifests from yaml files --- Co-authored-by: Vladimir Vagaytsev <[email protected]> * chore(wip): getting rid of system services --- Co-authored-by: Vladimir Vagaytsev <[email protected]> * chore: rename some nginx deploy configs * chore: rename some nginx deploy configs Remove `garden` from the names. These configs will be converted to the standard k8s configs. * chore: move nginx configs to `static/kubernetes` These configs must be converted to the standard k8s configs. * fix(k8s): (wip) convert garden nginx deploy configs to k8s manifests * chore: change file extension `yml` -> `yaml` * refactor(k8s): (wip) split provider and environment config handlers * fix(k3s): (wip) add missing nginx configuration * fix(k8s): argument type for env config handler * refactor(k8s): named type for k8s cluster type * chore: remove unused constant * chore: defensive type-check for k8s cluster type * docs: update RBAC config guide * chore: fix compile errors * fix(k8s): use standard `getEnvironmentStatus` to ensure namespaces * chore: add missing sha256 hash * refactor: extract getter to build values for nginx helm chart * refactor: extract some named constants * refactor(k3s): gardenless k3s nginx setup Convert `static/kubernetes/nginx-k3s.yaml` to function `getK3sNginxHelmValues`. * refactor: gardenless ephemeral nginx setup Convert `static/kubernetes/nginx-ephemeral.yaml` to function `getEphemeralNginxHelmValues`. * chore: remove duplicate `--namespace` arg It will be set by `helm` function. * chore: remove garden config for system services * fix: pass helm values in the proper format * chore: remove unnecessary field from `LocalKubernetesConfig` * chore: use explicit types for local k8s configs * chore: do not install default nginx for local k8s clusters A cluster-type specific installation will be done separately. * chore: install and uninstall defaultBackend with nginx ingress controller * chore: drop kind nginx support for old k8s versions (< 1.21) * chore: fix ephemeral kubernetes * chore: rename function * chore: refactor installing ingress controllers * refactor: rename module `integrations` => `nginx` * refactor: extract new file `default-backend.ts` To store default backend specific functions. * refactor: rename file `nginx.ts` => `ingress-controller.ts` Let the name be more specific. * chore: use defensive type-checks * fix: use specific helm values for k3s and generic cluster types * chore: remove unnecessary calls of `defaultBackendInstall` It's already called from inside `helmNginxInstall`. * chore: remove unnecessary calls of `defaultBackendUninstall` It's already called from inside `helmNginxUninstall`. * chore: narrowed local var scope * chore: re-arranged code * refactor: extract named constant for Garden default-backend image * chore: use named constant instead of hard-coded string * chore: use `systemNamespace` var instead of hard-coded string * refactor: move helm nginx helpers to the dedicated file For better modularity and readability. * refactor: move generic cluster nginx code to a dedicated file For better modularity and readability. * refactor: move k3s cluster nginx code to a dedicated file For better modularity and readability. * refactor: move microk8s cluster nginx code to a dedicated file For better modularity and readability. * refactor: move minikube cluster nginx code to a dedicated file For better modularity and readability. * chore: rename file `nginx-kind.ts` => `nginx-kind-manifests.ts` * chore: move `nginx-kind-manifests.ts` to `nginx` package * refactor: move kind cluster nginx code to a dedicated file For better modularity and readability. * refactor: move ephemeral cluster nginx code to a dedicated file For better modularity and readability. * refactor: extract function `helmIngressControllerReady` To reduce code repetition. It checks the readiness of ingress controller and default backend. * chore: narrow scope of some local vars * chore(k8s): remove unused static resources * fix(k8s): uninstall only the ingress controller installed by Garden We should only remove it if it was installed by Garden or this specific Garden project in the first place. Co-authored-by: Anna Mager <[email protected]> * chore: remove unused function * refactor: make `getClusterType` side-effect free function * fix(ephemeral): restore ingress controller installation * refactor: more granular cluster types Another one wiil be added for ephemeral cluster. * chore: spacing + inline redundant local var * refactor: configure ingress controllers in a single place Always use base kubernetes provider's `prepareEnvironment` handler to configure cluster-type-specific ingress controllers. * refactor: ensure system namespace in the base kubernetes handler To avoid repetitive code in the child-plugins. * chore: use correct section name in logger * chore: replace if/else with ternary operator * chore: add some integ tests around ingress controllers * chore: check status of main ingress controller deployed resources * chore: wait for all nginx resources to be ready * chore: explicit type for nginx helm values * refactor: extract helper function `getNginxHelmMainResource` * refactor: move constant to a dedicated file Also applied a specific type. * chore: use ESM imports (post-rebase corrections) * chore: use narrow-typed named constants as Docker image names * refactor: (1) introduce interface and classes for ingress setup For DRY, better readability snf maintainability. * refactor: (2) use interface and classes for ingress setup * refactor: (3) remove unnecessary exports * refactor: (4) inline functions into class methods * refactor: (5) inline functions into class methods * refactor: (6) convert interface to abstract class * refactor: (7) introduce abstract method * refactor: (8) inline functions into class methods * chore: move `GardenIngressController` to standalone file To avoid circular imports. * refactor: (9) convert default backend functions to class * refactor: (10) inline functions into class methods * chore: more generic name for the ABC * chore: re-arranged code * refactor: (11) inline functions into class methods * refactor: (12) change signature of `helmValuesGetter` * refactor: (13) replace conditional logic with polymorphism * refactor: rename method * chore: add deprecation warning for `plugin kubernetes init-cluster` command --------- Co-authored-by: Jon Edvald <[email protected]> Co-authored-by: Anna Mager <[email protected]> Co-authored-by: Anna Mager <[email protected]>
- Loading branch information