diff --git a/README.md b/README.md index 8cf711e0d..bc9ec79f7 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ | [aws-node-termination-handler](https://github.com/aws/aws-node-termination-handler) | Manage spot instance lifecyle | N/A | :heavy_check_mark: | N/A | N/A | N/A | | [aws-calico](https://github.com/aws/eks-charts/tree/master/stable/aws-calico) | Use calico for network policy | N/A | :heavy_check_mark: | N/A | N/A | N/A | | [secrets-store-csi-driver-provider-aws](https://github.com/aws/secrets-store-csi-driver-provider-aws) | AWS Secret Store and Parameter store driver for secret store CSI driver | :heavy_check_mark: | N/A | N/A | N/A | N/A | -| [cert-manager](https://github.com/jetstack/cert-manager) | automatically generate TLS certificates, supports ACME v2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | N/A | +| [cert-manager](https://github.com/jetstack/cert-manager) | automatically generate TLS certificates, supports ACME v2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | N/A | | [cluster-autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler) | scale worker nodes based on workload | N/A | :heavy_check_mark: | Included | Included | Included | | [cni-metrics-helper](https://docs.aws.amazon.com/eks/latest/userguide/cni-metrics-helper.html) | Provides cloudwatch metrics for VPC CNI plugins | N/A | :heavy_check_mark: | N/A | N/A | N/A | -| [external-dns](https://github.com/kubernetes-incubator/external-dns) | sync ingress and service records in route53 | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | +| [external-dns](https://github.com/kubernetes-incubator/external-dns) | sync ingress and service records in route53 | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | | [flux2](https://github.com/fluxcd/flux2) | Open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | -| [ingress-nginx](https://github.com/kubernetes/ingress-nginx) | processes `Ingress` object and acts as a HTTP/HTTPS proxy (compatible with cert-manager) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | +| [ingress-nginx](https://github.com/kubernetes/ingress-nginx) | processes `Ingress` object and acts as a HTTP/HTTPS proxy (compatible with cert-manager) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | | [k8gb](https://www.k8gb.io/) | A cloud native Kubernetes Global Balancer | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | [karma](https://github.com/prymitive/karma) | An alertmanager dashboard | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | [keda](https://github.com/kedacore/keda) | Kubernetes Event-driven Autoscaling | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | @@ -50,7 +50,7 @@ Any contribution supporting a new cloud provider is welcomed. * [AWS](./modules/aws) * [Scaleway](./modules/scaleway) -* [GCP](./modules/gcp) +* [GCP](./modules/google) * [Azure](./modules/azure) ## Doc generation diff --git a/modules/google/.terraform-docs.yml b/modules/google/.terraform-docs.yml new file mode 100644 index 000000000..abb4abb22 --- /dev/null +++ b/modules/google/.terraform-docs.yml @@ -0,0 +1,2 @@ +settings: + lockfile: false diff --git a/modules/google/README.md b/modules/google/README.md index 24f6e674d..bcc3273c2 100644 --- a/modules/google/README.md +++ b/modules/google/README.md @@ -7,35 +7,42 @@ Provides various addons that are often used on Kubernetes with Google and GKE. -## Documentation - -User guides, feature documentation and examples are available [here](https://github.com/particuleio/tkap/) - ## Terraform docs +Provides various Kubernetes addons that are often used on Kubernetes with GCP + ## Requirements | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | +| [flux](#requirement\_flux) | 1.0.0-rc.5 | +| [github](#requirement\_github) | ~> 5.0 | | [google](#requirement\_google) | >= 4.69 | | [google-beta](#requirement\_google-beta) | >= 4.69 | | [helm](#requirement\_helm) | ~> 2.0 | +| [http](#requirement\_http) | >= 3 | | [jinja](#requirement\_jinja) | ~> 1.15 | | [kubectl](#requirement\_kubectl) | ~> 1.0 | | [kubernetes](#requirement\_kubernetes) | ~> 2.0, != 2.12 | +| [tls](#requirement\_tls) | ~> 4.0 | ## Providers | Name | Version | |------|---------| -| [google](#provider\_google) | 4.70.0 | -| [helm](#provider\_helm) | 2.10.1 | -| [jinja](#provider\_jinja) | 1.15.0 | -| [kubectl](#provider\_kubectl) | 1.14.0 | -| [kubernetes](#provider\_kubernetes) | 2.21.1 | -| [time](#provider\_time) | 0.9.1 | +| [flux](#provider\_flux) | 1.0.0-rc.5 | +| [github](#provider\_github) | ~> 5.0 | +| [google](#provider\_google) | >= 4.69 | +| [helm](#provider\_helm) | ~> 2.0 | +| [http](#provider\_http) | >= 3 | +| [jinja](#provider\_jinja) | ~> 1.15 | +| [kubectl](#provider\_kubectl) | ~> 1.0 | +| [kubernetes](#provider\_kubernetes) | ~> 2.0, != 2.12 | +| [random](#provider\_random) | n/a | +| [time](#provider\_time) | n/a | +| [tls](#provider\_tls) | ~> 4.0 | ## Modules @@ -43,19 +50,89 @@ User guides, feature documentation and examples are available [here](https://git |------|--------|---------| | [cert\_manager\_workload\_identity](#module\_cert\_manager\_workload\_identity) | terraform-google-modules/kubernetes-engine/google//modules/workload-identity | ~> v26.1.1 | | [external\_dns\_workload\_identity](#module\_external\_dns\_workload\_identity) | terraform-google-modules/kubernetes-engine/google//modules/workload-identity | ~> v26.1.1 | +| [iam\_assumable\_sa\_kube-prometheus-stack\_grafana](#module\_iam\_assumable\_sa\_kube-prometheus-stack\_grafana) | terraform-google-modules/kubernetes-engine/google//modules/workload-identity | ~> 9.0 | +| [iam\_assumable\_sa\_kube-prometheus-stack\_thanos](#module\_iam\_assumable\_sa\_kube-prometheus-stack\_thanos) | terraform-google-modules/kubernetes-engine/google//modules/workload-identity | ~> 9.0 | +| [iam\_assumable\_sa\_loki-stack](#module\_iam\_assumable\_sa\_loki-stack) | terraform-google-modules/kubernetes-engine/google//modules/workload-identity | ~> 9.0 | +| [iam\_assumable\_sa\_thanos](#module\_iam\_assumable\_sa\_thanos) | terraform-google-modules/kubernetes-engine/google//modules/workload-identity | ~> 9.0 | +| [iam\_assumable\_sa\_thanos-compactor](#module\_iam\_assumable\_sa\_thanos-compactor) | terraform-google-modules/kubernetes-engine/google//modules/workload-identity | ~> 9.0 | +| [iam\_assumable\_sa\_thanos-sg](#module\_iam\_assumable\_sa\_thanos-sg) | terraform-google-modules/kubernetes-engine/google//modules/workload-identity | ~> 9.0 | +| [iam\_assumable\_sa\_thanos-storegateway](#module\_iam\_assumable\_sa\_thanos-storegateway) | terraform-google-modules/kubernetes-engine/google//modules/workload-identity | ~> 9.0 | +| [kube-prometheus-stack\_grafana-iam-member](#module\_kube-prometheus-stack\_grafana-iam-member) | terraform-google-modules/iam/google//modules/member_iam | ~> 7.6 | +| [kube-prometheus-stack\_kube-prometheus-stack\_bucket](#module\_kube-prometheus-stack\_kube-prometheus-stack\_bucket) | terraform-google-modules/cloud-storage/google//modules/simple_bucket | ~> 4.0 | +| [kube-prometheus-stack\_thanos\_bucket\_iam](#module\_kube-prometheus-stack\_thanos\_bucket\_iam) | terraform-google-modules/iam/google//modules/storage_buckets_iam | ~> 7.6 | +| [kube-prometheus-stack\_thanos\_kms\_bucket](#module\_kube-prometheus-stack\_thanos\_kms\_bucket) | terraform-google-modules/kms/google | 2.2.2 | +| [loki-stack\_bucket](#module\_loki-stack\_bucket) | terraform-google-modules/cloud-storage/google//modules/simple_bucket | ~> 4.0 | +| [loki-stack\_bucket\_iam](#module\_loki-stack\_bucket\_iam) | terraform-google-modules/iam/google//modules/storage_buckets_iam | ~> 7.6 | +| [loki-stack\_kms\_bucket](#module\_loki-stack\_kms\_bucket) | terraform-google-modules/kms/google | 2.2.2 | +| [thanos-storegateway\_bucket\_iam](#module\_thanos-storegateway\_bucket\_iam) | terraform-google-modules/iam/google//modules/storage_buckets_iam | ~> 7.6 | +| [thanos\_bucket](#module\_thanos\_bucket) | terraform-google-modules/cloud-storage/google//modules/simple_bucket | ~> 4.0 | +| [thanos\_bucket\_iam](#module\_thanos\_bucket\_iam) | terraform-google-modules/iam/google//modules/storage_buckets_iam | ~> 7.6 | +| [thanos\_kms\_bucket](#module\_thanos\_kms\_bucket) | terraform-google-modules/kms/google | 2.2.2 | ## Resources | Name | Type | |------|------| +| [flux_bootstrap_git.flux](https://registry.terraform.io/providers/fluxcd/flux/1.0.0-rc.5/docs/resources/bootstrap_git) | resource | +| [github_branch_default.main](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/branch_default) | resource | +| [github_repository.main](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository) | resource | +| [github_repository_deploy_key.main](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_deploy_key) | resource | | [google_dns_managed_zone_iam_member.cert_manager_cloud_dns_iam_permissions](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dns_managed_zone_iam_member) | resource | | [google_dns_managed_zone_iam_member.external_dns_cloud_dns_iam_permissions](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dns_managed_zone_iam_member) | resource | +| [helm_release.admiralty](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.cert-manager](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.cert-manager-csi-driver](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.external-dns](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.ingress-nginx](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.k8gb](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.karma](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.keda](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.kube-prometheus-stack](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.linkerd-control-plane](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.linkerd-crds](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.linkerd-viz](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.linkerd2-cni](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.loki-stack](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.node-problem-detector](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.prometheus-adapter](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.promtail](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.sealed-secrets](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.secrets-store-csi-driver](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.thanos](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.thanos-memcached](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.thanos-storegateway](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.thanos-tls-querier](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.traefik](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | +| [helm_release.victoria-metrics-k8s-stack](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [kubectl_manifest.cert-manager_cluster_issuers](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | | [kubectl_manifest.ip_masq_agent](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | +| [kubectl_manifest.linkerd](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | +| [kubectl_manifest.linkerd-viz](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | +| [kubectl_manifest.prometheus-operator_crds](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/resources/manifest) | resource | +| [kubernetes_config_map.loki-stack_grafana_ds](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map) | resource | +| [kubernetes_namespace.admiralty](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | | [kubernetes_namespace.cert-manager](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | | [kubernetes_namespace.external-dns](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.flux2](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.ingress-nginx](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.k8gb](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.karma](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.keda](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.kube-prometheus-stack](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.linkerd](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.linkerd-viz](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.linkerd2-cni](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.loki-stack](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.node-problem-detector](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.prometheus-adapter](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.promtail](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.sealed-secrets](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.secrets-store-csi-driver](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.thanos](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.traefik](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_namespace.victoria-metrics-k8s-stack](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | +| [kubernetes_network_policy.admiralty_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.admiralty_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | | [kubernetes_network_policy.cert-manager_allow_control_plane](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | | [kubernetes_network_policy.cert-manager_allow_monitoring](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | | [kubernetes_network_policy.cert-manager_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | @@ -63,9 +140,81 @@ User guides, feature documentation and examples are available [here](https://git | [kubernetes_network_policy.external-dns_allow_monitoring](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | | [kubernetes_network_policy.external-dns_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | | [kubernetes_network_policy.external-dns_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.flux2_allow_monitoring](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.flux2_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.ingress-nginx_allow_control_plane](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.ingress-nginx_allow_ingress](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.ingress-nginx_allow_monitoring](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.ingress-nginx_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.ingress-nginx_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.k8gb_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.k8gb_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.karma_allow_ingress](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.karma_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.karma_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.keda_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.keda_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.kube-prometheus-stack_allow_control_plane](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.kube-prometheus-stack_allow_ingress](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.kube-prometheus-stack_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.kube-prometheus-stack_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.linkerd-viz_allow_control_plane](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.linkerd-viz_allow_monitoring](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.linkerd-viz_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.linkerd-viz_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.linkerd2-cni_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.linkerd2-cni_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.loki-stack_allow_ingress](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.loki-stack_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.loki-stack_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.npd_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.npd_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.prometheus-adapter_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.prometheus-adapter_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.promtail_allow_ingress](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.promtail_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.promtail_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.sealed-secrets_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.sealed-secrets_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.secrets-store-csi-driver_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.secrets-store-csi-driver_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.traefik_allow_ingress](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.traefik_allow_monitoring](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.traefik_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.traefik_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.victoria-metrics-k8s-stack_allow_control_plane](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.victoria-metrics-k8s-stack_allow_ingress](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.victoria-metrics-k8s-stack_allow_namespace](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | +| [kubernetes_network_policy.victoria-metrics-k8s-stack_default_deny](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/network_policy) | resource | | [kubernetes_priority_class.kubernetes_addons](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/priority_class) | resource | | [kubernetes_priority_class.kubernetes_addons_ds](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/priority_class) | resource | +| [kubernetes_secret.kube-prometheus-stack_thanos](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret) | resource | +| [kubernetes_secret.linkerd_trust_anchor](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret) | resource | +| [kubernetes_secret.loki-stack-ca](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret) | resource | +| [kubernetes_secret.promtail-tls](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret) | resource | +| [kubernetes_secret.thanos-ca](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret) | resource | +| [kubernetes_secret.webhook_issuer_tls](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/secret) | resource | +| [random_string.grafana_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource | | [time_sleep.cert-manager_sleep](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource | +| [tls_cert_request.promtail-csr](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/cert_request) | resource | +| [tls_cert_request.thanos-tls-querier-cert-csr](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/cert_request) | resource | +| [tls_locally_signed_cert.promtail-cert](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/locally_signed_cert) | resource | +| [tls_locally_signed_cert.thanos-tls-querier-cert](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/locally_signed_cert) | resource | +| [tls_private_key.identity](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | +| [tls_private_key.linkerd_trust_anchor](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | +| [tls_private_key.loki-stack-ca-key](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | +| [tls_private_key.promtail-key](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | +| [tls_private_key.thanos-tls-querier-ca-key](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | +| [tls_private_key.thanos-tls-querier-cert-key](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | +| [tls_private_key.webhook_issuer_tls](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | +| [tls_self_signed_cert.linkerd_trust_anchor](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/self_signed_cert) | resource | +| [tls_self_signed_cert.loki-stack-ca-cert](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/self_signed_cert) | resource | +| [tls_self_signed_cert.thanos-tls-querier-ca-cert](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/self_signed_cert) | resource | +| [tls_self_signed_cert.webhook_issuer_tls](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/self_signed_cert) | resource | +| [github_repository.main](https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/repository) | data source | +| [google_project.current](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/project) | data source | +| [http_http.prometheus-operator_crds](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source | +| [http_http.prometheus-operator_version](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source | | [jinja_template.cert-manager_cluster_issuers](https://registry.terraform.io/providers/NikolaLohinski/jinja/latest/docs/data-sources/template) | data source | | [kubectl_file_documents.cert-manager_cluster_issuers](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/data-sources/file_documents) | data source | | [kubectl_filename_list.ip_masq_agent_manifests](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/data-sources/filename_list) | data source | @@ -79,9 +228,12 @@ User guides, feature documentation and examples are available [here](https://git | [cert-manager-csi-driver](#input\_cert-manager-csi-driver) | Customize cert-manager-csi-driver chart, see `cert-manager.tf` for supported values | `any` | `{}` | no | | [cluster-autoscaler](#input\_cluster-autoscaler) | Customize cluster-autoscaler chart, see `cluster-autoscaler.tf` for supported values | `any` | `{}` | no | | [cluster-name](#input\_cluster-name) | Name of the Kubernetes cluster | `string` | `"sample-cluster"` | no | +| [cni-metrics-helper](#input\_cni-metrics-helper) | Customize cni-metrics-helper deployment, see `cni-metrics-helper.tf` for supported values | `any` | `{}` | no | | [csi-external-snapshotter](#input\_csi-external-snapshotter) | Customize csi-external-snapshotter, see `csi-external-snapshotter.tf` for supported values | `any` | `{}` | no | | [external-dns](#input\_external-dns) | Map of map for external-dns configuration: see `external_dns.tf` for supported values | `any` | `{}` | no | | [flux2](#input\_flux2) | Customize Flux chart, see `flux2.tf` for supported values | `any` | `{}` | no | +| [gke](#input\_gke) | GKE cluster inputs | `any` | `{}` | no | +| [google](#input\_google) | GCP provider customization | `any` | `{}` | no | | [helm\_defaults](#input\_helm\_defaults) | Customize default Helm behavior | `any` | `{}` | no | | [ingress-nginx](#input\_ingress-nginx) | Customize ingress-nginx chart, see `nginx-ingress.tf` for supported values | `any` | `{}` | no | | [ip-masq-agent](#input\_ip-masq-agent) | Configure ip masq agent chart, see `ip-masq-agent.tf` for supported values. This addon works only on GCP. | `any` | `{}` | no | @@ -100,20 +252,31 @@ User guides, feature documentation and examples are available [here](https://git | [npd](#input\_npd) | Customize node-problem-detector chart, see `npd.tf` for supported values | `any` | `{}` | no | | [priority-class](#input\_priority-class) | Customize a priority class for addons | `any` | `{}` | no | | [priority-class-ds](#input\_priority-class-ds) | Customize a priority class for addons daemonsets | `any` | `{}` | no | +| [project\_id](#input\_project\_id) | GCP project id | `string` | `""` | no | | [prometheus-adapter](#input\_prometheus-adapter) | Customize prometheus-adapter chart, see `prometheus-adapter.tf` for supported values | `any` | `{}` | no | | [prometheus-blackbox-exporter](#input\_prometheus-blackbox-exporter) | Customize prometheus-blackbox-exporter chart, see `prometheus-blackbox-exporter.tf` for supported values | `any` | `{}` | no | +| [prometheus-cloudwatch-exporter](#input\_prometheus-cloudwatch-exporter) | Customize prometheus-cloudwatch-exporter chart, see `prometheus-cloudwatch-exporter.tf` for supported values | `any` | `{}` | no | | [promtail](#input\_promtail) | Customize promtail chart, see `loki-stack.tf` for supported values | `any` | `{}` | no | | [sealed-secrets](#input\_sealed-secrets) | Customize sealed-secrets chart, see `sealed-secrets.tf` for supported values | `any` | `{}` | no | | [secrets-store-csi-driver](#input\_secrets-store-csi-driver) | Customize secrets-store-csi-driver chart, see `secrets-store-csi-driver.tf` for supported values | `any` | `{}` | no | +| [tags](#input\_tags) | Map of tags for Google resources | `map(any)` | `{}` | no | | [thanos](#input\_thanos) | Customize thanos chart, see `thanos.tf` for supported values | `any` | `{}` | no | | [thanos-memcached](#input\_thanos-memcached) | Customize thanos chart, see `thanos.tf` for supported values | `any` | `{}` | no | | [thanos-storegateway](#input\_thanos-storegateway) | Customize thanos chart, see `thanos.tf` for supported values | `any` | `{}` | no | | [thanos-tls-querier](#input\_thanos-tls-querier) | Customize thanos chart, see `thanos.tf` for supported values | `any` | `{}` | no | | [tigera-operator](#input\_tigera-operator) | Customize tigera-operator chart, see `tigera-operator.tf` for supported values | `any` | `{}` | no | | [traefik](#input\_traefik) | Customize traefik chart, see `traefik.tf` for supported values | `any` | `{}` | no | +| [velero](#input\_velero) | Customize velero chart, see `velero.tf` for supported values | `any` | `{}` | no | | [victoria-metrics-k8s-stack](#input\_victoria-metrics-k8s-stack) | Customize Victoria Metrics chart, see `victoria-metrics-k8s-stack.tf` for supported values | `any` | `{}` | no | ## Outputs -No outputs. +| Name | Description | +|------|-------------| +| [kube-prometheus-stack](#output\_kube-prometheus-stack) | n/a | +| [kube-prometheus-stack\_sensitive](#output\_kube-prometheus-stack\_sensitive) | n/a | +| [loki-stack-ca](#output\_loki-stack-ca) | n/a | +| [promtail-cert](#output\_promtail-cert) | n/a | +| [promtail-key](#output\_promtail-key) | n/a | +| [thanos\_ca](#output\_thanos\_ca) | n/a | diff --git a/modules/google/admiralty.tf b/modules/google/admiralty.tf new file mode 120000 index 000000000..27a4cc80e --- /dev/null +++ b/modules/google/admiralty.tf @@ -0,0 +1 @@ +../../admiralty.tf \ No newline at end of file diff --git a/modules/google/cert-manager-csi-driver.tf b/modules/google/cert-manager-csi-driver.tf new file mode 120000 index 000000000..f308a6d52 --- /dev/null +++ b/modules/google/cert-manager-csi-driver.tf @@ -0,0 +1 @@ +../../cert-manager-csi-driver.tf \ No newline at end of file diff --git a/modules/google/data.tf b/modules/google/data.tf new file mode 100644 index 000000000..8ac3c2544 --- /dev/null +++ b/modules/google/data.tf @@ -0,0 +1 @@ +data "google_project" "current" {} diff --git a/modules/google/flux2.tf b/modules/google/flux2.tf new file mode 120000 index 000000000..0b9241e91 --- /dev/null +++ b/modules/google/flux2.tf @@ -0,0 +1 @@ +../../flux2.tf \ No newline at end of file diff --git a/modules/google/ingress-nginx.tf b/modules/google/ingress-nginx.tf new file mode 100644 index 000000000..ac84a99d0 --- /dev/null +++ b/modules/google/ingress-nginx.tf @@ -0,0 +1,261 @@ +locals { + + ingress-nginx = merge( + local.helm_defaults, + { + name = local.helm_dependencies[index(local.helm_dependencies.*.name, "ingress-nginx")].name + chart = local.helm_dependencies[index(local.helm_dependencies.*.name, "ingress-nginx")].name + repository = local.helm_dependencies[index(local.helm_dependencies.*.name, "ingress-nginx")].repository + chart_version = local.helm_dependencies[index(local.helm_dependencies.*.name, "ingress-nginx")].version + namespace = "ingress-nginx" + use_nlb = false + enabled = false + default_network_policy = true + ingress_cidrs = ["0.0.0.0/0"] + allowed_cidrs = ["0.0.0.0/0"] + }, + var.ingress-nginx + ) + + values_ingress-nginx_l4 = < merge( + local.helm_defaults, + { + chart = local.helm_dependencies[index(local.helm_dependencies.*.name, "thanos")].name + repository = local.helm_dependencies[index(local.helm_dependencies.*.name, "thanos")].repository + chart_version = local.helm_dependencies[index(local.helm_dependencies.*.name, "thanos")].version + name = "${local.thanos["name"]}-storegateway-${k}" + create_iam_resources = true + iam_policy_override = null + enabled = false + default_global_requests = false + default_global_limits = false + bucket = null + region = null + name_prefix = "${var.cluster-name}-thanos-sg" + }, + v, + ) } + + values_thanos-storegateway = { for k, v in local.thanos-storegateway : k => merge( + { + values = <<-VALUES + objstoreConfig: + type: GCS + config: + bucket: ${v["bucket"]} + service_account: "${v["name_prefix"]}-thanos-sg" + metrics: + enabled: true + serviceMonitor: + enabled: ${local.kube-prometheus-stack["enabled"] ? "true" : "false"} + query: + enabled: false + queryFrontend: + enabled: false + compactor: + enabled: false + storegateway: + replicaCount: 2 + extraFlags: + - --ignore-deletion-marks-delay=24h + enabled: true + serviceAccount: + annotations: + eks.amazonaws.com/role-arn: "${v["enabled"] && v["create_iam_resources"] ? module.iam_assumable_sa_thanos-storegateway[k].iam_role_arn : ""}" + iam.gke.io/gcp-service-account: "${v["enabled"] && v["create_iam_resources"] ? module.iam_assumable_sa_thanos-storegateway[k].gcp_service_account_name : ""}" + pdb: + create: true + minAvailable: 1 + VALUES + }, + v, + ) } +} + +module "iam_assumable_sa_thanos-storegateway" { + for_each = local.thanos-storegateway + source = "terraform-google-modules/kubernetes-engine/google//modules/workload-identity" + version = "~> 9.0" + namespace = each.value["namespace"] + project_id = data.google_project.current.id + name = "${each.value["name_prefix"]}-${each.key}" +} + + +module "thanos-storegateway_bucket_iam" { + for_each = local.thanos-storegateway + source = "terraform-google-modules/iam/google//modules/storage_buckets_iam" + version = "~> 7.6" + + mode = "additive" + storage_buckets = [each.value["bucket"]] + bindings = { + "roles/storage.objectViewer" = [ + "serviceAccount:${module.iam_assumable_sa_thanos-storegateway["${each.key}"].gcp_service_account_email}" + ] + } +} + +resource "helm_release" "thanos-storegateway" { + for_each = { for k, v in local.thanos-storegateway : k => v if v["enabled"] } + repository = each.value["repository"] + name = each.value["name"] + chart = each.value["chart"] + version = each.value["chart_version"] + timeout = each.value["timeout"] + force_update = each.value["force_update"] + recreate_pods = each.value["recreate_pods"] + wait = each.value["wait"] + atomic = each.value["atomic"] + cleanup_on_fail = each.value["cleanup_on_fail"] + dependency_update = each.value["dependency_update"] + disable_crd_hooks = each.value["disable_crd_hooks"] + disable_webhooks = each.value["disable_webhooks"] + render_subchart_notes = each.value["render_subchart_notes"] + replace = each.value["replace"] + reset_values = each.value["reset_values"] + reuse_values = each.value["reuse_values"] + skip_crds = each.value["skip_crds"] + verify = each.value["verify"] + values = compact([ + local.values_thanos-storegateway[each.key]["values"], + each.value["default_global_requests"] ? local.values_thanos_global_requests : null, + each.value["default_global_limits"] ? local.values_thanos_global_limits : null, + each.value["extra_values"] + ]) + namespace = local.thanos["create_ns"] ? kubernetes_namespace.thanos.*.metadata.0.name[0] : local.thanos["namespace"] + + depends_on = [ + helm_release.kube-prometheus-stack, + ] +} diff --git a/modules/google/thanos-tls-querier.tf b/modules/google/thanos-tls-querier.tf new file mode 100644 index 000000000..1d42f7760 --- /dev/null +++ b/modules/google/thanos-tls-querier.tf @@ -0,0 +1,162 @@ +locals { + + thanos-tls-querier = { for k, v in var.thanos-tls-querier : k => merge( + local.helm_defaults, + { + chart = local.helm_dependencies[index(local.helm_dependencies.*.name, "thanos")].name + repository = local.helm_dependencies[index(local.helm_dependencies.*.name, "thanos")].repository + chart_version = local.helm_dependencies[index(local.helm_dependencies.*.name, "thanos")].version + name = "${local.thanos["name"]}-tls-querier-${k}" + enabled = false + generate_cert = local.thanos["generate_ca"] + client_server_name = "" + ## This default to Let's encrypt R3 CA + grpc_client_tls_ca_pem = <<-EOV + -----BEGIN CERTIFICATE----- + MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw + TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh + cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAw + WhcNMjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg + RW5jcnlwdDELMAkGA1UEAxMCUjMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK + AoIBAQC7AhUozPaglNMPEuyNVZLD+ILxmaZ6QoinXSaqtSu5xUyxr45r+XXIo9cP + R5QUVTVXjJ6oojkZ9YI8QqlObvU7wy7bjcCwXPNZOOftz2nwWgsbvsCUJCWH+jdx + sxPnHKzhm+/b5DtFUkWWqcFTzjTIUu61ru2P3mBw4qVUq7ZtDpelQDRrK9O8Zutm + NHz6a4uPVymZ+DAXXbpyb/uBxa3Shlg9F8fnCbvxK/eG3MHacV3URuPMrSXBiLxg + Z3Vms/EY96Jc5lP/Ooi2R6X/ExjqmAl3P51T+c8B5fWmcBcUr2Ok/5mzk53cU6cG + /kiFHaFpriV1uxPMUgP17VGhi9sVAgMBAAGjggEIMIIBBDAOBgNVHQ8BAf8EBAMC + AYYwHQYDVR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMBIGA1UdEwEB/wQIMAYB + Af8CAQAwHQYDVR0OBBYEFBQusxe3WFbLrlAJQOYfr52LFMLGMB8GA1UdIwQYMBaA + FHm0WeZ7tuXkAXOACIjIGlj26ZtuMDIGCCsGAQUFBwEBBCYwJDAiBggrBgEFBQcw + AoYWaHR0cDovL3gxLmkubGVuY3Iub3JnLzAnBgNVHR8EIDAeMBygGqAYhhZodHRw + Oi8veDEuYy5sZW5jci5vcmcvMCIGA1UdIAQbMBkwCAYGZ4EMAQIBMA0GCysGAQQB + gt8TAQEBMA0GCSqGSIb3DQEBCwUAA4ICAQCFyk5HPqP3hUSFvNVneLKYY611TR6W + PTNlclQtgaDqw+34IL9fzLdwALduO/ZelN7kIJ+m74uyA+eitRY8kc607TkC53wl + ikfmZW4/RvTZ8M6UK+5UzhK8jCdLuMGYL6KvzXGRSgi3yLgjewQtCPkIVz6D2QQz + CkcheAmCJ8MqyJu5zlzyZMjAvnnAT45tRAxekrsu94sQ4egdRCnbWSDtY7kh+BIm + lJNXoB1lBMEKIq4QDUOXoRgffuDghje1WrG9ML+Hbisq/yFOGwXD9RiX8F6sw6W4 + avAuvDszue5L3sz85K+EC4Y/wFVDNvZo4TYXao6Z0f+lQKc0t8DQYzk1OXVu8rp2 + yJMC6alLbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O + yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids + hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+ + HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv + MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX + nLRbwHOoq7hHwg== + -----END CERTIFICATE----- + EOV + stores = [] + default_global_requests = false + default_global_limits = false + }, + v, + ) } + + values_thanos-tls-querier = { for k, v in local.thanos-tls-querier : k => merge( + { + values = <<-VALUES + metrics: + enabled: true + serviceMonitor: + enabled: ${local.kube-prometheus-stack["enabled"] ? "true" : "false"} + query: + replicaCount: 2 + extraFlags: + - --query.timeout=5m + - --query.lookback-delta=15m + - --query.replica-label=rule_replica + enabled: true + dnsDiscovery: + enabled: false + pdb: + create: true + minAvailable: 1 + grpc: + client: + servername: ${v["client_server_name"]} + tls: + enabled: ${v["generate_cert"]} + key: | + ${indent(10, v["generate_cert"] ? tls_private_key.thanos-tls-querier-cert-key[k].private_key_pem : "")} + cert: | + ${indent(10, v["generate_cert"] ? tls_locally_signed_cert.thanos-tls-querier-cert[k].cert_pem : "")} + ca: | + ${indent(10, v["generate_cert"] ? v["grpc_client_tls_ca_pem"] : "")} + stores: ${jsonencode(v["stores"])} + queryFrontend: + enabled: false + compactor: + enabled: false + storegateway: + enabled: false + VALUES + }, + v, + ) } +} + +resource "helm_release" "thanos-tls-querier" { + for_each = { for k, v in local.thanos-tls-querier : k => v if v["enabled"] } + repository = each.value["repository"] + name = each.value["name"] + chart = each.value["chart"] + version = each.value["chart_version"] + timeout = each.value["timeout"] + force_update = each.value["force_update"] + recreate_pods = each.value["recreate_pods"] + wait = each.value["wait"] + atomic = each.value["atomic"] + cleanup_on_fail = each.value["cleanup_on_fail"] + dependency_update = each.value["dependency_update"] + disable_crd_hooks = each.value["disable_crd_hooks"] + disable_webhooks = each.value["disable_webhooks"] + render_subchart_notes = each.value["render_subchart_notes"] + replace = each.value["replace"] + reset_values = each.value["reset_values"] + reuse_values = each.value["reuse_values"] + skip_crds = each.value["skip_crds"] + verify = each.value["verify"] + values = compact([ + local.values_thanos-tls-querier[each.key]["values"], + each.value["default_global_requests"] ? local.values_thanos_global_requests : null, + each.value["default_global_limits"] ? local.values_thanos_global_limits : null, + each.value["extra_values"] + ]) + namespace = local.thanos["create_ns"] ? kubernetes_namespace.thanos.*.metadata.0.name[0] : local.thanos["namespace"] + + depends_on = [ + helm_release.kube-prometheus-stack, + ] +} + +resource "tls_private_key" "thanos-tls-querier-cert-key" { + for_each = { for k, v in local.thanos-tls-querier : k => v if v["enabled"] && v["generate_cert"] } + algorithm = "ECDSA" + ecdsa_curve = "P384" +} + +resource "tls_cert_request" "thanos-tls-querier-cert-csr" { + for_each = { for k, v in local.thanos-tls-querier : k => v if v["enabled"] && v["generate_cert"] } + private_key_pem = tls_private_key.thanos-tls-querier-cert-key[each.key].private_key_pem + + subject { + common_name = each.key + } + + dns_names = [ + each.key + ] +} + +resource "tls_locally_signed_cert" "thanos-tls-querier-cert" { + for_each = { for k, v in local.thanos-tls-querier : k => v if v["enabled"] && v["generate_cert"] } + cert_request_pem = tls_cert_request.thanos-tls-querier-cert-csr[each.key].cert_request_pem + ca_private_key_pem = tls_private_key.thanos-tls-querier-ca-key[0].private_key_pem + ca_cert_pem = tls_self_signed_cert.thanos-tls-querier-ca-cert[0].cert_pem + + validity_period_hours = 8760 + + allowed_uses = [ + "key_encipherment", + "digital_signature", + "client_auth" + ] +} diff --git a/modules/google/thanos.tf b/modules/google/thanos.tf new file mode 100644 index 000000000..fc3ca8068 --- /dev/null +++ b/modules/google/thanos.tf @@ -0,0 +1,384 @@ +locals { + + thanos = merge( + local.helm_defaults, + { + name = local.helm_dependencies[index(local.helm_dependencies.*.name, "thanos")].name + chart = local.helm_dependencies[index(local.helm_dependencies.*.name, "thanos")].name + repository = local.helm_dependencies[index(local.helm_dependencies.*.name, "thanos")].repository + chart_version = local.helm_dependencies[index(local.helm_dependencies.*.name, "thanos")].version + namespace = "monitoring" + create_iam_resources = true + iam_policy_override = null + create_ns = false + enabled = false + default_network_policy = true + default_global_requests = false + default_global_limits = false + create_bucket = false + bucket = "thanos-store-${var.cluster-name}" + bucket_force_destroy = false + bucket_location = "europe-west1" + kms_bucket_location = "europe-west1" + generate_ca = false + trusted_ca_content = null + name_prefix = "gke-thanos" + }, + var.thanos + ) + + values_thanos = <<-VALUES + receive: + enabled: false + pdb: + create: true + minAvailable: 1 + serviceAccount: + annotations: + iam.gke.io/gcp-service-account: "${local.thanos["enabled"] && local.thanos["create_iam_resources"] ? module.iam_assumable_sa_thanos.gcp_service_account_email : ""}" + metrics: + enabled: true + serviceMonitor: + enabled: ${local.kube-prometheus-stack["enabled"] ? "true" : "false"} + query: + extraFlags: + - --query.timeout=5m + - --query.lookback-delta=15m + - --query.replica-label=rule_replica + replicaCount: 2 + replicaLabel: + - prometheus_replica + enabled: true + dnsDiscovery: + enabled: true + sidecarsService: ${local.kube-prometheus-stack["name"]}-thanos-discovery + sidecarsNamespace: "${local.kube-prometheus-stack["namespace"]}" + pdb: + create: true + minAvailable: 1 + stores: ${jsonencode(concat([for k, v in local.thanos-tls-querier : "dnssrv+_grpc._tcp.${v["name"]}-query-grpc.${local.thanos["namespace"]}.svc.cluster.local"], [for k, v in local.thanos-storegateway : "dnssrv+_grpc._tcp.${v["name"]}-storegateway.${local.thanos["namespace"]}.svc.cluster.local"]))} + queryFrontend: + extraFlags: + - --query-frontend.compress-responses + - --query-range.split-interval=12h + - --labels.split-interval=12h + - --query-range.max-retries-per-request=10 + - --labels.max-retries-per-request=10 + - --query-frontend.log-queries-longer-than=10s + replicaCount: 2 + enabled: true + pdb: + create: true + minAvailable: 1 + compactor: + extraFlags: + - --deduplication.replica-label=prometheus_replica + - --deduplication.replica-label=rule_replica + strategyType: Recreate + enabled: true + serviceAccount: + annotations: + iam.gke.io/gcp-service-account: "${local.thanos["enabled"] && local.thanos["create_iam_resources"] ? module.iam_assumable_sa_thanos-compactor.gcp_service_account_email : ""}" + storegateway: + extraFlags: + - --ignore-deletion-marks-delay=24h + replicaCount: 2 + enabled: true + serviceAccount: + annotations: + iam.gke.io/gcp-service-account: "${local.thanos["enabled"] && local.thanos["create_iam_resources"] ? module.iam_assumable_sa_thanos-sg.gcp_service_account_email : ""}" + pdb: + create: true + minAvailable: 1 + VALUES + + values_thanos_caching = <<-VALUES + queryFrontend: + extraFlags: + - --query-frontend.compress-responses + - --query-range.split-interval=12h + - --labels.split-interval=12h + - --query-range.max-retries-per-request=10 + - --labels.max-retries-per-request=10 + - --query-frontend.log-queries-longer-than=10s + - |- + --query-range.response-cache-config="config": + "addresses": + - "dnssrv+_memcache._tcp.${local.thanos-memcached["name"]}.${local.thanos-memcached["namespace"]}.svc.cluster.local" + "dns_provider_update_interval": "10s" + "max_async_buffer_size": 10000 + "max_async_concurrency": 20 + "max_get_multi_batch_size": 0 + "max_get_multi_concurrency": 100 + "max_idle_connections": 100 + "timeout": "500ms" + "type": "memcached" + - |- + --labels.response-cache-config="config": + "addresses": + - "dnssrv+_memcache._tcp.${local.thanos-memcached["name"]}.${local.thanos-memcached["namespace"]}.svc.cluster.local" + "dns_provider_update_interval": "10s" + "max_async_buffer_size": 10000 + "max_async_concurrency": 20 + "max_get_multi_batch_size": 0 + "max_get_multi_concurrency": 100 + "max_idle_connections": 100 + "timeout": "500ms" + "type": "memcached" + storegateway: + extraFlags: + - --ignore-deletion-marks-delay=24h + - |- + --index-cache.config="config": + "addresses": + - "dnssrv+_memcache._tcp.${local.thanos-memcached["name"]}.${local.thanos-memcached["namespace"]}.svc.cluster.local" + "dns_provider_update_interval": "10s" + "max_async_buffer_size": 10000 + "max_async_concurrency": 20 + "max_get_multi_batch_size": 0 + "max_get_multi_concurrency": 100 + "max_idle_connections": 100 + "max_item_size": "1MiB" + "timeout": "500ms" + "type": "memcached" + - |- + --store.caching-bucket.config="blocks_iter_ttl": "5m" + "chunk_object_attrs_ttl": "24h" + "chunk_subrange_size": 16000 + "chunk_subrange_ttl": "24h" + "config": + "addresses": + - "dnssrv+_memcache._tcp.${local.thanos-memcached["name"]}.${local.thanos-memcached["namespace"]}.svc.cluster.local" + "dns_provider_update_interval": "10s" + "max_async_buffer_size": 10000 + "max_async_concurrency": 20 + "max_get_multi_batch_size": 0 + "max_get_multi_concurrency": 100 + "max_idle_connections": 100 + "max_item_size": "1MiB" + "timeout": "500ms" + "max_chunks_get_range_requests": 3 + "metafile_content_ttl": "24h" + "metafile_doesnt_exist_ttl": "15m" + "metafile_exists_ttl": "2h" + "metafile_max_size": "1MiB" + "type": "memcached" + VALUES + + + values_store_config = <<-VALUES + objstoreConfig: + type: GCS + config: + bucket: ${local.thanos["bucket"]} + VALUES + + values_thanos_global_requests = <<-VALUES + query: + resources: + requests: + cpu: 25m + memory: 32Mi + queryFrontend: + resources: + requests: + cpu: 25m + memory: 32Mi + compactor: + resources: + requests: + cpu: 50m + memory: 258Mi + storegateway: + resources: + requests: + cpu: 25m + memory: 64Mi + VALUES + + values_thanos_global_limits = <<-VALUES + query: + resources: + limits: + memory: 128Mi + queryFrontend: + resources: + limits: + memory: 64Mi + compactor: + resources: + limits: + memory: 2Gi + storegateway: + resources: + limits: + memory: 1Gi + VALUES +} + +module "iam_assumable_sa_thanos" { + source = "terraform-google-modules/kubernetes-engine/google//modules/workload-identity" + version = "~> 9.0" + namespace = local.thanos["namespace"] + project_id = var.project_id + name = local.thanos["name"] +} + +module "iam_assumable_sa_thanos-compactor" { + source = "terraform-google-modules/kubernetes-engine/google//modules/workload-identity" + version = "~> 9.0" + namespace = local.thanos["namespace"] + project_id = var.project_id + name = "${local.thanos["name"]}-compactor" +} + +module "iam_assumable_sa_thanos-sg" { + source = "terraform-google-modules/kubernetes-engine/google//modules/workload-identity" + version = "~> 9.0" + namespace = local.thanos["namespace"] + project_id = var.project_id + name = "${local.thanos["name"]}-sg" +} + +module "thanos_bucket" { + count = local.thanos["enabled"] && local.thanos["create_bucket"] ? 1 : 0 + + source = "terraform-google-modules/cloud-storage/google//modules/simple_bucket" + version = "~> 4.0" + project_id = var.project_id + location = local.thanos["bucket_location"] + + name = local.thanos["bucket"] + + encryption = { + default_kms_key_name = module.thanos_kms_bucket[0].keys.thanos + } + +} + +module "thanos_kms_bucket" { + count = local.thanos["enabled"] && local.thanos["create_bucket"] ? 1 : 0 + source = "terraform-google-modules/kms/google" + version = "2.2.2" + + project_id = var.project_id + location = local.thanos["kms_bucket_location"] + keyring = "thanos" + keys = ["thanos"] + owners = [ + "serviceAccount:${local.thanos["cloud_storage_service_account"]}" + ] + set_owners_for = [ + "thanos" + ] +} + +module "thanos_bucket_iam" { + count = local.thanos["enabled"] ? 1 : 0 + source = "terraform-google-modules/iam/google//modules/storage_buckets_iam" + version = "~> 7.6" + + mode = "additive" + storage_buckets = [local.thanos["bucket"]] + bindings = { + "roles/storage.objectViewer" = [ + "serviceAccount:${module.iam_assumable_sa_thanos.gcp_service_account_email}", + "serviceAccount:${module.iam_assumable_sa_thanos-compactor.gcp_service_account_email}", + "serviceAccount:${module.iam_assumable_sa_thanos-sg.gcp_service_account_email}", + ] + "roles/storage.objectCreator" = [ + "serviceAccount:${module.iam_assumable_sa_thanos.gcp_service_account_email}", + "serviceAccount:${module.iam_assumable_sa_thanos-compactor.gcp_service_account_email}", + "serviceAccount:${module.iam_assumable_sa_thanos-sg.gcp_service_account_email}", + ] + } +} + +resource "kubernetes_namespace" "thanos" { + count = local.thanos["enabled"] && local.thanos["create_ns"] ? 1 : 0 + + metadata { + labels = { + name = local.thanos["namespace"] + "${local.labels_prefix}/component" = "monitoring" + } + + name = local.thanos["namespace"] + } +} + +resource "helm_release" "thanos" { + count = local.thanos["enabled"] ? 1 : 0 + repository = local.thanos["repository"] + name = local.thanos["name"] + chart = local.thanos["chart"] + version = local.thanos["chart_version"] + timeout = local.thanos["timeout"] + force_update = local.thanos["force_update"] + recreate_pods = local.thanos["recreate_pods"] + wait = local.thanos["wait"] + atomic = local.thanos["atomic"] + cleanup_on_fail = local.thanos["cleanup_on_fail"] + dependency_update = local.thanos["dependency_update"] + disable_crd_hooks = local.thanos["disable_crd_hooks"] + disable_webhooks = local.thanos["disable_webhooks"] + render_subchart_notes = local.thanos["render_subchart_notes"] + replace = local.thanos["replace"] + reset_values = local.thanos["reset_values"] + reuse_values = local.thanos["reuse_values"] + skip_crds = local.thanos["skip_crds"] + verify = local.thanos["verify"] + values = compact([ + local.values_thanos, + local.values_store_config, + local.thanos["default_global_requests"] ? local.values_thanos_global_requests : null, + local.thanos["default_global_limits"] ? local.values_thanos_global_limits : null, + local.thanos-memcached["enabled"] ? local.values_thanos_caching : null, + local.thanos["extra_values"] + ]) + namespace = local.thanos["create_ns"] ? kubernetes_namespace.thanos.*.metadata.0.name[count.index] : local.thanos["namespace"] + + depends_on = [ + helm_release.kube-prometheus-stack, + helm_release.thanos-memcached + ] +} + +resource "tls_private_key" "thanos-tls-querier-ca-key" { + count = local.thanos["generate_ca"] ? 1 : 0 + algorithm = "ECDSA" + ecdsa_curve = "P384" +} + +resource "tls_self_signed_cert" "thanos-tls-querier-ca-cert" { + count = local.thanos["generate_ca"] ? 1 : 0 + private_key_pem = tls_private_key.thanos-tls-querier-ca-key[0].private_key_pem + is_ca_certificate = true + + subject { + common_name = var.cluster-name + organization = var.cluster-name + } + + validity_period_hours = 87600 + + allowed_uses = [ + "cert_signing" + ] +} + +resource "kubernetes_secret" "thanos-ca" { + count = local.thanos["enabled"] && (local.thanos["generate_ca"] || local.thanos["trusted_ca_content"] != null) ? 1 : 0 + metadata { + name = "${local.thanos["name"]}-ca" + namespace = local.thanos["create_ns"] ? kubernetes_namespace.thanos.*.metadata.0.name[count.index] : local.thanos["namespace"] + } + + data = { + "ca.crt" = local.thanos["generate_ca"] ? tls_self_signed_cert.thanos-tls-querier-ca-cert[count.index].cert_pem : local.thanos["trusted_ca_content"] + } +} + +output "thanos_ca" { + value = element(concat(tls_self_signed_cert.thanos-tls-querier-ca-cert[*].cert_pem, [""]), 0) +} diff --git a/modules/google/traefik.tf b/modules/google/traefik.tf new file mode 120000 index 000000000..817a38f9d --- /dev/null +++ b/modules/google/traefik.tf @@ -0,0 +1 @@ +../../traefik.tf \ No newline at end of file diff --git a/modules/google/variables-google.tf b/modules/google/variables-google.tf new file mode 100644 index 000000000..64b40e86f --- /dev/null +++ b/modules/google/variables-google.tf @@ -0,0 +1,41 @@ +variable "google" { + description = "GCP provider customization" + type = any + default = {} +} + +variable "project_id" { + description = "GCP project id" + type = string + default = "" +} + +variable "cni-metrics-helper" { + description = "Customize cni-metrics-helper deployment, see `cni-metrics-helper.tf` for supported values" + type = any + default = {} +} + +variable "gke" { + description = "GKE cluster inputs" + type = any + default = {} +} + +variable "prometheus-cloudwatch-exporter" { + description = "Customize prometheus-cloudwatch-exporter chart, see `prometheus-cloudwatch-exporter.tf` for supported values" + type = any + default = {} +} + +variable "tags" { + description = "Map of tags for Google resources" + type = map(any) + default = {} +} + +variable "velero" { + description = "Customize velero chart, see `velero.tf` for supported values" + type = any + default = {} +} diff --git a/modules/google/versions.tf b/modules/google/versions.tf index 591bd7087..eda74991d 100644 --- a/modules/google/versions.tf +++ b/modules/google/versions.tf @@ -13,5 +13,21 @@ terraform { source = "NikolaLohinski/jinja" version = "~> 1.15" } + flux = { + source = "fluxcd/flux" + version = "1.0.0-rc.5" + } + github = { + source = "integrations/github" + version = "~> 5.0" + } + tls = { + source = "hashicorp/tls" + version = "~> 4.0" + } + http = { + source = "hashicorp/http" + version = ">= 3" + } } } diff --git a/modules/google/victoria-metrics-k8s-stack.tf b/modules/google/victoria-metrics-k8s-stack.tf new file mode 100644 index 000000000..e2e040464 --- /dev/null +++ b/modules/google/victoria-metrics-k8s-stack.tf @@ -0,0 +1,207 @@ +locals { + victoria-metrics-k8s-stack = merge( + local.helm_defaults, + { + name = local.helm_dependencies[index(local.helm_dependencies.*.name, "victoria-metrics-k8s-stack")].name + chart = local.helm_dependencies[index(local.helm_dependencies.*.name, "victoria-metrics-k8s-stack")].name + repository = local.helm_dependencies[index(local.helm_dependencies.*.name, "victoria-metrics-k8s-stack")].repository + chart_version = local.helm_dependencies[index(local.helm_dependencies.*.name, "victoria-metrics-k8s-stack")].version + namespace = "monitoring" + enabled = false + allowed_cidrs = ["0.0.0.0/0"] + default_network_policy = true + install_prometheus_operator_crds = true + }, + var.victoria-metrics-k8s-stack + ) + + values_victoria-metrics-k8s-stack = <