Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Downager committed Nov 1, 2023
1 parent 910af4c commit d233e16
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
2 changes: 2 additions & 0 deletions modules/containerd/files/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version = 2
[debug]
level = "${log_level}"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
5 changes: 3 additions & 2 deletions modules/containerd/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ data "ignition_file" "containerd_config" {
overwrite = true

content {
content = file("${path.module}/files/config.toml")
content = templatefile("${path.module}/files/config.toml", {
log_level = var.log_level
})
}

}

data "ignition_file" "crictl_config" {
Expand Down
5 changes: 5 additions & 0 deletions modules/containerd/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
variable "log_level" {
description = "(Optional) containerd log level (trace, debug, info, warn, error, fatal, panic), default is info"
type = string
default = "info"
}
3 changes: 2 additions & 1 deletion modules/docker/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
locals {
docker_opts = concat(var.docker_opts, ["--log-level", var.log_level])
docker_cgroup = concat(var.docker_cgroups, var.docker_cgroup_driver == "systemd" ? ["--exec-opt native.cgroupdriver=systemd"] : [""])
}

Expand All @@ -9,7 +10,7 @@ data "ignition_systemd_unit" "docker_dropin" {
dropin {
name = "10-dockeropts.conf"
content = templatefile("${path.module}/templates/10-dockeropts.conf.tpl", {
docker_opts = join(" ", var.docker_opts)
docker_opts = join(" ", local.docker_opts)
docker_cgroups = join(" ", local.docker_cgroup)
})
}
Expand Down
6 changes: 6 additions & 0 deletions modules/docker/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ variable "docker_cgroups" {
variable "docker_cgroup_driver" {
type = string
default = "cgroupfs"
}

variable "log_level" {
description = "(Optional) Docker daemon log level (debug, info, warn, error, fatal), default is info"
type = string
default = "info"
}
6 changes: 1 addition & 5 deletions modules/systemd-networkd/main.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# the systemd-networkd configuration file 10-eni.network and 10-eth.network need to be adjusted after systemd updated
# Reference: https://github.com/aws/amazon-vpc-cni-k8s/issues/1600

locals {
systemd_log_level = var.debug ? "debug" : "warning"
}

data "ignition_file" "systemd_networkd_log_level" {

mode = 420
Expand All @@ -13,7 +9,7 @@ data "ignition_file" "systemd_networkd_log_level" {

content {
content = templatefile("${path.module}/templates/10-log-level.conf.tpl", {
log_level = local.systemd_log_level
log_level = var.log_level
})
}
}
Expand Down
8 changes: 4 additions & 4 deletions modules/systemd-networkd/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variable "debug" {
description = "(Optional) Enable CoreOS Systemd Networkd debug log or not"
type = bool
default = false
variable "log_level" {
description = "(Optional) The systemd-networkd log level, default is warning"
type = string
default = "warning"
}

variable "manage_foreign_policy" {
Expand Down

0 comments on commit d233e16

Please sign in to comment.