Skip to content

Commit

Permalink
feat: filebeat addon 8.5.1 (#24)
Browse files Browse the repository at this point in the history
* feat: added filebeat addon

* fix- fixed tfcheck

* fix- fixed tfchecks

* fix: formated code

* fix- added filebeat addon path for readme

* fix- renamed secondary range

* fix- added description in outputs

* fix- updated addons readme
  • Loading branch information
AshutoshAM2002 authored Mar 5, 2024
1 parent 525e254 commit e7cedcf
Show file tree
Hide file tree
Showing 19 changed files with 633 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Generate TF Docs
uses: terraform-docs/gh-actions@v1.0.0
with:
working-dir: addons/cluster-autoscaler,addons/cert-manager,addons/ingress-nginx,addons/keda,addons/reloader,addons/kubeclarity,addons/external-dns,addons/external-secrets
working-dir: addons/cluster-autoscaler,addons/cert-manager,addons/ingress-nginx,addons/keda,addons/reloader,addons/kubeclarity,addons/external-dns,addons/external-secrets,addons/filebeat
git-push: true
template: |-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Expand Down
6 changes: 5 additions & 1 deletion README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ usage: |-
ingress_nginx = true
certification_manager = true
keda = true
filebeat = true
external_dns = true
kubeclarity = true
external_secrets = true
Expand All @@ -68,12 +69,13 @@ usage: |-
gke_cluster_name = module.gke.name
project_id = local.gcp_project_id
region = local.region
cluster_autoscaler = true
reloader = true
ingress_nginx = true
certification_manager = true
keda = true
filebeat = true
external_dns = true
kubeclarity = true
external_secrets = true
Expand All @@ -84,6 +86,7 @@ usage: |-
ingress_nginx_helm_config = { values = [file("./config/override-ingress-nginx.yaml")] }
certification_manager_helm_config = { values = [file("./config/override-certification-manager.yaml")] }
keda_helm_config = { values = [file("./config/keda/override-keda.yaml")] }
filebeat_helm_config = { values = [file("./config/overide-filebeat.yaml")] }
external_dns_helm_config = { values = [file("./config/override-external-dns.yaml")] }
kubeclarity_helm_config = { values = [file("./config/override-kubeclarity.yaml")] }
external_secrets_helm_config = { values = [file("./config/override-externalsecret.yaml")] }
Expand All @@ -94,6 +97,7 @@ usage: |-
ingress_nginx_extra_configs = var.ingress_nginx_extra_configs
certification_manager_extra_configs = var.certification_manager_extra_configs
keda_extra_configs = var.keda_extra_configs
filebeat_extra_configs = var.filebeat_extra_configs
external_dns_extra_configs = var.external_dns_extra_configs
kubeclarity_extra_configs = var.kubeclarity_extra_configs
external_secrets_extra_configs = var.external_secrets_extra_configs
Expand Down
1 change: 1 addition & 0 deletions _examples/basic/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ locals {
region = "us-central1"
cluster_version = "1.29.0-gke.1381000"
gcp_project_id = "dev-env-3b53"

tags = {
Name = local.name
Environment = local.environment
Expand Down
1 change: 0 additions & 1 deletion _examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

provider "google" {
project = local.gcp_project_id
}
Expand Down
113 changes: 113 additions & 0 deletions _examples/complete/config/overide-filebeat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
## Node affinity for particular node in which labels key is "Infra-Services" and value is "true"
daemonset:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "cloud.google.com/gke-nodepool"
operator: In
values:
- "critical"
## Using limits and requests
resources:
limits:
cpu: "300m"
memory: "200Mi"
requests:
cpu: 100m
memory: 100Mi
# Include the daemonset
enabled: true
extraEnvs:
- name: "ELASTICSEARCH_USERNAME"
valueFrom:
secretKeyRef:
name: elasticsearch-master-credentials
key: username
- name: "ELASTICSEARCH_PASSWORD"
valueFrom:
secretKeyRef:
name: elasticsearch-master-credentials
key: password
# Allows you to add any config files in /usr/share/filebeat
# such as filebeat.yml for daemonset
filebeatConfig:
filebeat.yml: |
filebeat.inputs:
- type: container
paths:
- /var/log/containers/*.log
processors:
- add_kubernetes_metadata:
host: ${NODE_NAME}
matchers:
- logs_path:
logs_path: "/var/log/containers/"
output.elasticsearch:
host: '${NODE_NAME}'
hosts: '["https://${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}"]'
username: '${ELASTICSEARCH_USERNAME}'
password: '${ELASTICSEARCH_PASSWORD}'
protocol: https
ssl.certificate_authorities: ["/usr/share/filebeat/certs/ca.crt"]
# A list of secrets and their paths to mount inside the pod
# This is useful for mounting certificates for security other sensitive values
secretMounts:
- name: elasticsearch-master-certs
secretName: elasticsearch-master-certs
path: /usr/share/filebeat/certs/

deployment:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "cloud.google.com/gke-nodepool"
operator: In
values:
- "critical"

## Using limits and requests
resources:
limits:
cpu: "300m"
memory: "200Mi"
requests:
cpu: 100m
memory: 100Mi

extraEnvs:
- name: "ELASTICSEARCH_USERNAME"
valueFrom:
secretKeyRef:
name: elasticsearch-master-credentials
key: username
- name: "ELASTICSEARCH_PASSWORD"
valueFrom:
secretKeyRef:
name: elasticsearch-master-credentials
key: password
# such as filebeat.yml for deployment
filebeatConfig:
filebeat.yml: |
filebeat.inputs:
- type: log
paths:
- /usr/share/filebeat/logs/filebeat
output.elasticsearch:
host: "${NODE_NAME}"
hosts: '["https://${ELASTICSEARCH_HOSTS:elasticsearch-master:9200}"]'
username: "${ELASTICSEARCH_USERNAME}"
password: "${ELASTICSEARCH_PASSWORD}"
protocol: https
ssl.certificate_authorities: ["/usr/share/filebeat/certs/ca.crt"]
# A list of secrets and their paths to mount inside the pod
# This is useful for mounting certificates for security other sensitive values
secretMounts:
- name: elasticsearch-master-certs
secretName: elasticsearch-master-certs
path: /usr/share/filebeat/certs/
3 changes: 3 additions & 0 deletions _examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ module "addons" {
keda = true
external_dns = true
kubeclarity = true
filebeat = true
external_secrets = true


Expand All @@ -210,6 +211,7 @@ module "addons" {
keda_helm_config = { values = [file("./config/keda/override-keda.yaml")] }
external_dns_helm_config = { values = [file("./config/override-external-dns.yaml")] }
kubeclarity_helm_config = { values = [file("./config/override-kubeclarity.yaml")] }
filebeat_helm_config = { values = [file("./config/overide-filebeat.yaml")] }
external_secrets_helm_config = { values = [file("./config/override-externalsecret.yaml")] }


Expand All @@ -221,6 +223,7 @@ module "addons" {
keda_extra_configs = var.keda_extra_configs
external_dns_extra_configs = var.external_dns_extra_configs
kubeclarity_extra_configs = var.kubeclarity_extra_configs
filebeat_extra_configs = var.filebeat_extra_configs
external_secrets_extra_configs = var.external_secrets_extra_configs

}
8 changes: 7 additions & 1 deletion _examples/complete/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,18 @@ variable "external_dns_extra_configs" {
type = any
default = {}
}
#-------------------KUBECLARITY-------------------------------------------------
#------------------- KUBECLARITY -------------------------------------------------
variable "kubeclarity_extra_configs" {
type = any
default = {}
}

#------------------- FILEBEAT -------------------------------------------------
variable "filebeat_extra_configs" {
type = any
default = {}
}

# ------------------ EXTERNAL SECRET ------------------------------------------
variable "external_secrets_extra_configs" {
description = "Override attributes of helm_release terraform resource"
Expand Down
23 changes: 23 additions & 0 deletions addons/filebeat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Filebeat Helm Chart

Filebeat helps you keep the simple things simple by offering a lightweight way to forward and centralize logs and files.

## Installation
Below terraform script shows how to use Filebeat Terraform Addon, A complete example is also given [here](https://github.com/clouddrove/terraform-google-gke-addons/blob/master/_examples/complete/main.tf).

```hcl
module "addons" {
source = "git::https://github.dev/clouddrove/terraform-google-gke-addons"
depends_on = [module.gke]
gke_cluster_name = module.gke.name
project_id = local.gcp_project_id
region = local.region
filebeat = true
}
```

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Loading

0 comments on commit e7cedcf

Please sign in to comment.