Skip to content

Commit 0f35ece

Browse files
committed
Improved various nits
Signed-off-by: Philip Schmid <[email protected]>
1 parent 3ae80b8 commit 0f35ece

File tree

8 files changed

+71
-16
lines changed

8 files changed

+71
-16
lines changed

.github/dependabot.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
version: 2
22
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 5
8+
rebase-strategy: "disabled"
9+
labels:
10+
- ci/dependabot
11+
- kind/enhancement
312
- package-ecosystem: "terraform"
413
directory: /
514
schedule:
615
interval: "daily"
716
time: "23:00"
817
timezone: "Europe/Zurich"
9-
open-pull-requests-limit: 3
18+
open-pull-requests-limit: 5
19+
rebase-strategy: "disabled"
20+
labels:
21+
- ci/dependabot
22+
- kind/enhancement

.github/workflows/terraform.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ on:
77
- reopened
88
push:
99
branches:
10-
- master
10+
- main
1111
jobs:
1212
formatting:
1313
runs-on: ubuntu-22.04
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
1717
with:
18-
ref: ${{ github.event.pull_request.head.sha }}
18+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
1919
- name: terraform fmt
2020
uses: dflook/terraform-fmt-check@fc6a4d63e251c5d6f247fc8310171a4e45e18210
2121
docs:
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
2626
with:
27-
ref: ${{ github.event.pull_request.head.ref }}
27+
ref: ${{ github.ref }}
2828
- name: Render terraform docs and push changes back to PR branch
2929
uses: terraform-docs/gh-actions@cfde42f79b15256c71f4b79ae1d6acea0f689952
3030
with:

.terraform-docs.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
formatter: "markdown table"
33
output:
44
file: README.md
5-
mode: inject
5+
mode: inject
6+
settings:
7+
indent: 3

Makefile

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
11
SHELL := /bin/bash
2-
ROOT := $$(git rev-parse --show-toplevel)
32

43
.PHONY: docs
4+
.DEFAULT_GOAL := help
55

6+
## Generate/update terraform docs inside README.md (https://terraform-docs.io/user-guide/introduction/)
67
docs:
7-
@terraform-docs markdown table --output-file "$(ROOT)/README.md" --output-mode inject "$(ROOT)"
8+
terraform-docs .
9+
10+
# COLORS
11+
GREEN := $(shell tput -Txterm setaf 2)
12+
YELLOW := $(shell tput -Txterm setaf 3)
13+
WHITE := $(shell tput -Txterm setaf 7)
14+
RESET := $(shell tput -Txterm sgr0)
15+
16+
TARGET_MAX_CHAR_NUM=20
17+
## Show this help
18+
help:
19+
@echo ''
20+
@echo 'Usage:'
21+
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
22+
@echo ''
23+
@echo 'Targets:'
24+
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
25+
helpMessage = match(lastLine, /^## (.*)/); \
26+
if (helpMessage) { \
27+
helpCommand = substr($$1, 0, index($$1, ":")-1); \
28+
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
29+
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
30+
} \
31+
} \
32+
{ lastLine = $$0 }' $(MAKEFILE_LIST)

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33
An opinionated Terraform module that can be used to install and manage Cilium on top of a Kubernetes cluster.
44

55
<!-- BEGIN_TF_DOCS -->
6-
## Requirements
6+
### Requirements
77

88
| Name | Version |
99
|------|---------|
1010
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.2.0 |
1111
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.1.1 |
1212

13-
## Providers
13+
### Providers
1414

1515
| Name | Version |
1616
|------|---------|
1717
| <a name="provider_null"></a> [null](#provider\_null) | >= 3.1.1 |
1818

19-
## Modules
19+
### Modules
2020

2121
No modules.
2222

23-
## Resources
23+
### Resources
2424

2525
| Name | Type |
2626
|------|------|
2727
| [null_resource.main](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
2828

29-
## Inputs
29+
### Inputs
3030

3131
| Name | Description | Type | Default | Required |
3232
|------|-------------|------|---------|:--------:|
@@ -40,14 +40,16 @@ No modules.
4040
| <a name="input_control_plane_nodes_label_selector"></a> [control\_plane\_nodes\_label\_selector](#input\_control\_plane\_nodes\_label\_selector) | The label selector used to filter control-plane nodes. | `string` | `"node-role.kubernetes.io/control-plane"` | no |
4141
| <a name="input_deploy_etcd_cluster"></a> [deploy\_etcd\_cluster](#input\_deploy\_etcd\_cluster) | Whether to deploy an 'etcd' cluster suitable for usage as the Cilium key-value store (HIGHLY EXPERIMENTAL). | `bool` | `false` | no |
4242
| <a name="input_extra_provisioner_environment_variables"></a> [extra\_provisioner\_environment\_variables](#input\_extra\_provisioner\_environment\_variables) | A map of extra environment variables to include when executing the provisioning script. | `map(string)` | `{}` | no |
43+
| <a name="input_install_kube_prometheus_servicemonitor_crd"></a> [install\_kube\_prometheus\_servicemonitor\_crd](#input\_install\_kube\_prometheus\_servicemonitor\_crd) | Whether to install the 'kube-prometheus' ServiceMonitor CRD. | `bool` | `true` | no |
4344
| <a name="input_ipsec_key"></a> [ipsec\_key](#input\_ipsec\_key) | The IPsec key to use for transparent encryption. Leave empty for none to be created (in which case encryption should be disabled in Helm as well). | `string` | `""` | no |
45+
| <a name="input_kube_prometheus_crds_version"></a> [kube\_prometheus\_crds\_version](#input\_kube\_prometheus\_crds\_version) | Version of the 'kube-prometheus' ServiceMonitor CRD to install. | `string` | `"v0.13.0"` | no |
4446
| <a name="input_path_to_kubeconfig_file"></a> [path\_to\_kubeconfig\_file](#input\_path\_to\_kubeconfig\_file) | The path to the kubeconfig file to use. | `string` | n/a | yes |
4547
| <a name="input_post_cilium_install_script"></a> [post\_cilium\_install\_script](#input\_post\_cilium\_install\_script) | A script to be run right after installing Cilium. | `string` | `""` | no |
4648
| <a name="input_pre_cilium_install_script"></a> [pre\_cilium\_install\_script](#input\_pre\_cilium\_install\_script) | A script to be run right before installing Cilium. | `string` | `""` | no |
4749
| <a name="input_total_control_plane_nodes"></a> [total\_control\_plane\_nodes](#input\_total\_control\_plane\_nodes) | The number of control-plane nodes expected in the cluster. | `number` | `3` | no |
4850
| <a name="input_wait_for_total_control_plane_nodes"></a> [wait\_for\_total\_control\_plane\_nodes](#input\_wait\_for\_total\_control\_plane\_nodes) | Whether to wait for the expected number of control-plane nodes to be registered before applying any changes. | `bool` | `false` | no |
4951

50-
## Outputs
52+
### Outputs
5153

5254
No outputs.
5355
<!-- END_TF_DOCS -->

locals.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ locals {
2424
CILIUM_NAMESPACE = var.cilium_namespace, // The namespace where to deploy Cilium.
2525
CONTROL_PLANE_NODES_LABEL_SELECTOR = var.control_plane_nodes_label_selector, // The label selector used to filter control-plane nodes.
2626
DEPLOY_ETCD_CLUSTER = var.deploy_etcd_cluster // Whether to deploy an 'etcd' cluster suitable for usage as the Cilium key-value store.
27-
INSTALL_KUBE_PROMETHEUS_CRDS = true, // Whether to install (some of) the 'kube-prometheus' CRDs (such as 'ServiceMonitor').
27+
INSTALL_KUBE_PROMETHEUS_CRDS = var.install_kube_prometheus_servicemonitor_crd, // Whether to install the 'kube-prometheus' ServiceMonitor CRD.
28+
KUBE_PROMETHEUS_CRDS_VERSION = var.kube_prometheus_crds_version, // Version of the 'kube-prometheus' ServiceMonitor CRD to install.
2829
IPSEC_KEY = var.ipsec_key, // The IPsec key to be used for transparent encryption.
2930
KUBECONFIG = var.path_to_kubeconfig_file // The path to the kubeconfig file that will be created and output.
3031
PRE_CILIUM_INSTALL_SCRIPT = var.pre_cilium_install_script != "" ? base64encode(var.pre_cilium_install_script) : "" // The script to execute before installing Cilium.

scripts/provisioner.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# Copyright 2022 Isovalent, Inc.
44
#
@@ -86,7 +86,7 @@ export IPSEC_ENABLED
8686
# Manually create the 'ServiceMonitor' CRD from 'kube-prometheus' so we can enable the creation of 'ServiceMonitor' resources in the Cilium Helm chart.
8787
if [[ "${INSTALL_KUBE_PROMETHEUS_CRDS}" == "true" ]];
8888
then
89-
kubectl apply -f "https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/release-0.13/manifests/setup/0servicemonitorCustomResourceDefinition.yaml"
89+
kubectl apply -f "https://raw.githubusercontent.com/prometheus-operator/kube-prometheus/${KUBE_PROMETHEUS_CRDS_VERSION}/manifests/setup/0servicemonitorCustomResourceDefinition.yaml"
9090
until kubectl get servicemonitors --all-namespaces;
9191
do
9292
echo "Waiting for the 'servicemonitors' CRD...";

variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,15 @@ variable "wait_for_total_control_plane_nodes" {
103103
description = "Whether to wait for the expected number of control-plane nodes to be registered before applying any changes."
104104
type = bool
105105
}
106+
107+
variable "install_kube_prometheus_servicemonitor_crd" {
108+
default = true
109+
description = "Whether to install the 'kube-prometheus' ServiceMonitor CRD."
110+
type = bool
111+
}
112+
113+
variable "kube_prometheus_crds_version" {
114+
default = "v0.13.0"
115+
description = "Version of the 'kube-prometheus' ServiceMonitor CRD to install."
116+
type = string
117+
}

0 commit comments

Comments
 (0)