Skip to content

Commit

Permalink
Merge pull request #4 from sailthru/remove_single_namespace_var
Browse files Browse the repository at this point in the history
Removing the ambassador_namespace_single variable
  • Loading branch information
jnichols3 authored Feb 28, 2020
2 parents 0037b72 + 64d4bf9 commit edcb890
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 391 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ module "ambassador" {
| ambassador_image | Ambassador_image Image | string | `quay.io/datawire/ambassador` | no |
| ambassador_image_tag | Ambassador_image image tag | string | `0.40.2` | no |
| ambassador_namespace_name | Set the AMBASSADOR_NAMESPACE environment variable | string | `metadata.namespace` | no |
| ambassador_namespace_single | Set the AMBASSADOR_SINGLE_NAMESPACE environment variable | string | `false` | no |
| cluster_role_name | Set cluster rolne name, defaults to name | string | `` | no |
| daemon_set | If true Create a daemonSet. By default Deployment controller will be created | string | `false` | no |
| exporter_configuration | Prometheus exporter configuration in YALM format | string | `` | no |
Expand Down
193 changes: 1 addition & 192 deletions daemonset.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Create a deployment for the service
resource "kubernetes_daemonset" "this" {
count = "${var.daemon_set && ! var.ambassador_namespace_single ? 1 : 0}"
count = "${var.daemon_set ? 1 : 0}"

metadata {
name = "${var.name}"
Expand Down Expand Up @@ -107,197 +107,6 @@ resource "kubernetes_daemonset" "this" {
name = "AMBASSADOR_ID"
value = "${var.ambassador_id}"
},
{
name = "AMBASSADOR_SINGLE_NAMESPACE"
value = "${var.ambassador_namespace_single}"
},
{
name = "AMBASSADOR_DEBUG"
value = "${var.ambassador_debug}"
},
{
name = "AMBASSADOR_NAMESPACE"

value_from = {
field_ref = {
field_path = "${var.ambassador_namespace_name}"
}
}
},
]

port = [
{
name = "http"
container_port = 80
protocol = "TCP"
},
{
name = "https"
container_port = 443
protocol = "TCP"
},
{
name = "admin"
container_port = 8877
protocol = "TCP"
},
]

liveness_probe = [
{
initial_delay_seconds = 3
success_threshold = 1
timeout_seconds = 1

http_get = [
{
path = "/ambassador/v0/check_alive"
port = 8877
scheme = "HTTP"
},
]
},
]

readiness_probe = [
{
initial_delay_seconds = 3
success_threshold = 1
timeout_seconds = 1

http_get = [
{
path = "/ambassador/v0/check_ready"
port = 8877
scheme = "HTTP"
},
]
},
]
},
]
},
]
}
}

depends_on = ["kubernetes_namespace.this", "kubernetes_service_account.this"]
}

# Create a deployment for the service
resource "kubernetes_daemonset" "this_namespace_single" {
count = "${var.daemon_set && var.ambassador_namespace_single ? 1 : 0}"

metadata {
name = "${var.name}"
namespace = "${var.namespace_name}"
}

spec {
selector {
app = "${var.name}"
}

template {
metadata {
annotations {
"sidecar.istio.io/inject" = false
"prometheus.io/port" = "9102"
"prometheus.io/scrape" = true
}

labels = [
{
terrafrom = "true"
},
{
app = "${var.name}"
},
]
}

spec = [
{
service_account_name = "${var.name}"
restart_policy = "Always"

volume = [
{
name = "stats-exporter-mapping-config"

config_map = {
name = "${var.name}-config"

items = [
{
key = "exporterConfiguration"
path = "mapping-config.yaml"
},
]
}
},
]

container = [
{
name = "${var.name}-statsd-sink"
image = "${var.exporter_image}:${var.exporter_image_tag}"
image_pull_policy = "${var.image_pull_policy}"

args = [
"-statsd.listen-address=:8125",
"-statsd.mapping-config=/statsd-exporter/mapping-config.yaml",
]

port = [
{
container_port = 9102
name = "metrics"
protocol = "TCP"
},
{
container_port = 8125
name = "listener"
protocol = "TCP"
},
]

volume_mount = [
{
mount_path = "/statsd-exporter/"
name = "stats-exporter-mapping-config"
read_only = true
},
]
},
{
name = "${var.name}"
image = "${var.ambassador_image}:${var.ambassador_image_tag}"
image_pull_policy = "${var.image_pull_policy}"
termination_message_path = "/dev/termination-log"

resources {
requests {
memory = "${var.resources_requests_memory}"
cpu = "${var.resources_requests_cpu}"
}

limits {
memory = "${var.resources_limits_memory}"
cpu = "${var.resources_limits_cpu}"
}
}

env = [
{
name = "AMBASSADOR_ID"
value = "${var.ambassador_id}"
},
{
name = "AMBASSADOR_SINGLE_NAMESPACE"
value = "${var.ambassador_namespace_single}"
},
{
name = "AMBASSADOR_DEBUG"
value = "${var.ambassador_debug}"
Expand Down
Loading

0 comments on commit edcb890

Please sign in to comment.