Skip to content

Commit

Permalink
feat: added optional property to set k8s patch version (#18)
Browse files Browse the repository at this point in the history
* feat: added option to configure K8s patch versions

Signed-off-by: leonsteinhaeuser <leon.steinhaeuser@tagesspiegel.de>

* docs: updated auto generated documentation

Signed-off-by: leonsteinhaeuser <leon.steinhaeuser@tagesspiegel.de>

---------

Signed-off-by: leonsteinhaeuser <leon.steinhaeuser@tagesspiegel.de>
  • Loading branch information
leonsteinhaeuser authored Mar 7, 2024
1 parent 02bfb70 commit 78b3a5b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ No modules.
| <a name="input_cluster_update_window"></a> [cluster\_update\_window](#input\_cluster\_update\_window) | The update window for the cluster. If set to null, no update window will be set. | <pre>object({<br> start = string<br> length = string<br> })</pre> | `null` | no |
| <a name="input_dc_name"></a> [dc\_name](#input\_dc\_name) | Datacenter name at SysEleven (DBl, ...) | `string` | `"syseleven-dbl1"` | no |
| <a name="input_default_priority_classes_enabled"></a> [default\_priority\_classes\_enabled](#input\_default\_priority\_classes\_enabled) | Enable the creation of the default priority classes. If set to false, the default priority classes will not be created. Default priority classes are: ingress-critical (100000000), monitoring-critical (99900000), logging-critical (99800000), platform-critical (99700000) | `bool` | `true` | no |
| <a name="input_k8s_version"></a> [k8s\_version](#input\_k8s\_version) | Version of the created K8s Cluster (see available version in Metakube) | <pre>object({<br> major = number<br> minor = number<br> })</pre> | <pre>{<br> "major": 1,<br> "minor": 26<br>}</pre> | no |
| <a name="input_k8s_version"></a> [k8s\_version](#input\_k8s\_version) | Version of the created K8s Cluster (see available version in Metakube) | <pre>object({<br> major = number<br> minor = number<br> patch = optional(number)<br> })</pre> | <pre>{<br> "major": 1,<br> "minor": 28<br>}</pre> | no |
| <a name="input_metakube_project_id"></a> [metakube\_project\_id](#input\_metakube\_project\_id) | The ID of the metakube project | `string` | n/a | yes |
| <a name="input_node_pools"></a> [node\_pools](#input\_node\_pools) | List all node pools that should be created in the cluster | <pre>map(object({<br> replicas = object({<br> min = number<br> max = number<br> })<br> labels = optional(map(string))<br> os_config = object({<br> image = string<br> auto_update = bool<br> })<br> node_config = object({<br> flavor = string<br> use_floating_ip = bool<br> })<br> taints = optional(list(object({<br> key = string<br> value = string<br> effect = string<br> })))<br> }))</pre> | n/a | yes |
| <a name="input_openstack_application_credential_id"></a> [openstack\_application\_credential\_id](#input\_openstack\_application\_credential\_id) | The OpenStack application credential ID to use for the metakube cluster | `string` | n/a | yes |
Expand Down
9 changes: 7 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ data "metakube_k8s_version" "cluster" {
minor = var.k8s_version.minor
}

locals {
k8s_api_version = var.k8s_version.patch != null ? "${var.k8s_version.major}.${var.k8s_version.minor}.${var.k8s_version.patch}" : data.metakube_k8s_version.cluster.version
}


// define and create the cluster
resource "metakube_cluster" "this" {
name = var.cluster_name
Expand All @@ -12,7 +17,7 @@ resource "metakube_cluster" "this" {

spec {
enable_ssh_agent = false
version = data.metakube_k8s_version.cluster.version
version = local.k8s_api_version
cloud {
openstack {
application_credentials {
Expand Down Expand Up @@ -54,7 +59,7 @@ resource "metakube_node_deployment" "this" {
max_replicas = each.value.replicas.max
template {
versions {
kubelet = data.metakube_k8s_version.cluster.version
kubelet = local.k8s_api_version
}
labels = each.value.labels == null ? {} : each.value.labels
operating_system {
Expand Down
3 changes: 2 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ variable "k8s_version" {
type = object({
major = number
minor = number
patch = optional(number)
})
default = {
major = 1
minor = 26
minor = 28
}
}

Expand Down

0 comments on commit 78b3a5b

Please sign in to comment.