Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature: Use KubeDownscaler Without Cluster Wide Access (Namespaced Access) #73

Merged
merged 27 commits into from
Jul 22, 2024

Conversation

samuel-esp
Copy link
Collaborator

@samuel-esp samuel-esp commented Jul 20, 2024

Motivation

This Pull Request will enable users use KubeDownscaler Without Cluster Wide Access (Namespaced Access).

Changes

Python Code:

  • --namespace argument will now accept a list of string
  • Introduced constrianed_downscaler variable that will be automatically set to true if --namespace arg is specified
  • --namespace and --exclude-namespaces are now mutually exclusive, --namespace will take precedence and override --exclude-namespaces.
  • --namespace and --admission-controller are now mutually exclusive, the user will still be able to downscale jobs natively as specified inside pull request Scale Jobs Natively (Without Admission Controllers) #71
  • If --namespace arg is specified, the Kubernetes API Server will receive different API Calls that don't target Cluster Wide operations
  • Added 403 and 404 error handling to API Calls
  • refactored unit tests

Docs:

  • Explained how to use KubeDownscaler without cluster wide access (installation and recommendations on how to set parameters and which mode to choose)

Helm Chart

  • Introduced 2 parameters inside values.yaml (constrainedDownscaler, constrainedNamespaces). The first one is boolean value and the second one is a list of namespaces where the KubeDownscaler can operate
  • Added error handling if user specifies constrainedDownscaler without constrainedNamespaces
  • If constrainedDownscaler is true the Helm Chart will deploy a set of Roles and RoleBindings instead of a single ClusterRole and ClusterRoleBinding. This will setup the needed communications to use Constrained Mode
  • Added {{ .Release.Namespace }} to Deployment, ConfigMap and ServiceAccount, in order to help the user to configure a differrent namespace for installation

Tests done

  • Unit tests
  • Built and Used local image

TODO

  • I've assigned myself to this PR

…space-only-access

# Conflicts:
#	chart/templates/rbac.yaml
… api calls. rbac refactored to only include namespaced resources
…ould contain more than 1 element, refactored helm chart
Copy link
Member

@JTaeuber JTaeuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JTaeuber JTaeuber merged commit c217f31 into caas-team:main Jul 22, 2024
1 check passed
JTaeuber pushed a commit that referenced this pull request Jul 22, 2024
…ed Access) (#73)

* facilitates backward compatibility

* docs refactoring

* refactored chart to include constrainted-namespace installation

* refactored chart to include constrainted-namespace installation

* added constrainted downscaler arg inside code

* refactor --namespace argument to be able to handle a list of strings

* refactore autoscale_jobs function

* --namespace object could be only be used with constrainted_downscaler api calls. rbac refactored to only include namespaced resources

* fixed constraintedNamesapce test namespaces inside values.yaml

* added try-except to better log RBAC errors

* helm chart will automaticall add --constrainted-downscaler arg if constraintedDownscaler value is set to true

* added tests

* added log to inform user that using --namespace argument will deactivate --exclude-namespaces

* added error handling inside scaler.py

* refactored namespace argument to namespaces to clarify the variable could contain more than 1 element, refactored helm chart

* refactored docs

* refactored migrate from codeberg docs section

* removed --constrainted-downscaler argument to better help user configurations

* refactored docs

* refactored docs

* refactored docs and constrained variable name

* refactored docs

* added release namespace inside helm chart (deplyoment, configmap and serviceaccount)

* refactored variable names inside helm chart

* refactored variable names inside docs

* improved 403 error handling, changed log.error to log.warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants