Skip to content

Commit

Permalink
Store instance configs in subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
jrauh01 committed Jan 29, 2025
1 parent 0a33634 commit b7e1413
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions systemd/default.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ICINGA_FOR_KUBERNETES_CLUSTER_NAME=default
9 changes: 5 additions & 4 deletions systemd/icinga-kubernetes
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# Allowed values are "all", "none" or a space separated list
# of names of the clusters. If empty, "all" is assumed.
# The cluster name refers to the cluster environment file name.
# i.e. "cluster1" would be /etc/icinga-kubernetes/cluster1.env
# i.e. "test-cluster" would be /etc/icinga-kubernetes/instances/test-cluster.env
#
# Changing this variable will require running "systemctl daemon-reload"
# followed by a restart of the icinga-kubernetes service (if you
# removed entries you may have to stop those manually)
# followed by a restart of the icinga-kubernetes service (if you removed
# entries you may have to stop the corresponding instances manually
# before restarting the service)
#
#AUTOSTART="all"
#AUTOSTART="none"
#AUTOSTART="cluster1 cluster2"
#AUTOSTART="test-cluster prod-cluster"
3 changes: 1 addition & 2 deletions systemd/icinga-kubernetes-generator
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -eu
WANTDIR="$1/icinga-kubernetes.service.wants"
SERVICEFILE="/lib/systemd/system/[email protected]"
AUTOSTART="all"
CONFIG_DIR=/etc/icinga-kubernetes
CONFIG_DIR=/etc/icinga-kubernetes/instances

if [[ ! -d "$WANTDIR" ]]; then
mkdir -p "$WANTDIR"
Expand Down Expand Up @@ -37,4 +37,3 @@ else
fi

exit 0

2 changes: 1 addition & 1 deletion systemd/icinga-kubernetes.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ After=syslog.target network-online.target mariadb.service postgresql.service
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/true
WorkingDirectory=/etc/icinga-kubernetes
WorkingDirectory=/etc/icinga-kubernetes/instances

[Install]
WantedBy=multi-user.target
4 changes: 2 additions & 2 deletions systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ After=syslog.target network-online.target mariadb.service postgresql.service

[Service]
Type=simple
WorkingDirectory=/etc/icinga-kubernetes
WorkingDirectory=/etc/icinga-kubernetes/instances
Environment="ICINGA_FOR_KUBERNETES_CLUSTER_NAME=%i"
EnvironmentFile=/etc/icinga-kubernetes/%i.env
EnvironmentFile=/etc/icinga-kubernetes/instances/%i.env
ExecStartPre=/bin/echo "$ICINGA_FOR_KUBERNETES_CLUSTER_NAME"
ExecStart=/usr/sbin/icinga-kubernetes --config /etc/icinga-kubernetes/config.yml --cluster-name ${ICINGA_FOR_KUBERNETES_CLUSTER_NAME}
User=icinga-kubernetes
Expand Down

0 comments on commit b7e1413

Please sign in to comment.