From 5ef4a1b52d6beec2948ddc0460a1b63054e1af32 Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 13:48:23 +0530 Subject: [PATCH 01/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20updated=20module?= =?UTF-8?q?=20as=20per=20certification-manager=20addon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.tf | 9 +++++++++ outputs.tf | 14 ++++++++++++++ override_values.tf | 30 ++++++++++++++++++++++++++++++ variables.tf | 20 +++++++++++++++++++- 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 62df759..bdd729c 100644 --- a/main.tf +++ b/main.tf @@ -187,4 +187,13 @@ module "keda" { manage_via_gitops = var.manage_via_gitops addon_context = local.addon_context keda_extra_configs = var.keda_extra_configs +} + +module "certification_manager" { + count = var.certification_manager ? 1 : 0 + source = "./addons/cert-manager" + helm_config = var.certification_manager_helm_config != null ? var.certification_manager_helm_config : { values = [local_file.certification_manager_helm_config[count.index].content] } + manage_via_gitops = var.manage_via_gitops + addon_context = local.addon_context + certification_manager_extra_configs = var.certification_manager_extra_configs } \ No newline at end of file diff --git a/outputs.tf b/outputs.tf index b44d0c7..79a0d9f 100644 --- a/outputs.tf +++ b/outputs.tf @@ -294,4 +294,18 @@ output "keda_chart_version" { output "keda_repository" { value = module.keda[*].repository description = "Helm chart repository of the Keda." +} + +#----------- CERTICATION-MANAGER ------------------------ +output "certification_manager_namespace" { + value = module.certification_manager[*].namespace + description = "The namespace where ertification-manager is deployed." +} +output "certification_manager_chart_version" { + value = module.certification_manager[*].chart_version + description = "Chart version of the certification-manager Helm Chart." +} +output "certification_manager_repository" { + value = module.certification_manager[*].repository + description = "Helm chart repository of the certification-manager." } \ No newline at end of file diff --git a/override_values.tf b/override_values.tf index f5086a3..90b1fbb 100644 --- a/override_values.tf +++ b/override_values.tf @@ -633,4 +633,34 @@ resources: memory: 150Mi EOT filename = "${path.module}/override_vales/keda.yaml" +} + +#-----------CERTIFICATION-MANAGER-------------------- +resource "local_file" "certification_manager_helm_config" { + count = var.certification_manager && (var.certification_manager_helm_config == null) ? 1 : 0 + content = < Date: Wed, 4 Oct 2023 14:08:03 +0530 Subject: [PATCH 02/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20Added=20terraform?= =?UTF-8?q?=20code=20for=20certification=20manager=20and=20updated=20Readm?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/cert-manager/README.md | 62 ++ .../config/certification_manager.yaml | 737 ++++++++++++++++++ addons/cert-manager/locals.tf | 44 ++ addons/cert-manager/main.tf | 14 + addons/cert-manager/outputs.tf | 11 + addons/cert-manager/variables.tf | 32 + addons/cert-manager/versions.tf | 10 + 7 files changed, 910 insertions(+) create mode 100644 addons/cert-manager/README.md create mode 100644 addons/cert-manager/config/certification_manager.yaml create mode 100644 addons/cert-manager/locals.tf create mode 100644 addons/cert-manager/main.tf create mode 100644 addons/cert-manager/outputs.tf create mode 100644 addons/cert-manager/variables.tf create mode 100644 addons/cert-manager/versions.tf diff --git a/addons/cert-manager/README.md b/addons/cert-manager/README.md new file mode 100644 index 0000000..8e168f1 --- /dev/null +++ b/addons/cert-manager/README.md @@ -0,0 +1,62 @@ +# Certification Manager Helm Chart + +Certification Manager is a Kubernetes addon to automate the management and issuance of TLS certificates from various issuing sources. +It will ensure certificates are valid and up to date periodically, and attempt to renew certificates at an appropriate time before expiry.. + +## Installation +Below terraform script shows how to use Certification Manager Terraform Addon, A complete example is also given [here](https://github.com/clouddrove/terraform-helm-eks-addons/blob/master/_examples/complete/main.tf). +```hcl +module "addons" { + source = "clouddrove/eks-addons/aws" + version = "1.0.0" + + depends_on = [module.eks.cluster_id] + eks_cluster_name = module.eks.cluster_name + + certification_manager = true +} +``` + + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.0.0 | +| [kubernetes](#requirement\_kubernetes) | >= 2.10 | + +## Providers + +| Name | Version | +|------|---------| +| [kubernetes](#provider\_kubernetes) | >= 2.10 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [helm\_addon](#module\_helm\_addon) | ../helm | n/a | + +## Resources + +| Name | Type | +|------|------| +| [kubernetes_namespace_v1.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace_v1) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [addon\_context](#input\_addon\_context) | Input configuration for the addon |
object({
aws_caller_identity_account_id = string
aws_caller_identity_arn = string
aws_eks_cluster_endpoint = string
aws_partition_id = string
aws_region_name = string
eks_cluster_id = string
eks_oidc_issuer_url = string
eks_oidc_provider_arn = string
tags = map(string)
})
| n/a | yes | +| [helm\_config](#input\_helm\_config) | Helm provider config for Certification Manager | `any` | `{}` | no | +| [manage\_via\_gitops](#input\_manage\_via\_gitops) | Determines if the add-on should be managed via GitOps | `bool` | `false` | no | +| [certification_manager\_extra\_configs](#input\certification_manager\_extra\_configs) | Override attributes of helm\_release terraform resource | `any` | `{}` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [chart\_version](#output\_chart\_version) | n/a | +| [namespace](#output\_namespace) | n/a | +| [repository](#output\_repository) | n/a | + diff --git a/addons/cert-manager/config/certification_manager.yaml b/addons/cert-manager/config/certification_manager.yaml new file mode 100644 index 0000000..2d47d71 --- /dev/null +++ b/addons/cert-manager/config/certification_manager.yaml @@ -0,0 +1,737 @@ +# Default values for cert-manager. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +global: + # Reference to one or more secrets to be used when pulling images + # ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + imagePullSecrets: [] + # - name: "image-pull-secret" + + # Labels to apply to all resources + # Please note that this does not add labels to the resources created dynamically by the controllers. + # For these resources, you have to add the labels in the template in the cert-manager custom resource: + # eg. podTemplate/ ingressTemplate in ACMEChallengeSolverHTTP01Ingress + # ref: https://cert-manager.io/docs/reference/api-docs/#acme.cert-manager.io/v1.ACMEChallengeSolverHTTP01Ingress + # eg. secretTemplate in CertificateSpec + # ref: https://cert-manager.io/docs/reference/api-docs/#cert-manager.io/v1.CertificateSpec + commonLabels: {} + # team_name: dev + + # Optional priority class to be used for the cert-manager pods + priorityClassName: "" + rbac: + create: true + # Aggregate ClusterRoles to Kubernetes default user-facing roles. Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles + aggregateClusterRoles: true + + podSecurityPolicy: + enabled: false + useAppArmor: true + + # Set the verbosity of cert-manager. Range of 0 - 6 with 6 being the most verbose. + logLevel: 2 + + leaderElection: + # Override the namespace used for the leader election lease + namespace: "kube-system" + + # The duration that non-leader candidates will wait after observing a + # leadership renewal until attempting to acquire leadership of a led but + # unrenewed leader slot. This is effectively the maximum duration that a + # leader can be stopped before it is replaced by another candidate. + # leaseDuration: 60s + + # The interval between attempts by the acting master to renew a leadership + # slot before it stops leading. This must be less than or equal to the + # lease duration. + # renewDeadline: 40s + + # The duration the clients should wait between attempting acquisition and + # renewal of a leadership. + # retryPeriod: 15s + +installCRDs: false + +replicaCount: 1 + +strategy: {} + # type: RollingUpdate + # rollingUpdate: + # maxSurge: 0 + # maxUnavailable: 1 + +podDisruptionBudget: + enabled: false + + # minAvailable and maxUnavailable can either be set to an integer (e.g. 1) + # or a percentage value (e.g. 25%) + # if neither minAvailable or maxUnavailable is set, we default to `minAvailable: 1` + # minAvailable: 1 + # maxUnavailable: 1 + +# Comma separated list of feature gates that should be enabled on the +# controller pod. +featureGates: "" + +# The maximum number of challenges that can be scheduled as 'processing' at once +maxConcurrentChallenges: 60 + +image: + repository: quay.io/jetstack/cert-manager-controller + # You can manage a registry with + # registry: quay.io + # repository: jetstack/cert-manager-controller + + # Override the image tag to deploy by setting this variable. + # If no value is set, the chart's appVersion will be used. + # tag: canary + + # Setting a digest will override any tag + # digest: sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20 + pullPolicy: IfNotPresent + +# Override the namespace used to store DNS provider credentials etc. for ClusterIssuer +# resources. By default, the same namespace as cert-manager is deployed within is +# used. This namespace will not be automatically created by the Helm chart. +clusterResourceNamespace: "" + +# This namespace allows you to define where the services will be installed into +# if not set then they will use the namespace of the release +# This is helpful when installing cert manager as a chart dependency (sub chart) +namespace: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + # name: "" + # Optional additional annotations to add to the controller's ServiceAccount + # annotations: {} + # Automount API credentials for a Service Account. + # Optional additional labels to add to the controller's ServiceAccount + # labels: {} + automountServiceAccountToken: true + +# Automounting API credentials for a particular pod +# automountServiceAccountToken: true + +# When this flag is enabled, secrets will be automatically removed when the certificate resource is deleted +enableCertificateOwnerRef: false + +# Used to configure options for the controller pod. +# This allows setting options that'd usually be provided via flags. +# An APIVersion and Kind must be specified in your values.yaml file. +# Flags will override options that are set here. +config: +# apiVersion: controller.config.cert-manager.io/v1alpha1 +# kind: ControllerConfiguration +# logging: +# verbosity: 2 +# format: text +# leaderElectionConfig: +# namespace: kube-system +# kubernetesAPIQPS: 9000 +# kubernetesAPIBurst: 9000 +# numberOfConcurrentWorkers: 200 +# featureGates: +# additionalCertificateOutputFormats: true +# experimentalCertificateSigningRequestControllers: true +# experimentalGatewayAPISupport: true +# serverSideApply: true +# literalCertificateSubject: true +# useCertificateRequestBasicConstraints: true + +# Setting Nameservers for DNS01 Self Check +# See: https://cert-manager.io/docs/configuration/acme/dns01/#setting-nameservers-for-dns01-self-check + +# Comma separated string with host and port of the recursive nameservers cert-manager should query +dns01RecursiveNameservers: "" + +# Forces cert-manager to only use the recursive nameservers for verification. +# Enabling this option could cause the DNS01 self check to take longer due to caching performed by the recursive nameservers +dns01RecursiveNameserversOnly: false + +# Additional command line flags to pass to cert-manager controller binary. +# To see all available flags run docker run quay.io/jetstack/cert-manager-controller: --help +extraArgs: [] + # Use this flag to enable or disable arbitrary controllers, for example, disable the CertificiateRequests approver + # - --controllers=*,-certificaterequests-approver + +extraEnv: [] +# - name: SOME_VAR +# value: 'some value' + +resources: {} + # requests: + # cpu: 10m + # memory: 32Mi + +# Pod Security Context +# ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ +securityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + +# Container Security Context to be set on the controller component container +# ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ +containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + + +volumes: [] + +volumeMounts: [] + +# Optional additional annotations to add to the controller Deployment +# deploymentAnnotations: {} + +# Optional additional annotations to add to the controller Pods +# podAnnotations: {} + +podLabels: {} + +# Optional annotations to add to the controller Service +# serviceAnnotations: {} + +# Optional additional labels to add to the controller Service +# serviceLabels: {} + +# Optional DNS settings, useful if you have a public and private DNS zone for +# the same domain on Route 53. What follows is an example of ensuring +# cert-manager can access an ingress or DNS TXT records at all times. +# NOTE: This requires Kubernetes 1.10 or `CustomPodDNS` feature gate enabled for +# the cluster to work. +# podDnsPolicy: "None" +# podDnsConfig: +# nameservers: +# - "1.1.1.1" +# - "8.8.8.8" + +nodeSelector: + kubernetes.io/os: linux + +ingressShim: {} + # defaultIssuerName: "" + # defaultIssuerKind: "" + # defaultIssuerGroup: "" + +prometheus: + enabled: true + servicemonitor: + enabled: false + prometheusInstance: default + targetPort: 9402 + path: /metrics + interval: 60s + scrapeTimeout: 30s + labels: {} + annotations: {} + honorLabels: false + endpointAdditionalProperties: {} + +# Use these variables to configure the HTTP_PROXY environment variables +# http_proxy: "http://proxy:8080" +# https_proxy: "https://proxy:8080" +# no_proxy: 127.0.0.1,localhost + +# A Kubernetes Affinty, if required; see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#affinity-v1-core +# for example: +# affinity: +# nodeAffinity: +# requiredDuringSchedulingIgnoredDuringExecution: +# nodeSelectorTerms: +# - matchExpressions: +# - key: foo.bar.com/role +# operator: In +# values: +# - master +affinity: {} + +# A list of Kubernetes Tolerations, if required; see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#toleration-v1-core +# for example: +# tolerations: +# - key: foo.bar.com/role +# operator: Equal +# value: master +# effect: NoSchedule +tolerations: [] + +# A list of Kubernetes TopologySpreadConstraints, if required; see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.27/#topologyspreadconstraint-v1-core +# for example: +# topologySpreadConstraints: +# - maxSkew: 2 +# topologyKey: topology.kubernetes.io/zone +# whenUnsatisfiable: ScheduleAnyway +# labelSelector: +# matchLabels: +# app.kubernetes.io/instance: cert-manager +# app.kubernetes.io/component: controller +topologySpreadConstraints: [] + +# LivenessProbe settings for the controller container of the controller Pod. +# +# Disabled by default, because the controller has a leader election mechanism +# which should cause it to exit if it is unable to renew its leader election +# record. +# LivenessProbe durations and thresholds are based on those used for the Kubernetes +# controller-manager. See: +# https://github.com/kubernetes/kubernetes/blob/806b30170c61a38fedd54cc9ede4cd6275a1ad3b/cmd/kubeadm/app/util/staticpod/utils.go#L241-L245 +livenessProbe: + enabled: false + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 15 + successThreshold: 1 + failureThreshold: 8 + +# enableServiceLinks indicates whether information about services should be +# injected into pod's environment variables, matching the syntax of Docker +# links. +enableServiceLinks: false + +webhook: + replicaCount: 1 + timeoutSeconds: 10 + + # Used to configure options for the webhook pod. + # This allows setting options that'd usually be provided via flags. + # An APIVersion and Kind must be specified in your values.yaml file. + # Flags will override options that are set here. + config: + # apiVersion: webhook.config.cert-manager.io/v1alpha1 + # kind: WebhookConfiguration + + # The port that the webhook should listen on for requests. + # In GKE private clusters, by default kubernetes apiservers are allowed to + # talk to the cluster nodes only on 443 and 10250. so configuring + # securePort: 10250, will work out of the box without needing to add firewall + # rules or requiring NET_BIND_SERVICE capabilities to bind port numbers <1000. + # This should be uncommented and set as a default by the chart once we graduate + # the apiVersion of WebhookConfiguration past v1alpha1. + # securePort: 10250 + + strategy: {} + # type: RollingUpdate + # rollingUpdate: + # maxSurge: 0 + # maxUnavailable: 1 + + # Pod Security Context to be set on the webhook component Pod + # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + securityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + + podDisruptionBudget: + enabled: false + + # minAvailable and maxUnavailable can either be set to an integer (e.g. 1) + # or a percentage value (e.g. 25%) + # if neither minAvailable or maxUnavailable is set, we default to `minAvailable: 1` + # minAvailable: 1 + # maxUnavailable: 1 + + # Container Security Context to be set on the webhook component container + # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + + # Optional additional annotations to add to the webhook Deployment + # deploymentAnnotations: {} + + # Optional additional annotations to add to the webhook Pods + # podAnnotations: {} + + # Optional additional annotations to add to the webhook Service + # serviceAnnotations: {} + + # Optional additional annotations to add to the webhook MutatingWebhookConfiguration + # mutatingWebhookConfigurationAnnotations: {} + + # Optional additional annotations to add to the webhook ValidatingWebhookConfiguration + # validatingWebhookConfigurationAnnotations: {} + + # Additional command line flags to pass to cert-manager webhook binary. + # To see all available flags run docker run quay.io/jetstack/cert-manager-webhook: --help + extraArgs: [] + # Path to a file containing a WebhookConfiguration object used to configure the webhook + # - --config= + + # Comma separated list of feature gates that should be enabled on the + # webhook pod. + featureGates: "" + + resources: {} + # requests: + # cpu: 10m + # memory: 32Mi + + ## Liveness and readiness probe values + ## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + ## + livenessProbe: + failureThreshold: 3 + initialDelaySeconds: 60 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + readinessProbe: + failureThreshold: 3 + initialDelaySeconds: 5 + periodSeconds: 5 + successThreshold: 1 + timeoutSeconds: 1 + + nodeSelector: + kubernetes.io/os: linux + + affinity: {} + + tolerations: [] + + topologySpreadConstraints: [] + + # Optional additional labels to add to the Webhook Pods + podLabels: {} + + # Optional additional labels to add to the Webhook Service + serviceLabels: {} + + image: + repository: quay.io/jetstack/cert-manager-webhook + # You can manage a registry with + # registry: quay.io + # repository: jetstack/cert-manager-webhook + + # Override the image tag to deploy by setting this variable. + # If no value is set, the chart's appVersion will be used. + # tag: canary + + # Setting a digest will override any tag + # digest: sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20 + + pullPolicy: IfNotPresent + + serviceAccount: + # Specifies whether a service account should be created + create: true + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + # name: "" + # Optional additional annotations to add to the controller's ServiceAccount + # annotations: {} + # Optional additional labels to add to the webhook's ServiceAccount + # labels: {} + # Automount API credentials for a Service Account. + automountServiceAccountToken: true + + # Automounting API credentials for a particular pod + # automountServiceAccountToken: true + + # The port that the webhook should listen on for requests. + # In GKE private clusters, by default kubernetes apiservers are allowed to + # talk to the cluster nodes only on 443 and 10250. so configuring + # securePort: 10250, will work out of the box without needing to add firewall + # rules or requiring NET_BIND_SERVICE capabilities to bind port numbers <1000 + securePort: 10250 + + # Specifies if the webhook should be started in hostNetwork mode. + # + # Required for use in some managed kubernetes clusters (such as AWS EKS) with custom + # CNI (such as calico), because control-plane managed by AWS cannot communicate + # with pods' IP CIDR and admission webhooks are not working + # + # Since the default port for the webhook conflicts with kubelet on the host + # network, `webhook.securePort` should be changed to an available port if + # running in hostNetwork mode. + hostNetwork: false + + # Specifies how the service should be handled. Useful if you want to expose the + # webhook to outside of the cluster. In some cases, the control plane cannot + # reach internal services. + serviceType: ClusterIP + # loadBalancerIP: + + # Overrides the mutating webhook and validating webhook so they reach the webhook + # service using the `url` field instead of a service. + url: {} + # host: + + # Enables default network policies for webhooks. + networkPolicy: + enabled: false + ingress: + - from: + - ipBlock: + cidr: 0.0.0.0/0 + egress: + - ports: + - port: 80 + protocol: TCP + - port: 443 + protocol: TCP + - port: 53 + protocol: TCP + - port: 53 + protocol: UDP + # On OpenShift and OKD, the Kubernetes API server listens on + # port 6443. + - port: 6443 + protocol: TCP + to: + - ipBlock: + cidr: 0.0.0.0/0 + + volumes: [] + volumeMounts: [] + + # enableServiceLinks indicates whether information about services should be + # injected into pod's environment variables, matching the syntax of Docker + # links. + enableServiceLinks: false + +cainjector: + enabled: true + replicaCount: 1 + + strategy: {} + # type: RollingUpdate + # rollingUpdate: + # maxSurge: 0 + # maxUnavailable: 1 + + # Pod Security Context to be set on the cainjector component Pod + # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + securityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + + podDisruptionBudget: + enabled: false + + # minAvailable and maxUnavailable can either be set to an integer (e.g. 1) + # or a percentage value (e.g. 25%) + # if neither minAvailable or maxUnavailable is set, we default to `minAvailable: 1` + # minAvailable: 1 + # maxUnavailable: 1 + + # Container Security Context to be set on the cainjector component container + # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + + + # Optional additional annotations to add to the cainjector Deployment + # deploymentAnnotations: {} + + # Optional additional annotations to add to the cainjector Pods + # podAnnotations: {} + + # Additional command line flags to pass to cert-manager cainjector binary. + # To see all available flags run docker run quay.io/jetstack/cert-manager-cainjector: --help + extraArgs: [] + # Enable profiling for cainjector + # - --enable-profiling=true + + resources: {} + # requests: + # cpu: 10m + # memory: 32Mi + + nodeSelector: + kubernetes.io/os: linux + + affinity: {} + + tolerations: [] + + topologySpreadConstraints: [] + + # Optional additional labels to add to the CA Injector Pods + podLabels: {} + + image: + repository: quay.io/jetstack/cert-manager-cainjector + # You can manage a registry with + # registry: quay.io + # repository: jetstack/cert-manager-cainjector + + # Override the image tag to deploy by setting this variable. + # If no value is set, the chart's appVersion will be used. + # tag: canary + + # Setting a digest will override any tag + # digest: sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20 + + pullPolicy: IfNotPresent + + serviceAccount: + # Specifies whether a service account should be created + create: true + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + # name: "" + # Optional additional annotations to add to the controller's ServiceAccount + # annotations: {} + # Automount API credentials for a Service Account. + # Optional additional labels to add to the cainjector's ServiceAccount + # labels: {} + automountServiceAccountToken: true + + # Automounting API credentials for a particular pod + # automountServiceAccountToken: true + + volumes: [] + volumeMounts: [] + + # enableServiceLinks indicates whether information about services should be + # injected into pod's environment variables, matching the syntax of Docker + # links. + enableServiceLinks: false + +acmesolver: + image: + repository: quay.io/jetstack/cert-manager-acmesolver + # You can manage a registry with + # registry: quay.io + # repository: jetstack/cert-manager-acmesolver + + # Override the image tag to deploy by setting this variable. + # If no value is set, the chart's appVersion will be used. + # tag: canary + + # Setting a digest will override any tag + # digest: sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20 + +# This startupapicheck is a Helm post-install hook that waits for the webhook +# endpoints to become available. +# The check is implemented using a Kubernetes Job- if you are injecting mesh +# sidecar proxies into cert-manager pods, you probably want to ensure that they +# are not injected into this Job's pod. Otherwise the installation may time out +# due to the Job never being completed because the sidecar proxy does not exit. +# See https://github.com/cert-manager/cert-manager/pull/4414 for context. +startupapicheck: + enabled: true + + # Pod Security Context to be set on the startupapicheck component Pod + # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + securityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + + # Container Security Context to be set on the controller component container + # ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ + containerSecurityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + + # Timeout for 'kubectl check api' command + timeout: 1m + + # Job backoffLimit + backoffLimit: 4 + + # Optional additional annotations to add to the startupapicheck Job + jobAnnotations: + helm.sh/hook: post-install + helm.sh/hook-weight: "1" + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + + # Optional additional annotations to add to the startupapicheck Pods + # podAnnotations: {} + + # Additional command line flags to pass to startupapicheck binary. + # To see all available flags run docker run quay.io/jetstack/cert-manager-ctl: --help + extraArgs: [] + + resources: {} + # requests: + # cpu: 10m + # memory: 32Mi + + nodeSelector: + kubernetes.io/os: linux + + affinity: {} + + tolerations: [] + + # Optional additional labels to add to the startupapicheck Pods + podLabels: {} + + image: + repository: quay.io/jetstack/cert-manager-ctl + # You can manage a registry with + # registry: quay.io + # repository: jetstack/cert-manager-ctl + + # Override the image tag to deploy by setting this variable. + # If no value is set, the chart's appVersion will be used. + # tag: canary + + # Setting a digest will override any tag + # digest: sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20 + + pullPolicy: IfNotPresent + + rbac: + # annotations for the startup API Check job RBAC and PSP resources + annotations: + helm.sh/hook: post-install + helm.sh/hook-weight: "-5" + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + + # Automounting API credentials for a particular pod + # automountServiceAccountToken: true + + serviceAccount: + # Specifies whether a service account should be created + create: true + + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + # name: "" + + # Optional additional annotations to add to the Job's ServiceAccount + annotations: + helm.sh/hook: post-install + helm.sh/hook-weight: "-5" + helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded + + # Automount API credentials for a Service Account. + automountServiceAccountToken: true + + # Optional additional labels to add to the startupapicheck's ServiceAccount + # labels: {} + + volumes: [] + volumeMounts: [] + + # enableServiceLinks indicates whether information about services should be + # injected into pod's environment variables, matching the syntax of Docker + # links. + enableServiceLinks: false diff --git a/addons/cert-manager/locals.tf b/addons/cert-manager/locals.tf new file mode 100644 index 0000000..be649e4 --- /dev/null +++ b/addons/cert-manager/locals.tf @@ -0,0 +1,44 @@ +locals { + name = "cert-manager" + + default_helm_config = { + name = try(var.certification_manager_extra_configs.name, local.name) + chart = try(var.certification_manager_extra_configs.chart, local.name) + repository = try(var.certification_manager_extra_configs.repository, "https://charts.jetstack.io") + version = try(var.certification_manager_extra_configs.version, "1.13.1") + namespace = try(var.certification_manager_extra_configs.namespace, "cert-manager") + create_namespace = try(var.certification_manager_extra_configs.create_namespace, true) + description = "Certification manager helm Chart deployment configuration" + timeout = try(var.certification_manager_extra_configs.timeout, "600") + lint = try(var.certification_manager_extra_configs.lint, "false") + repository_key_file = try(var.certification_manager_extra_configs.repository_key_file, "") + repository_cert_file = try(var.certification_manager_extra_configs.repository_cert_file, "") + repository_username = try(var.certification_manager_extra_configs.repository_password, "") + repository_password = try(var.certification_manager_extra_configs.repository_password, "") + verify = try(var.certification_manager_extra_configs.verify, "false") + keyring = try(var.certification_manager_extra_configs.keyring, "") + disable_webhooks = try(var.certification_manager_extra_configs.disable_webhooks, "false") + reuse_values = try(var.certification_manager_extra_configs.reuse_values, "false") + reset_values = try(var.certification_manager_extra_configs.reset_values, "false") + force_update = try(var.certification_manager_extra_configs.force_update, "false") + recreate_pods = try(var.certification_manager_extra_configs.recreate_pods, "false") + cleanup_on_fail = try(var.certification_manager_extra_configs.cleanup_on_fail, "false") + max_history = try(var.certification_manager_extra_configs.max_history, "0") + atomic = try(var.certification_manager_extra_configs.atomic, "false") + skip_crds = try(var.certification_manager_extra_configs.skip_crds, "false") + render_subchart_notes = try(var.certification_manager_extra_configs.render_subchart_notes, "true") + disable_openapi_validation = try(var.certification_manager_extra_configs.disable_openapi_validation, "false") + wait = try(var.certification_manager_extra_configs.wait, "true") + wait_for_jobs = try(var.certification_manager_extra_configs.wait_for_jobs, "false") + dependency_update = try(var.certification_manager_extra_configs.dependency_update, "false") + replace = try(var.certification_manager_extra_configs.replace, "false") + } + + certification_manager_extra_configs = var.certification_manager_extra_configs + + helm_config = merge( + local.default_helm_config, + var.helm_config, + local.certification_manager_extra_configs + ) +} diff --git a/addons/cert-manager/main.tf b/addons/cert-manager/main.tf new file mode 100644 index 0000000..e47a70c --- /dev/null +++ b/addons/cert-manager/main.tf @@ -0,0 +1,14 @@ +module "helm_addon" { + source = "../helm" + + manage_via_gitops = var.manage_via_gitops + helm_config = local.helm_config + addon_context = var.addon_context + + depends_on = [kubernetes_namespace_v1.this] +} + +resource "kubernetes_namespace_v1" "this" { + count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "cert-manager" ? 1 : 0 + +} diff --git a/addons/cert-manager/outputs.tf b/addons/cert-manager/outputs.tf new file mode 100644 index 0000000..a3832b1 --- /dev/null +++ b/addons/cert-manager/outputs.tf @@ -0,0 +1,11 @@ +output "namespace" { + value = local.default_helm_config.namespace +} + +output "chart_version" { + value = local.default_helm_config.version +} + +output "repository" { + value = local.default_helm_config.repository +} \ No newline at end of file diff --git a/addons/cert-manager/variables.tf b/addons/cert-manager/variables.tf new file mode 100644 index 0000000..69eec4f --- /dev/null +++ b/addons/cert-manager/variables.tf @@ -0,0 +1,32 @@ +variable "helm_config" { + description = "Helm provider config for Certification Manager" + type = any + default = {} +} + +variable "manage_via_gitops" { + description = "Determines if the add-on should be managed via GitOps" + type = bool + default = false +} + +variable "addon_context" { + description = "Input configuration for the addon" + type = object({ + aws_caller_identity_account_id = string + aws_caller_identity_arn = string + aws_eks_cluster_endpoint = string + aws_partition_id = string + aws_region_name = string + eks_cluster_id = string + eks_oidc_issuer_url = string + eks_oidc_provider_arn = string + tags = map(string) + }) +} + +variable "certification_manager_extra_configs" { + description = "Override attributes of helm_release terraform resource" + type = any + default = {} +} \ No newline at end of file diff --git a/addons/cert-manager/versions.tf b/addons/cert-manager/versions.tf new file mode 100644 index 0000000..55fba73 --- /dev/null +++ b/addons/cert-manager/versions.tf @@ -0,0 +1,10 @@ +terraform { + required_version = ">= 1.0.0" + + required_providers { + kubernetes = { + source = "hashicorp/kubernetes" + version = ">= 2.10" + } + } +} From ffdfe159d3236e327370f6b8365a28e01544abd4 Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 14:14:16 +0530 Subject: [PATCH 03/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20Added=20certificat?= =?UTF-8?q?ion-manager=20example=20in=20complete=20folder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../override-certification-manager.yaml | 21 +++++++++++++++++++ _examples/complete/main.tf | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 _examples/complete/config/override-certification-manager.yaml diff --git a/_examples/complete/config/override-certification-manager.yaml b/_examples/complete/config/override-certification-manager.yaml new file mode 100644 index 0000000..3874dd0 --- /dev/null +++ b/_examples/complete/config/override-certification-manager.yaml @@ -0,0 +1,21 @@ +## Node affinity for particular node in which labels key is "Infra-Services" and value is "true" + +affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "eks.amazonaws.com/nodegroup" + operator: In + values: + - "critical" + +resources: + limits: + cpu: 200m + memory: 250Mi + requests: + cpu: 50m + memory: 150Mi + +installCRDs: true diff --git a/_examples/complete/main.tf b/_examples/complete/main.tf index 8a9f9ed..783b800 100644 --- a/_examples/complete/main.tf +++ b/_examples/complete/main.tf @@ -168,6 +168,7 @@ module "addons" { fluent_bit = true velero = true keda = true + certification_manager = true # -- Addons with mandatory variable istio_ingress = true @@ -195,6 +196,7 @@ module "addons" { new_relic_helm_config = { values = [file("./config/override-new-relic.yaml")] } kube_state_metrics_helm_config = { values = [file("./config/override-kube-state-matrics.yaml")] } keda_helm_config = { values = [file("./config/keda/override-keda.yaml")] } + certification_manager_helm_config = { values = [file("./config/override-certification-manager.yaml")] } # -- Override Helm Release attributes metrics_server_extra_configs = var.metrics_server_extra_configs @@ -214,6 +216,7 @@ module "addons" { new_relic_extra_configs = var.new_relic_extra_configs kube_state_metrics_extra_configs = var.kube_state_metrics_extra_configs keda_extra_configs = var.keda_extra_configs + certification_manager_extra_configs = var.certification_manager_extra_configs external_secrets_extra_configs = { irsa_assume_role_policy = jsonencode({ From f485aefbde309e09ab4571e7bba2d40813adb53d Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 14:34:31 +0530 Subject: [PATCH 04/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20Added=20certificat?= =?UTF-8?q?ion=20manager=20code=20in=20basic=20example?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _examples/basic/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/_examples/basic/main.tf b/_examples/basic/main.tf index d87dd17..9ee285c 100644 --- a/_examples/basic/main.tf +++ b/_examples/basic/main.tf @@ -173,6 +173,7 @@ module "addons" { fluent_bit = true velero = true keda = true + certification_manager = true # -- Addons with mandatory variable istio_ingress = true From d583a6993b3d197edeb46c67f2101c38ca115f3e Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 14:45:29 +0530 Subject: [PATCH 05/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20terraform=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- variables.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index bc20d42..ad21daf 100644 --- a/variables.tf +++ b/variables.tf @@ -458,4 +458,5 @@ variable "certification_manager_helm_config" { variable "certification_manager_extra_configs" { description = "Override attributes of helm_release terraform resource" type = any - default = {} \ No newline at end of file + default = {} +} \ No newline at end of file From 9e70ed76c1a8bf77ed7a8c3591bb1112e2b7adbf Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 14:53:32 +0530 Subject: [PATCH 06/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20Added=20metadata?= =?UTF-8?q?=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/cert-manager/main.tf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/cert-manager/main.tf b/addons/cert-manager/main.tf index e47a70c..7952c5b 100644 --- a/addons/cert-manager/main.tf +++ b/addons/cert-manager/main.tf @@ -11,4 +11,7 @@ module "helm_addon" { resource "kubernetes_namespace_v1" "this" { count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "cert-manager" ? 1 : 0 + metadata { + name = local.helm_config["namespace"] + } } From e8ab4a9fe94360c7014cd6fe2c508365b477fa4e Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 15:00:45 +0530 Subject: [PATCH 07/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20Added=20variables?= =?UTF-8?q?=20for=20certification=5Fmanager=5Fextra=5Fconfigs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _examples/complete/variables.tf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/_examples/complete/variables.tf b/_examples/complete/variables.tf index eb2ef19..a1a2d6d 100644 --- a/_examples/complete/variables.tf +++ b/_examples/complete/variables.tf @@ -99,6 +99,13 @@ variable "keda_extra_configs" { default = {} } +# ------------------ CERTIFICATION-MANAGER ----------------------------------------------------- +variable "certification_manager_extra_configs" { + type = any + default = {} +} + + # ------------------ ISTIO INGRESS --------------------------------------------- # -- INTERNET FACING -------------- variable "istio_manifests" { From 9069ab0d1a39ed9644bbc1a417034c2474cc07bd Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 15:26:39 +0530 Subject: [PATCH 08/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20updated=20tag=20in?= =?UTF-8?q?=20in=20readme=20file=20of=20certification-manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/cert-manager/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/cert-manager/README.md b/addons/cert-manager/README.md index 8e168f1..81e85de 100644 --- a/addons/cert-manager/README.md +++ b/addons/cert-manager/README.md @@ -8,9 +8,9 @@ Below terraform script shows how to use Certification Manager Terraform Addon, A ```hcl module "addons" { source = "clouddrove/eks-addons/aws" - version = "1.0.0" + version = "0.1.0" - depends_on = [module.eks.cluster_id] + depends_on = [module.eks] eks_cluster_name = module.eks.cluster_name certification_manager = true From 0c6885f00e7225355bf16d3dc29c88fc3504831c Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 15:32:22 +0530 Subject: [PATCH 09/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20removed=20unnecess?= =?UTF-8?q?ary=20attributes=20from=20cert-manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/cert-manager/locals.tf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/cert-manager/locals.tf b/addons/cert-manager/locals.tf index be649e4..e4eb3c6 100644 --- a/addons/cert-manager/locals.tf +++ b/addons/cert-manager/locals.tf @@ -34,11 +34,8 @@ locals { replace = try(var.certification_manager_extra_configs.replace, "false") } - certification_manager_extra_configs = var.certification_manager_extra_configs - helm_config = merge( local.default_helm_config, - var.helm_config, - local.certification_manager_extra_configs + var.helm_config ) } From 1f91192d24c4ded37bfe05b430ee0ef50c90335e Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 15:44:46 +0530 Subject: [PATCH 10/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20removed=20unnecess?= =?UTF-8?q?ary=20attributes=20from=20cert-manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/cert-manager/main.tf | 2 -- 1 file changed, 2 deletions(-) diff --git a/addons/cert-manager/main.tf b/addons/cert-manager/main.tf index 7952c5b..f2f17cd 100644 --- a/addons/cert-manager/main.tf +++ b/addons/cert-manager/main.tf @@ -4,8 +4,6 @@ module "helm_addon" { manage_via_gitops = var.manage_via_gitops helm_config = local.helm_config addon_context = var.addon_context - - depends_on = [kubernetes_namespace_v1.this] } resource "kubernetes_namespace_v1" "this" { From 5abee0d16217c8de35e4bb0978b2aee4001ad77b Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 15:49:57 +0530 Subject: [PATCH 11/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20removed=20unnecess?= =?UTF-8?q?ary=20attributes=20from=20cert-manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/cert-manager/main.tf | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/addons/cert-manager/main.tf b/addons/cert-manager/main.tf index f2f17cd..1c7f1a8 100644 --- a/addons/cert-manager/main.tf +++ b/addons/cert-manager/main.tf @@ -4,12 +4,4 @@ module "helm_addon" { manage_via_gitops = var.manage_via_gitops helm_config = local.helm_config addon_context = var.addon_context -} - -resource "kubernetes_namespace_v1" "this" { - count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "cert-manager" ? 1 : 0 - - metadata { - name = local.helm_config["namespace"] - } -} +} \ No newline at end of file From 3af9d2c906cacc96140db228deb68e2a5ed3ae57 Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 15:53:21 +0530 Subject: [PATCH 12/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20fixed=20typo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/outputs.tf b/outputs.tf index 79a0d9f..1a7a2ba 100644 --- a/outputs.tf +++ b/outputs.tf @@ -299,7 +299,7 @@ output "keda_repository" { #----------- CERTICATION-MANAGER ------------------------ output "certification_manager_namespace" { value = module.certification_manager[*].namespace - description = "The namespace where ertification-manager is deployed." + description = "The namespace where certification-manager is deployed." } output "certification_manager_chart_version" { value = module.certification_manager[*].chart_version From 46f63c812709a71d9bf26e8ff3f97580f284aeb7 Mon Sep 17 00:00:00 2001 From: VishwajitNagulkar Date: Wed, 4 Oct 2023 15:56:16 +0530 Subject: [PATCH 13/18] =?UTF-8?q?Feat:=20=F0=9F=9A=80=20removed=20unnecess?= =?UTF-8?q?ary=20attributes=20from=20cert-manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- override_values.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/override_values.tf b/override_values.tf index 90b1fbb..87b70db 100644 --- a/override_values.tf +++ b/override_values.tf @@ -639,7 +639,6 @@ resources: resource "local_file" "certification_manager_helm_config" { count = var.certification_manager && (var.certification_manager_helm_config == null) ? 1 : 0 content = < Date: Wed, 4 Oct 2023 22:29:21 +0530 Subject: [PATCH 14/18] Feat: custom irsa iam-policy --- .../external-secret/external-secret.yaml | 8 +-- .../custom-iam-policies/external-secrets.json | 14 +++++ _examples/complete/main.tf | 23 +------- _examples/complete/variables.tf | 8 +++ addons/external-secrets/data.tf | 7 +-- addons/external-secrets/locals.tf | 5 +- addons/external-secrets/main.tf | 56 ++++++++++++------- addons/external-secrets/variables.tf | 6 ++ main.tf | 1 + outputs.tf | 4 ++ variables.tf | 6 ++ 11 files changed, 84 insertions(+), 54 deletions(-) create mode 100644 _examples/complete/custom-iam-policies/external-secrets.json diff --git a/_examples/complete/config/external-secret/external-secret.yaml b/_examples/complete/config/external-secret/external-secret.yaml index a614a1f..edc6218 100644 --- a/_examples/complete/config/external-secret/external-secret.yaml +++ b/_examples/complete/config/external-secret/external-secret.yaml @@ -9,10 +9,10 @@ spec: name: external-secrets-store # -- Provide previously created secret store name kind: SecretStore target: - name: externalsecret-data # -- Name of secret which will contain data specified below + name: externalsecret-data # -- Name of Kubernetes secret which will contain data specified below creationPolicy: Owner data: - - secretKey: do_not_delete_this_key # -- AWS Secret-Manager secret key + - secretKey: external_secret_key # -- Kubernetes Secret `externalsecret-data` KEY name remoteRef: - key: external_secrets # -- Same as 'externalsecrets_manifest["secret_manager_name"] - property: do_not_delete_this_key # -- AWS Secret-Manager secret key \ No newline at end of file + key: external_secrets_addon # -- AWS Secret Name, same as `var.external_secrets_extra_configs.secret_manager_name` + property: external_secret # -- AWS Secret-Manager secret key \ No newline at end of file diff --git a/_examples/complete/custom-iam-policies/external-secrets.json b/_examples/complete/custom-iam-policies/external-secrets.json new file mode 100644 index 0000000..6ecfff9 --- /dev/null +++ b/_examples/complete/custom-iam-policies/external-secrets.json @@ -0,0 +1,14 @@ +{ + "Statement": [ + { + "Action": [ + "secretsmanager:GetSecretValue", + "secretsmanager:DescribeSecret" + ], + "Effect": "Allow", + "Resource": "*", + "Sid": "ExternalSecretsDefault" + } + ], + "Version": "2012-10-17" +} \ No newline at end of file diff --git a/_examples/complete/main.tf b/_examples/complete/main.tf index 783b800..a2878d9 100644 --- a/_examples/complete/main.tf +++ b/_examples/complete/main.tf @@ -217,30 +217,11 @@ module "addons" { kube_state_metrics_extra_configs = var.kube_state_metrics_extra_configs keda_extra_configs = var.keda_extra_configs certification_manager_extra_configs = var.certification_manager_extra_configs - - external_secrets_extra_configs = { - irsa_assume_role_policy = jsonencode({ - "Version" : "2012-10-17", - "Statement" : [ - { - "Effect" : "Allow", - "Principal" : { - "Federated" : module.eks.oidc_provider_arn - }, - "Action" : "sts:AssumeRoleWithWebIdentity", - "Condition" : { - "StringLike" : { - "${replace(module.eks.cluster_oidc_issuer_url, "https://", "")}:aud" : "sts.amazonaws.com" - } - } - } - ] - }) - secret_manager_name = "external_secrets_addon" - } + external_secrets_extra_configs = var.external_secrets_extra_configs # -- Custom IAM Policy Json for Addon's ServiceAccount cluster_autoscaler_iampolicy_json_content = file("./custom-iam-policies/cluster-autoscaler.json") + external_secrets_iampolicy_json_content = file("./custom-iam-policies/external-secrets.json") } module "addons-internal" { diff --git a/_examples/complete/variables.tf b/_examples/complete/variables.tf index a1a2d6d..751830b 100644 --- a/_examples/complete/variables.tf +++ b/_examples/complete/variables.tf @@ -168,4 +168,12 @@ variable "kiali_manifests" { variable "kiali_server_extra_configs" { type = any default = {} +} + +# ------------------ EXTERNAL SECRETS ------------------------------------------ +variable "external_secrets_extra_configs" { + type = any + default = { + secret_manager_name = "external_secrets_addon" + } } \ No newline at end of file diff --git a/addons/external-secrets/data.tf b/addons/external-secrets/data.tf index ed47092..05809aa 100644 --- a/addons/external-secrets/data.tf +++ b/addons/external-secrets/data.tf @@ -1,6 +1,5 @@ +data "aws_region" "current" {} +data "aws_caller_identity" "current" {} data "aws_eks_cluster" "eks_cluster" { - # this makes downstream resources wait for data plane to be ready name = var.eks_cluster_name -} - -data "aws_region" "current" {} \ No newline at end of file +} \ No newline at end of file diff --git a/addons/external-secrets/locals.tf b/addons/external-secrets/locals.tf index f25113e..78f7700 100644 --- a/addons/external-secrets/locals.tf +++ b/addons/external-secrets/locals.tf @@ -13,7 +13,7 @@ locals { lint = try(var.external_secrets_extra_configs.lint, "false") repository_key_file = try(var.external_secrets_extra_configs.repository_key_file, "") repository_cert_file = try(var.external_secrets_extra_configs.repository_cert_file, "") - repository_username = try(var.external_secrets_extra_configs.repository_password, "") + repository_username = try(var.external_secrets_extra_configs.repository_username, "") repository_password = try(var.external_secrets_extra_configs.repository_password, "") verify = try(var.external_secrets_extra_configs.verify, "false") keyring = try(var.external_secrets_extra_configs.keyring, "") @@ -34,11 +34,8 @@ locals { replace = try(var.external_secrets_extra_configs.replace, "false") } - external_secrets_extra_configs = var.external_secrets_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.external_secrets_extra_configs ) } diff --git a/addons/external-secrets/main.tf b/addons/external-secrets/main.tf index bf27916..e15e036 100644 --- a/addons/external-secrets/main.tf +++ b/addons/external-secrets/main.tf @@ -44,31 +44,45 @@ module "helm_addon" { account_id = var.account_id } - irsa_assume_role_policy = var.external_secrets_extra_configs.irsa_assume_role_policy - + irsa_assume_role_policy = jsonencode({ + "Version" : "2012-10-17", + "Statement" : [ + { + "Effect" : "Allow", + "Principal" : { + "Federated" : "arn:aws:iam::${data.aws_caller_identity.current.account_id}:oidc-provider/${replace(data.aws_eks_cluster.eks_cluster.identity[0].oidc[0].issuer, "https://", "")}" + }, + "Action" : "sts:AssumeRoleWithWebIdentity", + "Condition" : { + "StringLike" : { + "${replace(data.aws_eks_cluster.eks_cluster.identity[0].oidc[0].issuer, "https://", "")}:aud" : "sts.amazonaws.com" + } + } + } + ] + }) } resource "aws_iam_policy" "policy" { name = "${local.name}-${var.eks_cluster_name}" path = "/" description = "IAM Policy used by ${local.name}-${var.eks_cluster_name} IAM Role" - policy = data.aws_iam_policy_document.iam-policy.json -} - -data "aws_iam_policy_document" "iam-policy" { - version = "2012-10-17" - - statement { - sid = "VisualEditor0" - effect = "Allow" - actions = [ - "secretsmanager:GetSecretValue", - "secretsmanager:DescribeSecret", - ] - resources = [ - "arn:aws:secretsmanager:${data.aws_region.current.name}:${var.account_id}:secret:${var.external_secrets_extra_configs.secret_manager_name}*", - ] - } + policy = var.iampolicy_json_content != null ? var.iampolicy_json_content : <<-EOT +{ + "Statement": [ + { + "Action": [ + "secretsmanager:GetSecretValue", + "secretsmanager:DescribeSecret" + ], + "Effect": "Allow", + "Resource": "arn:aws:secretsmanager:${data.aws_region.current.name}:${var.account_id}:secret:${try(var.external_secrets_extra_configs.secret_manager_name, "external_secrets_addon")}*", + "Sid": "ExternalSecretsDefault" + } + ], + "Version": "2012-10-17" +} + EOT } module "secrets_manager" { @@ -79,10 +93,10 @@ module "secrets_manager" { name = "secrets-manager" secrets = [ { - name = try(var.external_secrets_extra_configs.secret_manager_name, "external_secret") + name = try(var.external_secrets_extra_configs.secret_manager_name, "external_secrets_addon") description = try(var.external_secrets_extra_configs.secret_manager_description, "AWS EKS external-secrets helm addon.") secret_key_value = { - external_secret = "external_secret_addon" + external_secret = "external_secret_addon_data" } recovery_window_in_days = try(var.external_secrets_extra_configs.recovery_window_in_days, 7) } diff --git a/addons/external-secrets/variables.tf b/addons/external-secrets/variables.tf index 9ea9bb7..a591b4e 100644 --- a/addons/external-secrets/variables.tf +++ b/addons/external-secrets/variables.tf @@ -39,4 +39,10 @@ variable "external_secrets_extra_configs" { description = "Override attributes of helm_release terraform resource" type = any default = {} +} + +variable "iampolicy_json_content" { + description = "Custom IAM Policy for External-Secrets IRSA" + type = string + default = null } \ No newline at end of file diff --git a/main.tf b/main.tf index bdd729c..2f921d7 100644 --- a/main.tf +++ b/main.tf @@ -117,6 +117,7 @@ module "external_secrets" { eks_cluster_name = data.aws_eks_cluster.eks_cluster.name account_id = data.aws_caller_identity.current.account_id external_secrets_extra_configs = var.external_secrets_extra_configs + iampolicy_json_content = var.external_secrets_iampolicy_json_content } module "ingress_nginx" { diff --git a/outputs.tf b/outputs.tf index 1a7a2ba..d002e94 100644 --- a/outputs.tf +++ b/outputs.tf @@ -159,6 +159,10 @@ output "external_secrets_repository" { value = module.ingress_nginx[*].repository description = "helm repository url of external-secrets" } +output "external_secrets_iam_policy" { + value = module.external_secrets[*].iam_policy + description = "Name of IAM Policy used in external-secrets irsa" +} #----------- INGRESS NGINX --------------------- output "ingress_nginx_namespace" { diff --git a/variables.tf b/variables.tf index ad21daf..b7842c9 100644 --- a/variables.tf +++ b/variables.tf @@ -260,6 +260,12 @@ variable "external_secrets_extra_configs" { default = {} } +variable "external_secrets_iampolicy_json_content" { + description = "Custom IAM Policy for External-Secrets IRSA" + type = string + default = null +} + #------------------ INGRESS NGINX ------------------------- variable "ingress_nginx" { description = "Enable ingress nginx add-on" From 47ae8ce72c301bb515986ecb4b86ff5c113b344d Mon Sep 17 00:00:00 2001 From: Himanshu Ahirwar Date: Wed, 4 Oct 2023 22:51:22 +0530 Subject: [PATCH 15/18] fix- removed unused namespace resource and extra_configs attribute --- addons/aws-ebs-csi-driver/locals.tf | 3 --- addons/aws-ebs-csi-driver/main.tf | 11 +---------- addons/aws-efs-csi-driver/main.tf | 11 +---------- addons/aws-load-balancer-controller/locals.tf | 3 --- addons/aws-load-balancer-controller/main.tf | 11 +---------- addons/aws-node-termination-handler/locals.tf | 3 --- addons/aws-node-termination-handler/main.tf | 10 ---------- addons/calico-tigera/locals.tf | 3 --- addons/calico-tigera/main.tf | 11 ----------- addons/cluster-autoscaler/locals.tf | 3 --- addons/cluster-autoscaler/main.tf | 9 --------- addons/fluent-bit/locals.tf | 3 --- addons/ingress-nginx/locals.tf | 3 --- addons/ingress-nginx/main.tf | 10 ---------- addons/istio-ingress/locals.tf | 3 --- addons/karpenter/locals.tf | 3 --- addons/karpenter/main.tf | 11 +---------- addons/keda/main.tf | 1 - addons/kiali-server/locals.tf | 3 --- addons/kubeclarity/locals.tf | 3 --- addons/metrics-server/locals.tf | 3 --- addons/metrics-server/main.tf | 10 ---------- addons/nri-bundle/locals.tf | 3 --- 23 files changed, 4 insertions(+), 130 deletions(-) diff --git a/addons/aws-ebs-csi-driver/locals.tf b/addons/aws-ebs-csi-driver/locals.tf index 0b7d0a8..1015f78 100644 --- a/addons/aws-ebs-csi-driver/locals.tf +++ b/addons/aws-ebs-csi-driver/locals.tf @@ -33,11 +33,8 @@ locals { replace = try(var.aws_ebs_csi_driver_extra_configs.replace, "false") } - aws_ebs_csi_driver_extra_configs = var.aws_ebs_csi_driver_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.aws_ebs_csi_driver_extra_configs ) } diff --git a/addons/aws-ebs-csi-driver/main.tf b/addons/aws-ebs-csi-driver/main.tf index 2c4b451..9aaba35 100644 --- a/addons/aws-ebs-csi-driver/main.tf +++ b/addons/aws-ebs-csi-driver/main.tf @@ -5,7 +5,6 @@ module "helm_addon" { helm_config = local.helm_config addon_context = var.addon_context - depends_on = [kubernetes_namespace_v1.this] set_values = [ { name = "controller.serviceAccount.create" @@ -59,12 +58,4 @@ resource "aws_iam_policy" "policy" { ] } EOT -} - -resource "kubernetes_namespace_v1" "this" { - count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0 - - metadata { - name = local.helm_config["namespace"] - } -} +} \ No newline at end of file diff --git a/addons/aws-efs-csi-driver/main.tf b/addons/aws-efs-csi-driver/main.tf index 905822e..36a236f 100644 --- a/addons/aws-efs-csi-driver/main.tf +++ b/addons/aws-efs-csi-driver/main.tf @@ -5,7 +5,6 @@ module "helm_addon" { helm_config = local.helm_config addon_context = var.addon_context - depends_on = [kubernetes_namespace_v1.this] set_values = [ { name = "image.repository" @@ -93,12 +92,4 @@ resource "aws_iam_policy" "policy" { ] } EOT -} - -resource "kubernetes_namespace_v1" "this" { - count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0 - - metadata { - name = local.helm_config["namespace"] - } -} +} \ No newline at end of file diff --git a/addons/aws-load-balancer-controller/locals.tf b/addons/aws-load-balancer-controller/locals.tf index 5f057a9..b9a9a6a 100644 --- a/addons/aws-load-balancer-controller/locals.tf +++ b/addons/aws-load-balancer-controller/locals.tf @@ -33,11 +33,8 @@ locals { replace = try(var.aws_load_balancer_controller_extra_configs.replace, "false") } - aws_load_balancer_controller_extra_configs = var.aws_load_balancer_controller_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.aws_load_balancer_controller_extra_configs ) } diff --git a/addons/aws-load-balancer-controller/main.tf b/addons/aws-load-balancer-controller/main.tf index 83b168e..e82364c 100644 --- a/addons/aws-load-balancer-controller/main.tf +++ b/addons/aws-load-balancer-controller/main.tf @@ -5,7 +5,6 @@ module "helm_addon" { helm_config = local.helm_config addon_context = var.addon_context - depends_on = [kubernetes_namespace_v1.this] set_values = [ { name = "clusterName" @@ -289,12 +288,4 @@ resource "aws_iam_policy" "policy" { ] } EOT -} - -resource "kubernetes_namespace_v1" "this" { - count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0 - - metadata { - name = local.helm_config["namespace"] - } -} +} \ No newline at end of file diff --git a/addons/aws-node-termination-handler/locals.tf b/addons/aws-node-termination-handler/locals.tf index 7078b1b..6c622b0 100644 --- a/addons/aws-node-termination-handler/locals.tf +++ b/addons/aws-node-termination-handler/locals.tf @@ -33,11 +33,8 @@ locals { replace = try(var.aws_node_termination_handler_extra_configs.replace, "false") } - aws_node_termination_handler_extra_configs = var.aws_node_termination_handler_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.aws_node_termination_handler_extra_configs ) } diff --git a/addons/aws-node-termination-handler/main.tf b/addons/aws-node-termination-handler/main.tf index ff859df..7c7af3d 100644 --- a/addons/aws-node-termination-handler/main.tf +++ b/addons/aws-node-termination-handler/main.tf @@ -4,14 +4,4 @@ module "helm_addon" { manage_via_gitops = var.manage_via_gitops helm_config = local.helm_config addon_context = var.addon_context - - depends_on = [kubernetes_namespace_v1.this] -} - -resource "kubernetes_namespace_v1" "this" { - count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0 - - metadata { - name = local.helm_config["namespace"] - } } diff --git a/addons/calico-tigera/locals.tf b/addons/calico-tigera/locals.tf index af782ae..5681259 100644 --- a/addons/calico-tigera/locals.tf +++ b/addons/calico-tigera/locals.tf @@ -34,11 +34,8 @@ locals { replace = try(var.calico_tigera_extra_configs.replace, "false") } - calico_tigera_extra_configs = var.calico_tigera_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.calico_tigera_extra_configs ) } \ No newline at end of file diff --git a/addons/calico-tigera/main.tf b/addons/calico-tigera/main.tf index dab205d..ff73b9f 100644 --- a/addons/calico-tigera/main.tf +++ b/addons/calico-tigera/main.tf @@ -4,17 +4,6 @@ module "helm_addon" { manage_via_gitops = var.manage_via_gitops helm_config = local.helm_config addon_context = var.addon_context - - depends_on = [kubernetes_namespace.this] - -} - -resource "kubernetes_namespace" "this" { - count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0 - - metadata { - name = local.helm_config["namespace"] - } } resource "kubectl_manifest" "calico_node" { diff --git a/addons/cluster-autoscaler/locals.tf b/addons/cluster-autoscaler/locals.tf index 142004b..6f2b611 100644 --- a/addons/cluster-autoscaler/locals.tf +++ b/addons/cluster-autoscaler/locals.tf @@ -33,11 +33,8 @@ locals { replace = try(var.cluster_autoscaler_extra_configs.replace, "false") } - cluster_autoscaler_extra_configs = var.cluster_autoscaler_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.cluster_autoscaler_extra_configs ) } diff --git a/addons/cluster-autoscaler/main.tf b/addons/cluster-autoscaler/main.tf index 1e008bd..e006b8a 100644 --- a/addons/cluster-autoscaler/main.tf +++ b/addons/cluster-autoscaler/main.tf @@ -5,7 +5,6 @@ module "helm_addon" { helm_config = local.helm_config addon_context = var.addon_context - depends_on = [kubernetes_namespace_v1.this] set_values = [ { name = "awsRegion" @@ -59,12 +58,4 @@ resource "aws_iam_policy" "policy" { "Version": "2012-10-17" } EOT -} - -resource "kubernetes_namespace_v1" "this" { - count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0 - - metadata { - name = local.helm_config["namespace"] - } } \ No newline at end of file diff --git a/addons/fluent-bit/locals.tf b/addons/fluent-bit/locals.tf index f9329a1..9274be4 100644 --- a/addons/fluent-bit/locals.tf +++ b/addons/fluent-bit/locals.tf @@ -34,11 +34,8 @@ locals { replace = try(var.fluent_bit_extra_configs.replace, "false") } - fluent_bit_extra_configs = var.fluent_bit_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.fluent_bit_extra_configs ) } diff --git a/addons/ingress-nginx/locals.tf b/addons/ingress-nginx/locals.tf index 66cdc12..0d0ddbb 100644 --- a/addons/ingress-nginx/locals.tf +++ b/addons/ingress-nginx/locals.tf @@ -33,11 +33,8 @@ locals { replace = try(var.ingress_nginx_extra_configs.replace, "false") } - ingress_nginx_extra_configs = var.ingress_nginx_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.ingress_nginx_extra_configs ) } \ No newline at end of file diff --git a/addons/ingress-nginx/main.tf b/addons/ingress-nginx/main.tf index 09896d6..1c7f1a8 100644 --- a/addons/ingress-nginx/main.tf +++ b/addons/ingress-nginx/main.tf @@ -4,14 +4,4 @@ module "helm_addon" { manage_via_gitops = var.manage_via_gitops helm_config = local.helm_config addon_context = var.addon_context - - depends_on = [kubernetes_namespace_v1.this] -} - -resource "kubernetes_namespace_v1" "this" { - count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0 - - metadata { - name = local.helm_config["namespace"] - } } \ No newline at end of file diff --git a/addons/istio-ingress/locals.tf b/addons/istio-ingress/locals.tf index 8ca4f96..a032812 100644 --- a/addons/istio-ingress/locals.tf +++ b/addons/istio-ingress/locals.tf @@ -56,11 +56,8 @@ locals { replace = try(var.istio_ingress_extra_configs.replace, "false") } - istio_ingress_extra_configs = var.istio_ingress_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.istio_ingress_extra_configs ) } diff --git a/addons/karpenter/locals.tf b/addons/karpenter/locals.tf index fab7de1..72ba16f 100644 --- a/addons/karpenter/locals.tf +++ b/addons/karpenter/locals.tf @@ -33,11 +33,8 @@ locals { replace = try(var.karpenter_extra_configs.replace, "false") } - karpenter_extra_configs = var.karpenter_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.karpenter_extra_configs ) } diff --git a/addons/karpenter/main.tf b/addons/karpenter/main.tf index 7cd29c1..cbad60a 100644 --- a/addons/karpenter/main.tf +++ b/addons/karpenter/main.tf @@ -5,7 +5,6 @@ module "helm_addon" { helm_config = local.helm_config addon_context = var.addon_context - depends_on = [kubernetes_namespace_v1.this] set_values = [ { name = "serviceAccount.create" @@ -83,12 +82,4 @@ resource "aws_iam_policy" "policy" { "Version": "2012-10-17" } EOT -} - -resource "kubernetes_namespace_v1" "this" { - count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0 - - metadata { - name = local.helm_config["namespace"] - } -} +} \ No newline at end of file diff --git a/addons/keda/main.tf b/addons/keda/main.tf index d9d1876..1c7f1a8 100644 --- a/addons/keda/main.tf +++ b/addons/keda/main.tf @@ -4,5 +4,4 @@ module "helm_addon" { manage_via_gitops = var.manage_via_gitops helm_config = local.helm_config addon_context = var.addon_context - } \ No newline at end of file diff --git a/addons/kiali-server/locals.tf b/addons/kiali-server/locals.tf index 3d541fe..78c6580 100644 --- a/addons/kiali-server/locals.tf +++ b/addons/kiali-server/locals.tf @@ -33,11 +33,8 @@ locals { replace = try(var.kiali_server_extra_configs.replace, "false") } - kiali_server_extra_configs = var.kiali_server_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.kiali_server_extra_configs ) } diff --git a/addons/kubeclarity/locals.tf b/addons/kubeclarity/locals.tf index ff9740a..9aeb099 100644 --- a/addons/kubeclarity/locals.tf +++ b/addons/kubeclarity/locals.tf @@ -34,11 +34,8 @@ locals { replace = try(var.kubeclarity_extra_configs.replace, "false") } - kubeclarity_extra_configs = var.kubeclarity_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.kubeclarity_extra_configs ) } diff --git a/addons/metrics-server/locals.tf b/addons/metrics-server/locals.tf index 05a6ff5..329749a 100644 --- a/addons/metrics-server/locals.tf +++ b/addons/metrics-server/locals.tf @@ -34,11 +34,8 @@ locals { replace = try(var.metrics_server_extra_configs.replace, "false") } - metrics_server_extra_configs = var.metrics_server_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.metrics_server_extra_configs ) } diff --git a/addons/metrics-server/main.tf b/addons/metrics-server/main.tf index ff859df..7c7af3d 100644 --- a/addons/metrics-server/main.tf +++ b/addons/metrics-server/main.tf @@ -4,14 +4,4 @@ module "helm_addon" { manage_via_gitops = var.manage_via_gitops helm_config = local.helm_config addon_context = var.addon_context - - depends_on = [kubernetes_namespace_v1.this] -} - -resource "kubernetes_namespace_v1" "this" { - count = try(local.helm_config["create_namespace"], true) && local.helm_config["namespace"] != "kube-system" ? 1 : 0 - - metadata { - name = local.helm_config["namespace"] - } } diff --git a/addons/nri-bundle/locals.tf b/addons/nri-bundle/locals.tf index 2e72eac..ebd2ca4 100644 --- a/addons/nri-bundle/locals.tf +++ b/addons/nri-bundle/locals.tf @@ -35,11 +35,8 @@ locals { replace = try(var.new_relic_extra_configs.replace, "false") } - new_relic_extra_configs = var.new_relic_extra_configs - helm_config = merge( local.default_helm_config, var.helm_config, - local.new_relic_extra_configs ) } From bccb3a79427ef3825d710c0ab77a2faf83d08223 Mon Sep 17 00:00:00 2001 From: Himanshu Ahirwar Date: Wed, 4 Oct 2023 23:02:40 +0530 Subject: [PATCH 16/18] fix- typo in default_helm_config for repository_username attribute --- addons/aws-ebs-csi-driver/locals.tf | 2 +- addons/aws-efs-csi-driver/locals.tf | 2 +- addons/aws-load-balancer-controller/locals.tf | 2 +- addons/aws-node-termination-handler/locals.tf | 2 +- addons/calico-tigera/locals.tf | 2 +- addons/cert-manager/locals.tf | 2 +- addons/cluster-autoscaler/locals.tf | 2 +- addons/fluent-bit/locals.tf | 2 +- addons/ingress-nginx/locals.tf | 2 +- addons/istio-ingress/locals.tf | 2 +- addons/karpenter/locals.tf | 2 +- addons/kiali-server/locals.tf | 2 +- addons/kube-state-metrics/locals.tf | 2 +- addons/kubeclarity/locals.tf | 2 +- addons/metrics-server/locals.tf | 2 +- addons/nri-bundle/locals.tf | 2 +- addons/velero/locals.tf | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/addons/aws-ebs-csi-driver/locals.tf b/addons/aws-ebs-csi-driver/locals.tf index 1015f78..f11d937 100644 --- a/addons/aws-ebs-csi-driver/locals.tf +++ b/addons/aws-ebs-csi-driver/locals.tf @@ -12,7 +12,7 @@ locals { lint = try(var.aws_ebs_csi_driver_extra_configs.lint, "false") repository_key_file = try(var.aws_ebs_csi_driver_extra_configs.repository_key_file, "") repository_cert_file = try(var.aws_ebs_csi_driver_extra_configs.repository_cert_file, "") - repository_username = try(var.aws_ebs_csi_driver_extra_configs.repository_password, "") + repository_username = try(var.aws_ebs_csi_driver_extra_configs.repository_username, "") repository_password = try(var.aws_ebs_csi_driver_extra_configs.repository_password, "") verify = try(var.aws_ebs_csi_driver_extra_configs.verify, "false") keyring = try(var.aws_ebs_csi_driver_extra_configs.keyring, "") diff --git a/addons/aws-efs-csi-driver/locals.tf b/addons/aws-efs-csi-driver/locals.tf index 2d87f9c..300af00 100644 --- a/addons/aws-efs-csi-driver/locals.tf +++ b/addons/aws-efs-csi-driver/locals.tf @@ -12,7 +12,7 @@ locals { lint = try(var.aws_efs_csi_driver_extra_configs.lint, "false") repository_key_file = try(var.aws_efs_csi_driver_extra_configs.repository_key_file, "") repository_cert_file = try(var.aws_efs_csi_driver_extra_configs.repository_cert_file, "") - repository_username = try(var.aws_efs_csi_driver_extra_configs.repository_password, "") + repository_username = try(var.aws_efs_csi_driver_extra_configs.repository_username, "") repository_password = try(var.aws_efs_csi_driver_extra_configs.repository_password, "") verify = try(var.aws_efs_csi_driver_extra_configs.verify, "false") keyring = try(var.aws_efs_csi_driver_extra_configs.keyring, "") diff --git a/addons/aws-load-balancer-controller/locals.tf b/addons/aws-load-balancer-controller/locals.tf index b9a9a6a..4e95e0f 100644 --- a/addons/aws-load-balancer-controller/locals.tf +++ b/addons/aws-load-balancer-controller/locals.tf @@ -12,7 +12,7 @@ locals { lint = try(var.aws_load_balancer_controller_extra_configs.lint, "false") repository_key_file = try(var.aws_load_balancer_controller_extra_configs.repository_key_file, "") repository_cert_file = try(var.aws_load_balancer_controller_extra_configs.repository_cert_file, "") - repository_username = try(var.aws_load_balancer_controller_extra_configs.repository_password, "") + repository_username = try(var.aws_load_balancer_controller_extra_configs.repository_username, "") repository_password = try(var.aws_load_balancer_controller_extra_configs.repository_password, "") verify = try(var.aws_load_balancer_controller_extra_configs.verify, "false") keyring = try(var.aws_load_balancer_controller_extra_configs.keyring, "") diff --git a/addons/aws-node-termination-handler/locals.tf b/addons/aws-node-termination-handler/locals.tf index 6c622b0..8aef89d 100644 --- a/addons/aws-node-termination-handler/locals.tf +++ b/addons/aws-node-termination-handler/locals.tf @@ -12,7 +12,7 @@ locals { lint = try(var.aws_node_termination_handler_extra_configs.lint, "false") repository_key_file = try(var.aws_node_termination_handler_extra_configs.repository_key_file, "") repository_cert_file = try(var.aws_node_termination_handler_extra_configs.repository_cert_file, "") - repository_username = try(var.aws_node_termination_handler_extra_configs.repository_password, "") + repository_username = try(var.aws_node_termination_handler_extra_configs.repository_username, "") repository_password = try(var.aws_node_termination_handler_extra_configs.repository_password, "") verify = try(var.aws_node_termination_handler_extra_configs.verify, "false") keyring = try(var.aws_node_termination_handler_extra_configs.keyring, "") diff --git a/addons/calico-tigera/locals.tf b/addons/calico-tigera/locals.tf index 5681259..3ecfbf2 100644 --- a/addons/calico-tigera/locals.tf +++ b/addons/calico-tigera/locals.tf @@ -13,7 +13,7 @@ locals { lint = try(var.calico_tigera_extra_configs.lint, "false") repository_key_file = try(var.calico_tigera_extra_configs.repository_key_file, "") repository_cert_file = try(var.calico_tigera_extra_configs.repository_cert_file, "") - repository_username = try(var.calico_tigera_extra_configs.repository_password, "") + repository_username = try(var.calico_tigera_extra_configs.repository_username, "") repository_password = try(var.calico_tigera_extra_configs.repository_password, "") verify = try(var.calico_tigera_extra_configs.verify, "false") keyring = try(var.calico_tigera_extra_configs.keyring, "") diff --git a/addons/cert-manager/locals.tf b/addons/cert-manager/locals.tf index e4eb3c6..bd2261e 100644 --- a/addons/cert-manager/locals.tf +++ b/addons/cert-manager/locals.tf @@ -13,7 +13,7 @@ locals { lint = try(var.certification_manager_extra_configs.lint, "false") repository_key_file = try(var.certification_manager_extra_configs.repository_key_file, "") repository_cert_file = try(var.certification_manager_extra_configs.repository_cert_file, "") - repository_username = try(var.certification_manager_extra_configs.repository_password, "") + repository_username = try(var.certification_manager_extra_configs.repository_username, "") repository_password = try(var.certification_manager_extra_configs.repository_password, "") verify = try(var.certification_manager_extra_configs.verify, "false") keyring = try(var.certification_manager_extra_configs.keyring, "") diff --git a/addons/cluster-autoscaler/locals.tf b/addons/cluster-autoscaler/locals.tf index 6f2b611..5232fcc 100644 --- a/addons/cluster-autoscaler/locals.tf +++ b/addons/cluster-autoscaler/locals.tf @@ -12,7 +12,7 @@ locals { lint = try(var.cluster_autoscaler_extra_configs.lint, "false") repository_key_file = try(var.cluster_autoscaler_extra_configs.repository_key_file, "") repository_cert_file = try(var.cluster_autoscaler_extra_configs.repository_cert_file, "") - repository_username = try(var.cluster_autoscaler_extra_configs.repository_password, "") + repository_username = try(var.cluster_autoscaler_extra_configs.repository_username, "") repository_password = try(var.cluster_autoscaler_extra_configs.repository_password, "") verify = try(var.cluster_autoscaler_extra_configs.verify, "false") keyring = try(var.cluster_autoscaler_extra_configs.keyring, "") diff --git a/addons/fluent-bit/locals.tf b/addons/fluent-bit/locals.tf index 9274be4..82d7d1c 100644 --- a/addons/fluent-bit/locals.tf +++ b/addons/fluent-bit/locals.tf @@ -13,7 +13,7 @@ locals { lint = try(var.fluent_bit_extra_configs.lint, "false") repository_key_file = try(var.fluent_bit_extra_configs.repository_key_file, "") repository_cert_file = try(var.fluent_bit_extra_configs.repository_cert_file, "") - repository_username = try(var.fluent_bit_extra_configs.repository_password, "") + repository_username = try(var.fluent_bit_extra_configs.repository_username, "") repository_password = try(var.fluent_bit_extra_configs.repository_password, "") verify = try(var.fluent_bit_extra_configs.verify, "false") keyring = try(var.fluent_bit_extra_configs.keyring, "") diff --git a/addons/ingress-nginx/locals.tf b/addons/ingress-nginx/locals.tf index 0d0ddbb..d5f7350 100644 --- a/addons/ingress-nginx/locals.tf +++ b/addons/ingress-nginx/locals.tf @@ -12,7 +12,7 @@ locals { lint = try(var.ingress_nginx_extra_configs.lint, "false") repository_key_file = try(var.ingress_nginx_extra_configs.repository_key_file, "") repository_cert_file = try(var.ingress_nginx_extra_configs.repository_cert_file, "") - repository_username = try(var.ingress_nginx_extra_configs.repository_password, "") + repository_username = try(var.ingress_nginx_extra_configs.repository_username, "") repository_password = try(var.ingress_nginx_extra_configs.repository_password, "") verify = try(var.ingress_nginx_extra_configs.verify, "false") keyring = try(var.ingress_nginx_extra_configs.keyring, "") diff --git a/addons/istio-ingress/locals.tf b/addons/istio-ingress/locals.tf index a032812..d35883c 100644 --- a/addons/istio-ingress/locals.tf +++ b/addons/istio-ingress/locals.tf @@ -35,7 +35,7 @@ locals { lint = try(var.istio_ingress_extra_configs.lint, "false") repository_key_file = try(var.istio_ingress_extra_configs.repository_key_file, "") repository_cert_file = try(var.istio_ingress_extra_configs.repository_cert_file, "") - repository_username = try(var.istio_ingress_extra_configs.repository_password, "") + repository_username = try(var.istio_ingress_extra_configs.repository_username, "") repository_password = try(var.istio_ingress_extra_configs.repository_password, "") verify = try(var.istio_ingress_extra_configs.verify, "false") keyring = try(var.istio_ingress_extra_configs.keyring, "") diff --git a/addons/karpenter/locals.tf b/addons/karpenter/locals.tf index 72ba16f..81e2d79 100644 --- a/addons/karpenter/locals.tf +++ b/addons/karpenter/locals.tf @@ -12,7 +12,7 @@ locals { lint = try(var.karpenter_extra_configs.lint, "false") repository_key_file = try(var.karpenter_extra_configs.repository_key_file, "") repository_cert_file = try(var.karpenter_extra_configs.repository_cert_file, "") - repository_username = try(var.karpenter_extra_configs.repository_password, "") + repository_username = try(var.karpenter_extra_configs.repository_username, "") repository_password = try(var.karpenter_extra_configs.repository_password, "") verify = try(var.karpenter_extra_configs.verify, "false") keyring = try(var.karpenter_extra_configs.keyring, "") diff --git a/addons/kiali-server/locals.tf b/addons/kiali-server/locals.tf index 78c6580..6c4d6c5 100644 --- a/addons/kiali-server/locals.tf +++ b/addons/kiali-server/locals.tf @@ -12,7 +12,7 @@ locals { lint = try(var.kiali_server_extra_configs.lint, "false") repository_key_file = try(var.kiali_server_extra_configs.repository_key_file, "") repository_cert_file = try(var.kiali_server_extra_configs.repository_cert_file, "") - repository_username = try(var.kiali_server_extra_configs.repository_password, "") + repository_username = try(var.kiali_server_extra_configs.repository_username, "") repository_password = try(var.kiali_server_extra_configs.repository_password, "") verify = try(var.kiali_server_extra_configs.verify, "false") keyring = try(var.kiali_server_extra_configs.keyring, "") diff --git a/addons/kube-state-metrics/locals.tf b/addons/kube-state-metrics/locals.tf index a7ff591..7657bc9 100644 --- a/addons/kube-state-metrics/locals.tf +++ b/addons/kube-state-metrics/locals.tf @@ -13,7 +13,7 @@ locals { lint = try(var.kube_state_metrics_extra_configs.lint, "false") repository_key_file = try(var.kube_state_metrics_extra_configs.repository_key_file, "") repository_cert_file = try(var.kube_state_metrics_extra_configs.repository_cert_file, "") - repository_username = try(var.kube_state_metrics_extra_configs.repository_password, "") + repository_username = try(var.kube_state_metrics_extra_configs.repository_username, "") repository_password = try(var.kube_state_metrics_extra_configs.repository_password, "") verify = try(var.kube_state_metrics_extra_configs.verify, "false") keyring = try(var.kube_state_metrics_extra_configs.keyring, "") diff --git a/addons/kubeclarity/locals.tf b/addons/kubeclarity/locals.tf index 9aeb099..9c002ce 100644 --- a/addons/kubeclarity/locals.tf +++ b/addons/kubeclarity/locals.tf @@ -13,7 +13,7 @@ locals { lint = try(var.kubeclarity_extra_configs.lint, "false") repository_key_file = try(var.kubeclarity_extra_configs.repository_key_file, "") repository_cert_file = try(var.kubeclarity_extra_configs.repository_cert_file, "") - repository_username = try(var.kubeclarity_extra_configs.repository_password, "") + repository_username = try(var.kubeclarity_extra_configs.repository_username, "") repository_password = try(var.kubeclarity_extra_configs.repository_password, "") verify = try(var.kubeclarity_extra_configs.verify, "false") keyring = try(var.kubeclarity_extra_configs.keyring, "") diff --git a/addons/metrics-server/locals.tf b/addons/metrics-server/locals.tf index 329749a..2eaa736 100644 --- a/addons/metrics-server/locals.tf +++ b/addons/metrics-server/locals.tf @@ -13,7 +13,7 @@ locals { lint = try(var.metrics_server_extra_configs.lint, "false") repository_key_file = try(var.metrics_server_extra_configs.repository_key_file, "") repository_cert_file = try(var.metrics_server_extra_configs.repository_cert_file, "") - repository_username = try(var.metrics_server_extra_configs.repository_password, "") + repository_username = try(var.metrics_server_extra_configs.repository_username, "") repository_password = try(var.metrics_server_extra_configs.repository_password, "") verify = try(var.metrics_server_extra_configs.verify, "false") keyring = try(var.metrics_server_extra_configs.keyring, "") diff --git a/addons/nri-bundle/locals.tf b/addons/nri-bundle/locals.tf index ebd2ca4..817fba4 100644 --- a/addons/nri-bundle/locals.tf +++ b/addons/nri-bundle/locals.tf @@ -14,7 +14,7 @@ locals { lint = try(var.new_relic_extra_configs.lint, "false") repository_key_file = try(var.new_relic_extra_configs.repository_key_file, "") repository_cert_file = try(var.new_relic_extra_configs.repository_cert_file, "") - repository_username = try(var.new_relic_extra_configs.repository_password, "") + repository_username = try(var.new_relic_extra_configs.repository_username, "") repository_password = try(var.new_relic_extra_configs.repository_password, "") verify = try(var.new_relic_extra_configs.verify, "false") keyring = try(var.new_relic_extra_configs.keyring, "") diff --git a/addons/velero/locals.tf b/addons/velero/locals.tf index 29b97dc..81fa31e 100644 --- a/addons/velero/locals.tf +++ b/addons/velero/locals.tf @@ -13,7 +13,7 @@ locals { lint = try(var.velero_extra_configs.lint, "false") repository_key_file = try(var.velero_extra_configs.repository_key_file, "") repository_cert_file = try(var.velero_extra_configs.repository_cert_file, "") - repository_username = try(var.velero_extra_configs.repository_password, "") + repository_username = try(var.velero_extra_configs.repository_username, "") repository_password = try(var.velero_extra_configs.repository_password, "") verify = try(var.velero_extra_configs.verify, "false") keyring = try(var.velero_extra_configs.keyring, "") From f07716665059819d7c7398878af4e21746eaa13b Mon Sep 17 00:00:00 2001 From: Himanshu Ahirwar Date: Wed, 4 Oct 2023 23:06:53 +0530 Subject: [PATCH 17/18] fix- updated basic example usage --- _examples/basic/main.tf | 13 ++++++++----- _examples/basic/variables.tf | 10 ---------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/_examples/basic/main.tf b/_examples/basic/main.tf index 9ee285c..8f39049 100644 --- a/_examples/basic/main.tf +++ b/_examples/basic/main.tf @@ -166,12 +166,13 @@ module "addons" { aws_node_termination_handler = true aws_efs_csi_driver = true aws_ebs_csi_driver = true - karpenter = false - calico_tigera = false + kube_state_metrics = true + karpenter = false # -- Set to `false` or comment line to Uninstall Karpenter if installed using terraform. + calico_tigera = true + new_relic = true kubeclarity = true ingress_nginx = true fluent_bit = true - velero = true keda = true certification_manager = true @@ -181,7 +182,9 @@ module "addons" { kiali_server = true kiali_manifests = var.kiali_manifests external_secrets = true + velero = true + velero_extra_configs = { + bucket_name = "velero-addons" + } - # -- Extra helm_release attributes - velero_extra_configs = var.velero_extra_configs } diff --git a/_examples/basic/variables.tf b/_examples/basic/variables.tf index d2c333f..267b127 100644 --- a/_examples/basic/variables.tf +++ b/_examples/basic/variables.tf @@ -22,14 +22,4 @@ variable "kiali_manifests" { kiali_virtualservice_file_path = "./config/kiali/kiali_vs.yaml" } description = "Path to VirtualService manifest for kiali-dashboard" -} - -#------------ EXTRA CONFIGS ----------- -variable "velero_extra_configs" { - type = any - default = { - timeout = 300 - atomic = true - bucket_name = "velero-addons" - } } \ No newline at end of file From 3dfa7da98cad577ad6be92b3677ce816357e8935 Mon Sep 17 00:00:00 2001 From: Himanshu Ahirwar Date: Thu, 5 Oct 2023 00:25:45 +0530 Subject: [PATCH 18/18] info- about istio-ingress installation in other namespaces --- _examples/complete/outputs.tf | 4 ++++ _examples/complete/variables.tf | 12 +++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/_examples/complete/outputs.tf b/_examples/complete/outputs.tf index 16df25d..aaa8146 100644 --- a/_examples/complete/outputs.tf +++ b/_examples/complete/outputs.tf @@ -15,4 +15,8 @@ output "update_kubeconfig" { output "velero_post_installation" { value = indent(2, "Once velero server is up and running you need the client before you can use it - \n 1. wget https://github.com/vmware-tanzu/velero/releases/download/v1.11.1/velero-v1.11.1-darwin-amd64.tar.gz \n 2. tar -xvf velero-v1.11.1-darwin-amd64.tar.gz -C velero-client") +} + +output "istio-ingress" { + value = indent(2, "Istio does not support the installation of istio-helmchart in a namespace other than istio-system. We have provided a namespace feature in case Istio-helmchart maintainers fix this issue.") } \ No newline at end of file diff --git a/_examples/complete/variables.tf b/_examples/complete/variables.tf index 751830b..7a73cb5 100644 --- a/_examples/complete/variables.tf +++ b/_examples/complete/variables.tf @@ -145,13 +145,11 @@ variable "istio_manifests_internal" { variable "istio_ingress_extra_configs_internal" { type = any default = { - name = "istio-ingress-internal" - namespace = "istio-system" - istiobase_release_name = "base-internal" - istiod_release_name = "istiod-internal" - create_namespace = true - install_istiobase = false - install_istiod = false + name = "istio-ingress-internal" + namespace = "istio-system" + create_namespace = false + install_istiobase = false + install_istiod = false } }