Skip to content

Commit

Permalink
Merge pull request #47 from githubjianli/patch-3
Browse files Browse the repository at this point in the history
feat: upgrade k8s api to work with latest kubernetes provider
  • Loading branch information
abhimanyugupta07 authored Nov 16, 2023
2 parents 98a3e69 + 9c1a4d3 commit 8110beb
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ 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).

## [5.0.0] - 2023-11-16
### Changed
- Upgdate k8s API to work with 2.x version:
- `kubernetes_deployment` to `kubernetes_deployment_v1`
- `kubernetes_ingress` to `kubernetes_ingress_v1`
- Update terrafrom `map` function to `tomap`(`map` function has been deprecated in `0.12` version).

## [4.0.1] - 2023-09-18
### Changed
- Increase k8s provider version to `~>2.7.0` (was `~>1.0.0`). Fixes issue with K8S upgrade and error: 'Failed to create Ingress'.
Expand Down
4 changes: 4 additions & 0 deletions ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ resource "aws_ecs_service" "beekeeper_scheduler_apiary" {
task_definition = aws_ecs_task_definition.beekeeper_scheduler_apiary.*.arn[0]
desired_count = 1
launch_type = "FARGATE"
propagate_tags = "SERVICE"
tags = var.beekeeper_tags

network_configuration {
security_groups = [aws_security_group.beekeeper_sg.id]
Expand All @@ -31,6 +33,8 @@ resource "aws_ecs_service" "beekeeper_path_cleanup" {
task_definition = aws_ecs_task_definition.beekeeper_path_cleanup.*.arn[0]
desired_count = 1
launch_type = "FARGATE"
propagate_tags = "SERVICE"
tags = var.beekeeper_tags

network_configuration {
security_groups = [aws_security_group.beekeeper_sg.id]
Expand Down
2 changes: 1 addition & 1 deletion k8s-api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}
}

resource "kubernetes_deployment" "beekeeper_api" {
resource "kubernetes_deployment_v1" "beekeeper_api" {
count = var.instance_type == "k8s" ? 1 : 0
metadata {
name = local.api_full_name
Expand Down
2 changes: 1 addition & 1 deletion k8s-metadata-cleanup.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}
}

resource "kubernetes_deployment" "beekeeper_metadata_cleanup" {
resource "kubernetes_deployment_v1" "beekeeper_metadata_cleanup" {
count = var.instance_type == "k8s" ? 1 : 0
metadata {
name = local.metadata_cleanup_full_name
Expand Down
2 changes: 1 addition & 1 deletion k8s-path-cleanup.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}
}

resource "kubernetes_deployment" "beekeeper_path_cleanup" {
resource "kubernetes_deployment_v1" "beekeeper_path_cleanup" {
count = var.instance_type == "k8s" ? 1 : 0
metadata {
name = local.path_cleanup_full_name
Expand Down
2 changes: 1 addition & 1 deletion k8s-scheduler-apiary.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ locals {
}
}

resource "kubernetes_deployment" "beekeeper_scheduler_apiary" {
resource "kubernetes_deployment_v1" "beekeeper_scheduler_apiary" {
count = var.instance_type == "k8s" ? 1 : 0
metadata {
name = local.scheduler_apiary_full_name
Expand Down
20 changes: 13 additions & 7 deletions k8s.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ locals {
}
}

resource "kubernetes_ingress" "beekeeper" {
resource "kubernetes_ingress_v1" "beekeeper" {
count = var.instance_type == "k8s" && var.k8s_ingress_enabled == 1 ? 1 : 0
metadata {
name = local.k8s_app_alias
Expand All @@ -33,8 +33,10 @@ resource "kubernetes_ingress" "beekeeper" {
path {
path = var.k8s_path_cleanup_ingress_path
backend {
service_name = kubernetes_service.beekeeper_path_cleanup[0].metadata[0].name
service_port = kubernetes_service.beekeeper_path_cleanup[0].spec[0].port[0].target_port
name = kubernetes_service.beekeeper_path_cleanup[0].metadata[0].name
port {
number = kubernetes_service.beekeeper_path_cleanup[0].spec[0].port[0].target_port
}
}
}
}
Expand All @@ -46,8 +48,10 @@ resource "kubernetes_ingress" "beekeeper" {
path {
path = var.k8s_metadata_cleanup_ingress_path
backend {
service_name = kubernetes_service.beekeeper_metadata_cleanup[0].metadata[0].name
service_port = kubernetes_service.beekeeper_metadata_cleanup[0].spec[0].port[0].target_port
name = kubernetes_service.beekeeper_metadata_cleanup[0].metadata[0].name
port {
number = kubernetes_service.beekeeper_metadata_cleanup[0].spec[0].port[0].target_port
}
}
}
}
Expand All @@ -59,8 +63,10 @@ resource "kubernetes_ingress" "beekeeper" {
path {
path = var.k8s_scheduler_apiary_ingress_path
backend {
service_name = kubernetes_service.beekeeper_scheduler_apiary[0].metadata[0].name
service_port = kubernetes_service.beekeeper_scheduler_apiary[0].spec[0].port[0].target_port
name = kubernetes_service.beekeeper_scheduler_apiary[0].metadata[0].name
port {
number = kubernetes_service.beekeeper_scheduler_apiary[0].spec[0].port[0].target_port
}
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions rds.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ resource "aws_db_subnet_group" "beekeeper_db_subnet_group" {
subnet_ids = var.rds_subnets
description = "Beekeeper DB Subnet Group for ${local.instance_alias}"

tags = merge(var.beekeeper_tags,
map("Name", "Beekeeper DB Subnet Group"))
tags = merge(var.beekeeper_tags,tomap({"Name"="Beekeeper DB Subnet Group"}))
}

resource "aws_security_group" "beekeeper_db_sg" {
Expand Down

0 comments on commit 8110beb

Please sign in to comment.