Skip to content

Commit 08dc03f

Browse files
committed
Added automated Tetragon deployment in the example code
Signed-off-by: Philip Schmid <[email protected]>
1 parent e8486c2 commit 08dc03f

File tree

6 files changed

+75
-1
lines changed

6 files changed

+75
-1
lines changed

.github/renovate.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"osvVulnerabilityAlerts": true,
1919
"separateMinorPatch": true,
2020
"schedule": [
21-
"on monday and friday"
21+
"after 2am and before 5am every weekday"
2222
],
2323
"packageRules": [
2424
{

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ tf/
1414
*.DS_Store*
1515
.timestamp
1616
test/conformance/env.tfvars
17+
example/04-tetragon-values-override.yaml
18+
example/tracingpolicies*

example/00-variables.tf

+37
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,40 @@ variable "pre_cilium_install_script" {
134134
description = "A script to be run before installing Cilium."
135135
type = string
136136
}
137+
138+
# Tetragon
139+
variable "tetragon_namespace" {
140+
default = "kube-system"
141+
description = "The namespace in which to install Tetragon."
142+
type = string
143+
}
144+
145+
variable "tetragon_helm_chart" {
146+
default = "cilium/tetragon"
147+
description = "The name of the Helm chart to use to install Tetragon. It is assumed that the Helm repository containing this chart has been added beforehand (e.g. using 'helm repo add')."
148+
type = string
149+
}
150+
151+
variable "tetragon_helm_values_file_path" {
152+
description = "The path to the file containing the values to use when installing Tetragon."
153+
default = "04-tetragon-values.yaml"
154+
type = string
155+
}
156+
157+
variable "tetragon_helm_values_override_file_path" {
158+
default = ""
159+
description = "The path to the file containing the values to use when installing Tetragon. These values will override the ones in 'tetragon_helm_values_file_path'."
160+
type = string
161+
}
162+
163+
variable "tetragon_tracingpolicy_directory" {
164+
description = "Path to the directory where TracingPolicy files are stored which should automatically be applied. The directory can contain one or multiple valid TracingPoliciy YAML files."
165+
default = ""
166+
type = string
167+
}
168+
169+
variable "tetragon_helm_version" {
170+
description = "The version of the Tetragon Helm chart to install."
171+
default = "1.1.0"
172+
type = string
173+
}

example/04-tetragon-values.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
tetragon:
2+
exportAllowList: |-
3+
{"event_set":["PROCESS_EXEC", "PROCESS_EXIT", "PROCESS_KPROBE", "PROCESS_UPROBE", "PROCESS_TRACEPOINT"]}
4+
enablePolicyFilter: true
5+
enableProcessCred: true
6+
enableProcessNs: true
7+
export:
8+
mode: stdout
9+
filenames:
10+
- tetragon.log

example/04-tetragon.tf

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module "tetragon" {
2+
source = "git::https://github.com/isovalent/terraform-k8s-tetragon.git?ref=v0.4"
3+
4+
# Wait until Cilium CNI is done.
5+
depends_on = [
6+
module.cilium
7+
]
8+
9+
tetragon_helm_release_name = "tetragon"
10+
tetragon_helm_values_file_path = var.tetragon_helm_values_file_path
11+
tetragon_helm_version = var.tetragon_helm_version
12+
tetragon_helm_chart = var.tetragon_helm_chart
13+
tetragon_namespace = var.tetragon_namespace
14+
path_to_kubeconfig_file = module.talos.path_to_kubeconfig_file
15+
tetragon_helm_values_override_file_path = var.tetragon_helm_values_override_file_path
16+
tetragon_tracingpolicy_directory = var.tetragon_tracingpolicy_directory
17+
extra_provisioner_environment_variables = local.extra_provisioner_environment_variables
18+
}

example/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ aws-delete-vpc -cluster-name <Name of your cluster>
110110
|------|--------|---------|
111111
| <a name="module_cilium"></a> [cilium](#module\_cilium) | git::https://github.com/isovalent/terraform-k8s-cilium.git | v1.6.3 |
112112
| <a name="module_talos"></a> [talos](#module\_talos) | ../ | n/a |
113+
| <a name="module_tetragon"></a> [tetragon](#module\_tetragon) | git::https://github.com/isovalent/terraform-k8s-tetragon.git | v0.4 |
113114
| <a name="module_vpc"></a> [vpc](#module\_vpc) | git::https://github.com/isovalent/terraform-aws-vpc.git | v1.8 |
114115

115116
### Resources
@@ -140,6 +141,12 @@ aws-delete-vpc -cluster-name <Name of your cluster>
140141
| <a name="input_service_cidr"></a> [service\_cidr](#input\_service\_cidr) | The CIDR to use for K8s Services | `string` | `"100.68.0.0/16"` | no |
141142
| <a name="input_tags"></a> [tags](#input\_tags) | The set of tags to place on the created resources. These will be merged with the default tags defined via local.tags in 00-locals.tf. | `map(string)` | <pre>{<br> "platform": "talos",<br> "usage": "cute"<br>}</pre> | no |
142143
| <a name="input_talos_version"></a> [talos\_version](#input\_talos\_version) | Talos version to use for the cluster, if not set the newest Talos version. Check https://github.com/siderolabs/talos/releases for available releases. | `string` | `"v1.7.1"` | no |
144+
| <a name="input_tetragon_helm_chart"></a> [tetragon\_helm\_chart](#input\_tetragon\_helm\_chart) | The name of the Helm chart to use to install Tetragon. It is assumed that the Helm repository containing this chart has been added beforehand (e.g. using 'helm repo add'). | `string` | `"cilium/tetragon"` | no |
145+
| <a name="input_tetragon_helm_values_file_path"></a> [tetragon\_helm\_values\_file\_path](#input\_tetragon\_helm\_values\_file\_path) | The path to the file containing the values to use when installing Tetragon. | `string` | `"04-tetragon-values.yaml"` | no |
146+
| <a name="input_tetragon_helm_values_override_file_path"></a> [tetragon\_helm\_values\_override\_file\_path](#input\_tetragon\_helm\_values\_override\_file\_path) | The path to the file containing the values to use when installing Tetragon. These values will override the ones in 'tetragon\_helm\_values\_file\_path'. | `string` | `""` | no |
147+
| <a name="input_tetragon_helm_version"></a> [tetragon\_helm\_version](#input\_tetragon\_helm\_version) | The version of the Tetragon Helm chart to install. | `string` | `"1.1.0"` | no |
148+
| <a name="input_tetragon_namespace"></a> [tetragon\_namespace](#input\_tetragon\_namespace) | The namespace in which to install Tetragon. | `string` | `"kube-system"` | no |
149+
| <a name="input_tetragon_tracingpolicy_directory"></a> [tetragon\_tracingpolicy\_directory](#input\_tetragon\_tracingpolicy\_directory) | Path to the directory where TracingPolicy files are stored which should automatically be applied. The directory can contain one or multiple valid TracingPoliciy YAML files. | `string` | `""` | no |
143150
| <a name="input_vpc_cidr"></a> [vpc\_cidr](#input\_vpc\_cidr) | The CIDR to use for the VPC. Currently it must be a /16 or /24. | `string` | `"10.0.0.0/16"` | no |
144151
| <a name="input_worker_groups"></a> [worker\_groups](#input\_worker\_groups) | List of node worker node groups to create | <pre>list(object({<br> name = string<br> instance_type = optional(string, "m5.large")<br> config_patch_files = optional(list(string), [])<br> tags = optional(map(string), {})<br> }))</pre> | <pre>[<br> {<br> "name": "default"<br> }<br>]</pre> | no |
145152

0 commit comments

Comments
 (0)