diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0e60562..8182857 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## [7.5.0] - 2024-10-15
+### Added
+- Added varaibles `hms_rw_k8s_pdb_settings` and `hms_ro_k8s_pdb_settings` to specify HMS ro and rw PodDisruptionBudget. Uses policy/v1 version which is evailable since kubernetes 1.25+
+- Added variables `hms_rw_k8s_rolling_update_strategy` and `hms_ro_k8s_rolling_update_strategy` to specify Deployment rolling update strategy settings for HMS ro and rw pods.
+
## [7.4.0] - 2024-09-25
### Added
- Added variables `hms_rw_tolerations` and `hms_ro_tolerations` to specify tolerations for the HMS ro and rw pods
diff --git a/VARIABLES.md b/VARIABLES.md
index 2c91a5c..073b710 100644
--- a/VARIABLES.md
+++ b/VARIABLES.md
@@ -70,6 +70,8 @@
| hms\_ro\_heapsize | Heapsize for the read only Hive Metastore.
Valid values: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-cpu-memory-error.html | `string` | `"2048"` | no |
| hms\_ro\_k8s\_replica\_count | Initial Number of read only Hive Metastore k8s pod replicas to create. | `number` | `"2048"` | no |
| hms\_ro\_k8s\_max\_replica\_count | Max Number of read only Hive Metastore k8s pod replicas to create. | `number` | `"2048"` | no |
+| hms\_rw\_k8s\_pdb\_settings | Add PodDisruptionBudget to the HMS rw pods. | `object` | `max_unavailable = 1` | no |
+| hms\_rw\_k8s\_rolling\_update\_strategy | Configure HMS RW deployment rolling strategy. | `object` | `max_unavailable = 1` | no |
| hms\_ro\_target\_cpu\_percentage | Read only Hive Metastore autoscaling threshold for CPU target usage. | `number` | `"2048"` | no |
| hms\_ro\_request\_partition\_limit | Read only Hive Metastore limits of request partitions. | `string` | n/a | no |
| hms\_ro\_node\_affinity | Add node affinities to the Hive metastore pods. | `list(object)` | n/a | no |
@@ -79,6 +81,8 @@
| hms\_rw\_ecs\_task\_count | Desired ECS task count of the read/write Hive Metastore service. | `string` | `"3"` | no |
| hms\_rw\_heapsize | Heapsize for the read/write Hive Metastore.
Valid values: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-cpu-memory-error.html | `string` | `"2048"` | no |
| hms\_rw\_k8s\_replica\_count | Initial Number of read/write Hive Metastore k8s pod replicas to create. | `number` | `"2048"` | no |
+| hms\_rw\_k8s\_pdb\_settings | Add PodDisruptionBudget to the HMS rw pods. | `object` | `max_unavailable = 1` | no |
+| hms\_rw\_k8s\_rolling\_update\_strategy | Configure HMS RW deployment rolling strategy. | `object` | `max_unavailable = 1` | no |
| hms\_rw\_request\_partition\_limit | Read Write Hive Metastore limits of request partitions. | `string` | n/a | no |
| hms\_rw\_node\_affinity | Add node affinities to the Hive metastore pods. | `list(object)` | n/a | no |
| hms\_rw\_tolerations | Add tolerations to the Hive metastore pods. | `list(object)` | n/a | no |
@@ -356,4 +360,4 @@ apiary_managed_schemas = [
producer_roles = "arn:aws:iam::000000000:role/role-1,arn:aws:iam::000000000:role/role-2"
}
]
-```
+```
\ No newline at end of file
diff --git a/k8s-readonly.tf b/k8s-readonly.tf
index da0a238..c659db1 100644
--- a/k8s-readonly.tf
+++ b/k8s-readonly.tf
@@ -16,6 +16,13 @@ resource "kubernetes_deployment_v1" "apiary_hms_readonly" {
}
spec {
+ strategy {
+ type = "RollingUpdate"
+ rolling_update {
+ max_surge = var.hms_ro_k8s_rolling_update_strategy.max_surge
+ max_unavailable = var.hms_ro_k8s_rolling_update_strategy.max_unavailable
+ }
+ }
replicas = var.hms_ro_k8s_replica_count
selector {
match_labels = {
@@ -348,3 +355,24 @@ data "aws_lb" "k8s_hms_ro_lb" {
count = var.hms_instance_type == "k8s" && var.enable_vpc_endpoint_services ? 1 : 0
name = split("-", split(".", kubernetes_service.hms_readonly[0].status.0.load_balancer.0.ingress.0.hostname).0).0
}
+
+resource "kubernetes_pod_disruption_budget_v1" "hms_readonly" {
+ count = var.hms_instance_type == "k8s" && var.hms_ro_k8s_pdb_settings.enabled ? 1 : 0
+
+ metadata {
+ name = "${local.hms_alias}-readonly"
+ namespace = var.metastore_namespace
+ }
+
+ spec {
+ selector {
+ match_labels = {
+ name = "${local.hms_alias}-readonly"
+ }
+ }
+
+ # set max_unavailable to 1 by default if PDB is created
+ max_unavailable = var.hms_ro_k8s_pdb_settings.max_unavailable != null ? var.hms_ro_k8s_pdb_settings.max_unavailable : "1"
+ min_available = var.hms_ro_k8s_pdb_settings.min_available != null ? var.hms_ro_k8s_pdb_settings.min_available : null
+ }
+}
\ No newline at end of file
diff --git a/k8s-readwrite.tf b/k8s-readwrite.tf
index aee28f6..02fcf03 100644
--- a/k8s-readwrite.tf
+++ b/k8s-readwrite.tf
@@ -16,6 +16,13 @@ resource "kubernetes_deployment_v1" "apiary_hms_readwrite" {
}
spec {
+ strategy {
+ type = "RollingUpdate"
+ rolling_update {
+ max_surge = var.hms_rw_k8s_rolling_update_strategy.max_surge
+ max_unavailable = var.hms_rw_k8s_rolling_update_strategy.max_unavailable
+ }
+ }
replicas = var.hms_rw_k8s_replica_count
selector {
match_labels = {
@@ -366,3 +373,24 @@ data "aws_lb" "k8s_hms_rw_lb" {
count = var.hms_instance_type == "k8s" && var.enable_vpc_endpoint_services ? 1 : 0
name = split("-", split(".", kubernetes_service.hms_readwrite[0].status.0.load_balancer.0.ingress.0.hostname).0).0
}
+
+resource "kubernetes_pod_disruption_budget_v1" "hms_readwrite" {
+ count = var.hms_instance_type == "k8s" && var.hms_rw_k8s_pdb_settings.enabled ? 1 : 0
+
+ metadata {
+ name = "${local.hms_alias}-readwrite"
+ namespace = var.metastore_namespace
+ }
+
+ spec {
+ selector {
+ match_labels = {
+ name = "${local.hms_alias}-readwrite"
+ }
+ }
+
+ # set max_unavailable to 1 by default if PDB is created
+ max_unavailable = var.hms_rw_k8s_pdb_settings.max_unavailable != null ? var.hms_rw_k8s_pdb_settings.max_unavailable : "1"
+ min_available = var.hms_rw_k8s_pdb_settings.min_available != null ? var.hms_rw_k8s_pdb_settings.min_available : null
+ }
+}
\ No newline at end of file
diff --git a/variables.tf b/variables.tf
index 20c3fe9..5774ad2 100644
--- a/variables.tf
+++ b/variables.tf
@@ -394,6 +394,58 @@ variable "hms_ro_k8s_max_replica_count" {
default = 10
}
+variable "hms_ro_k8s_rolling_update_strategy" {
+ description = "Rolling update strategy settings for HMS RO including max_surge and max_unavailable"
+ type = object({
+ max_surge = string
+ max_unavailable = string
+ })
+ default = {
+ max_surge = "25%"
+ max_unavailable = "25%"
+ }
+}
+
+variable "hms_rw_k8s_rolling_update_strategy" {
+ description = "Rolling update strategy settings for HMS RW including max_surge and max_unavailable"
+ type = object({
+ max_surge = string
+ max_unavailable = string
+ })
+ default = {
+ max_surge = "25%"
+ max_unavailable = "25%"
+ }
+}
+
+variable "hms_ro_k8s_pdb_settings" {
+ description = "PDB settings for HMS RO including enable flag, maxUnavailable, and minAvailable."
+ type = object({
+ enabled = bool
+ max_unavailable = string
+ min_available = string
+ })
+ default = {
+ enabled = false
+ max_unavailable = null
+ min_available = null
+ }
+}
+
+variable "hms_rw_k8s_pdb_settings" {
+ description = "PDB settings for HMS RW including enable flag, maxUnavailable, and minAvailable."
+ type = object({
+ enabled = bool
+ max_unavailable = string
+ min_available = string
+ })
+ default = {
+ enabled = false
+ max_unavailable = null
+ min_available = null
+ }
+}
+
variable "hms_rw_node_affinity" {
description = <