Skip to content

feat: INFRA-6 Added support for reserved resources #16

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.terraform.lock.hcl
.terraform/
14 changes: 13 additions & 1 deletion kubespray/configurations/k8s_cluster/k8s-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,16 @@ event_ttl_duration: "1h0m0s"
## Automatically renew K8S control plane certificates on first Monday of each month
auto_renew_certificates: false
# First Monday of each month
# auto_renew_certificates_systemd_calendar: "Mon *-*-1,2,3,4,5,6,7 03:{{ groups['kube_control_plane'].index(inventory_hostname) }}0:00"
# auto_renew_certificates_systemd_calendar: "Mon *-*-1,2,3,4,5,6,7 03:{{ groups['kube_control_plane'].index(inventory_hostname) }}0:00"

%{ if workers_system_reserved_resources.cpu != "" || workers_system_reserved_resources.memory != "" || workers_system_reserved_resources.ephemeral_storage != "" || workers_kube_reserved_resources.cpu != "" || workers_kube_reserved_resources.memory != "" || workers_kube_reserved_resources.ephemeral_storage != "" ~}
kubelet_node_config_extra_args:
systemReserved:
cpu: ${workers_system_reserved_resources.cpu}
memory: ${workers_system_reserved_resources.memory}
ephemeral-storage: ${workers_system_reserved_resources.ephemeral_storage}
kubeReserved:
cpu: ${workers_kube_reserved_resources.cpu}
memory: ${workers_kube_reserved_resources.memory}
ephemeral-storage: ${workers_kube_reserved_resources.ephemeral_storage}
%{ endif ~}
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ resource "null_resource" "kubernetes_installation" {
artifacts_dir = var.artifacts_path
load_balancer_ips = var.load_balancer_ips
kubernetes_version = var.k8_version
workers_kube_reserved_resources = var.workers_kube_reserved_resources
workers_system_reserved_resources = var.workers_kube_reserved_resources
}
)
destination = "${var.provisioning_path}/inventory/deployment/group_vars/k8s_cluster/k8s-cluster.yml"
Expand Down
30 changes: 30 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,34 @@ variable "ingress_arguments" {
description = "List of arguments to pass to the nginx ingress. Hyphens should be included in the values."
type = list(string)
default = []
}

//See: https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#kube-reserved
variable "workers_kube_reserved_resources" {
description = "Resources that should be reserved for kubernetes system deamons (kubelet, container runtime, etc) on workers"
type = object({
cpu = string,
memory = string,
ephemeral_storage = string,
})
default = {
cpu = ""
memory = ""
ephemeral_storage=""
}
}

//See: https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#system-reserved
variable "workers_system_reserved_resources" {
description = "Resources that should be reserved for os system deamons (kubelet, container runtime, etc) on workers"
type = object({
cpu = string,
memory = string,
ephemeral_storage = string,
})
default = {
cpu = ""
memory = ""
ephemeral_storage=""
}
}