This Jenkins job allows you to manage Kubernetes tags, specifically the "do_not_scale_down" label, in a project.
The job provides functionality to get tags, add a tag, and delete a tag from a specified Kubernetes namespace.
Main purpose
The main purpose of this job is to control the shutdown behavior of the namespace based on the presence of the "do_not_scale_down" tag. When the "do_not_scale_down" tag is assigned to a namespace, it prevents the namespace from being shut down during nights and weekends.
Additionally, the tag will be automatically removed on Mondays.
Job Parameters
The job requires the following parameters to be provided when running:
- action: Choose the action to be performed with the "do_not_scale_down" label. Valid choices are "get", "add", and "delete".
- clusterName: Select the target cluster where the Kubernetes namespace is located.
- projectName: Select the target project where the Kubernetes namespace is located.
Actions
Get: Retrieves the tags from the specified Kubernetes namespace and displays them. If the "do_not_scale_down" tag exists, it will be added to the job description for reference.
Add: Adds the "do_not_scale_down" tag to the specified Kubernetes namespace.
Delete: Removes the "do_not_scale_down" tag from the specified Kubernetes namespace.
Usage
Select the Jenkins job and click on "Build with Parameters" to provide the required input.
Choose the desired action from the available options: "get", "add", or "delete".
Select the target cluster by choosing the appropriate option from the "clusterName" parameter dropdown.
Select the target project by choosing the appropriate option from the "projectName" parameter dropdown.
Click on "Build" to execute the job with the provided parameters
Examples
Get action:
- action: get
- clusterName: dev
- projectName: unam
This will retrieve the tags from the Kubernetes namespace in the "unam" project of the "dev" cluster. If the "do_not_scale_down" tag exists, it will be displayed in the job description.
Add action:
- action: add
- clusterName: dev
- projectName: unam
This will add the "do_not_scale_down" tag to the Kubernetes namespace in the "unam" project of the "dev" cluster.
Delete action:
- action: delete
- clusterName: dev
- projectName: unam
This will remove the "do_not_scale_down" tag from the Kubernetes namespace in the "unam" project of the "dev" cluster.