From 041b72137e748afee77b03c368fe72c50483f6b4 Mon Sep 17 00:00:00 2001 From: rpoluri <38321430+rpoluri@users.noreply.github.com> Date: Fri, 7 Jan 2022 11:33:39 -0600 Subject: [PATCH] Feature/headless service (#99) * add headless service * update changelog Co-authored-by: Raj Poluri --- CHANGELOG.md | 3 +++ k8s.tf | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59b03f9..b2006c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ 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). +## [3.3.15] - 2022-01-06 +- Add k8s headless service, so that clients running in k8s cluster can connect to a WD container instead of virtual ip. + ## [3.3.14] - 2021-12-16 - Set env var `LOG4J_FORMAT_MSG_NO_LOOKUPS=”true”` for WD containers for log4j-shell bug. diff --git a/k8s.tf b/k8s.tf index 897eccd..ad64d4a 100644 --- a/k8s.tf +++ b/k8s.tf @@ -131,3 +131,22 @@ resource "kubernetes_service" "waggle_dance" { load_balancer_source_ranges = var.ingress_cidr } } + +resource "kubernetes_service" "waggle_dance_headless" { + count = var.wd_instance_type == "k8s" ? 1 : 0 + metadata { + name = "${local.instance_alias}-headless" + namespace = var.k8s_namespace + } + spec { + selector = { + name = local.instance_alias + } + port { + port = local.wd_port + target_port = local.wd_port + } + type = "ClusterIP" + cluster_ip = "None" + } +}