Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jrsdav committed Jul 30, 2021
1 parent e46de70 commit 4e238e0
Show file tree
Hide file tree
Showing 61 changed files with 10,124 additions and 1 deletion.
141 changes: 140 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,140 @@
# terraform-helm-charts
# terraform-helm-charts
This repository contains Terraform managed Helm charts used by StreamNative Platform. For more information on the Helm provider for Terraform, please refer to the [official documentation](https://registry.terraform.io/providers/hashicorp/helm/latest/docs).

## Example Usage

The `main.tf` file in the root of this repository contains an example of how to use these modules.

A simple example of how to use one of the modules is shown below:

```hcl
provider "helm" {
kubernetes {
config_path = pathexpand("~/.kube/my-eks-cluster-config")
}
}
module "pulsar_operator" {
source = "streamnative/charts/helm"
chart_name = "pulsar-operator"
chart_repository = "https://charts.streamnative.io"
chart_version = "0.7.2"
cleanup_on_fail = true
namespace = "pulsar-system"
release_name = "pulsar-operator"
settings = {
"namespace" = "pulsar-system"
"namespaceCreate" = "true"
}
timeout = 300
}
```

To apply the configuration above, initialize the Terraform from the example above:

```shell
terraform init
```

Run a plan to validate what's being created:

```shell
terraform plan
```

Apply the configuration:
```shell
terraform apply
```

## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >=1.0.0 |
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | 2.2.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | 2.2.0 |

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_function_mesh_operator"></a> [function\_mesh\_operator](#module\_function\_mesh\_operator) | ./modules/function-mesh-operator | n/a |
| <a name="module_istio_operator"></a> [istio\_operator](#module\_istio\_operator) | ./modules/istio-operator | n/a |
| <a name="module_olm"></a> [olm](#module\_olm) | ./modules/operator-lifecycle-manager | n/a |
| <a name="module_olm_subscriptions"></a> [olm\_subscriptions](#module\_olm\_subscriptions) | ./modules/olm-subscriptions | n/a |
| <a name="module_prometheus_operator"></a> [prometheus\_operator](#module\_prometheus\_operator) | ./modules/prometheus-operator | n/a |
| <a name="module_pulsar_operator"></a> [pulsar\_operator](#module\_pulsar\_operator) | ./modules/pulsar-operator | n/a |
| <a name="module_vault_operator"></a> [vault\_operator](#module\_vault\_operator) | ./modules/vault-operator | n/a |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_disable_olm"></a> [disable\_olm](#input\_disable\_olm) | Enables Operator Lifecycle Manager (OLM), and disables installing operators via Helm. OLM is disabled by default. Set to "false" to have OLM manage the operators. | `bool` | `true` | no |
| <a name="input_enable_function_mesh_operator"></a> [enable\_function\_mesh\_operator](#input\_enable\_function\_mesh\_operator) | Enables the StreamNative Function Mesh Operator. Set to "true" by default, but disabled if OLM is enabled. | `bool` | `true` | no |
| <a name="input_enable_istio_operator"></a> [enable\_istio\_operator](#input\_enable\_istio\_operator) | Enables the Istio Operator. Set to "true" by default, but disabled if OLM is enabled. | `bool` | `true` | no |
| <a name="input_enable_prometheus_operator"></a> [enable\_prometheus\_operator](#input\_enable\_prometheus\_operator) | Enables the Prometheus Operator. Set to "true" by default, but disabled if OLM is enabled. | `bool` | `true` | no |
| <a name="input_enable_pulsar_operator"></a> [enable\_pulsar\_operator](#input\_enable\_pulsar\_operator) | Enables the Pulsar Operator on the EKS cluster. Enabled by default, but disabled if var.disable\_olm is set to `true` | `bool` | `true` | no |
| <a name="input_enable_vault_operator"></a> [enable\_vault\_operator](#input\_enable\_vault\_operator) | Enables Hashicorp Vault on the EKS cluster. | `bool` | `true` | no |
| <a name="input_function_mesh_operator_chart_name"></a> [function\_mesh\_operator\_chart\_name](#input\_function\_mesh\_operator\_chart\_name) | The name of the Helm chart to install | `string` | `"function-mesh-operator"` | no |
| <a name="input_function_mesh_operator_chart_repository"></a> [function\_mesh\_operator\_chart\_repository](#input\_function\_mesh\_operator\_chart\_repository) | The repository containing the Helm chart to install | `string` | `"https://charts.streamnative.io"` | no |
| <a name="input_function_mesh_operator_chart_version"></a> [function\_mesh\_operator\_chart\_version](#input\_function\_mesh\_operator\_chart\_version) | The version of the Helm chart to install | `string` | `"0.1.7"` | no |
| <a name="input_function_mesh_operator_cleanup_on_fail"></a> [function\_mesh\_operator\_cleanup\_on\_fail](#input\_function\_mesh\_operator\_cleanup\_on\_fail) | Allow deletion of new resources created in this upgrade when upgrade fails | `bool` | `true` | no |
| <a name="input_function_mesh_operator_namespace"></a> [function\_mesh\_operator\_namespace](#input\_function\_mesh\_operator\_namespace) | The namespace used for the operator deployment | `string` | `"sn-system"` | no |
| <a name="input_function_mesh_operator_release_name"></a> [function\_mesh\_operator\_release\_name](#input\_function\_mesh\_operator\_release\_name) | The name of the helm release | `string` | `"function-mesh-operator"` | no |
| <a name="input_function_mesh_operator_settings"></a> [function\_mesh\_operator\_settings](#input\_function\_mesh\_operator\_settings) | Additional settings which will be passed to the Helm chart values | `map(any)` | `null` | no |
| <a name="input_function_mesh_operator_timeout"></a> [function\_mesh\_operator\_timeout](#input\_function\_mesh\_operator\_timeout) | Time in seconds to wait for any individual kubernetes operation | `number` | `600` | no |
| <a name="input_istio_operator_chart_name"></a> [istio\_operator\_chart\_name](#input\_istio\_operator\_chart\_name) | The name of the Helm chart to install | `string` | `"istio-operator"` | no |
| <a name="input_istio_operator_chart_repository"></a> [istio\_operator\_chart\_repository](#input\_istio\_operator\_chart\_repository) | The repository containing the Helm chart to install | `string` | `"https://kubernetes-charts.banzaicloud.com"` | no |
| <a name="input_istio_operator_chart_version"></a> [istio\_operator\_chart\_version](#input\_istio\_operator\_chart\_version) | The version of the Helm chart to install | `string` | `"0.0.88"` | no |
| <a name="input_istio_operator_cleanup_on_fail"></a> [istio\_operator\_cleanup\_on\_fail](#input\_istio\_operator\_cleanup\_on\_fail) | Allow deletion of new resources created in this upgrade when upgrade fails | `bool` | `true` | no |
| <a name="input_istio_operator_namespace"></a> [istio\_operator\_namespace](#input\_istio\_operator\_namespace) | The namespace used for the operator deployment | `string` | `"istio-system"` | no |
| <a name="input_istio_operator_release_name"></a> [istio\_operator\_release\_name](#input\_istio\_operator\_release\_name) | The name of the helm release | `string` | `"istio-operator"` | no |
| <a name="input_istio_operator_settings"></a> [istio\_operator\_settings](#input\_istio\_operator\_settings) | Additional settings which will be passed to the Helm chart values | `map(any)` | `null` | no |
| <a name="input_istio_operator_timeout"></a> [istio\_operator\_timeout](#input\_istio\_operator\_timeout) | Time in seconds to wait for any individual kubernetes operation | `number` | `600` | no |
| <a name="input_olm_catalog_namespace"></a> [olm\_catalog\_namespace](#input\_olm\_catalog\_namespace) | The namespace used for the OLM catalog services | `string` | `"olm"` | no |
| <a name="input_olm_namespace"></a> [olm\_namespace](#input\_olm\_namespace) | The namespace used by OLM and its resources | `string` | `"olm"` | no |
| <a name="input_olm_operators_namespace"></a> [olm\_operators\_namespace](#input\_olm\_operators\_namespace) | The namespace where OLM will install the operators | `string` | `"operators"` | no |
| <a name="input_olm_settings"></a> [olm\_settings](#input\_olm\_settings) | Additional settings which will be passed to the Helm chart values | `map(any)` | `null` | no |
| <a name="input_olm_sn_image"></a> [olm\_sn\_image](#input\_olm\_sn\_image) | The registry containing StreamNative's operator catalog image | `string` | n/a | yes |
| <a name="input_olm_subscription_settings"></a> [olm\_subscription\_settings](#input\_olm\_subscription\_settings) | Additional settings which will be passed to the Helm chart values | `map(any)` | `null` | no |
| <a name="input_prometheus_operator_chart_name"></a> [prometheus\_operator\_chart\_name](#input\_prometheus\_operator\_chart\_name) | The name of the Helm chart to install | `string` | `"kube-prometheus-stack"` | no |
| <a name="input_prometheus_operator_chart_repository"></a> [prometheus\_operator\_chart\_repository](#input\_prometheus\_operator\_chart\_repository) | The repository containing the Helm chart to install | `string` | `"https://prometheus-community.github.io/helm-charts"` | no |
| <a name="input_prometheus_operator_chart_version"></a> [prometheus\_operator\_chart\_version](#input\_prometheus\_operator\_chart\_version) | The version of the Helm chart to install | `string` | `"16.12.1"` | no |
| <a name="input_prometheus_operator_cleanup_on_fail"></a> [prometheus\_operator\_cleanup\_on\_fail](#input\_prometheus\_operator\_cleanup\_on\_fail) | Allow deletion of new resources created in this upgrade when upgrade fails | `bool` | `true` | no |
| <a name="input_prometheus_operator_namespace"></a> [prometheus\_operator\_namespace](#input\_prometheus\_operator\_namespace) | The namespace used for the operator deployment | `string` | `"sn-system"` | no |
| <a name="input_prometheus_operator_release_name"></a> [prometheus\_operator\_release\_name](#input\_prometheus\_operator\_release\_name) | The name of the helm release | `string` | `"kube-prometheus-stack"` | no |
| <a name="input_prometheus_operator_settings"></a> [prometheus\_operator\_settings](#input\_prometheus\_operator\_settings) | Additional settings which will be passed to the Helm chart values | `map(any)` | `null` | no |
| <a name="input_prometheus_operator_timeout"></a> [prometheus\_operator\_timeout](#input\_prometheus\_operator\_timeout) | Time in seconds to wait for any individual kubernetes operation | `number` | `600` | no |
| <a name="input_pulsar_operator_chart_name"></a> [pulsar\_operator\_chart\_name](#input\_pulsar\_operator\_chart\_name) | The name of the Helm chart to install | `string` | `"pulsar-operator"` | no |
| <a name="input_pulsar_operator_chart_repository"></a> [pulsar\_operator\_chart\_repository](#input\_pulsar\_operator\_chart\_repository) | The repository containing the Helm chart to install | `string` | `"https://charts.streamnative.io"` | no |
| <a name="input_pulsar_operator_chart_version"></a> [pulsar\_operator\_chart\_version](#input\_pulsar\_operator\_chart\_version) | The version of the Helm chart to install | `string` | `"0.7.2"` | no |
| <a name="input_pulsar_operator_cleanup_on_fail"></a> [pulsar\_operator\_cleanup\_on\_fail](#input\_pulsar\_operator\_cleanup\_on\_fail) | Allow deletion of new resources created in this upgrade when upgrade fails | `bool` | `true` | no |
| <a name="input_pulsar_operator_namespace"></a> [pulsar\_operator\_namespace](#input\_pulsar\_operator\_namespace) | The namespace used for the operator deployment | `string` | `"sn-system"` | no |
| <a name="input_pulsar_operator_release_name"></a> [pulsar\_operator\_release\_name](#input\_pulsar\_operator\_release\_name) | The name of the helm release | `string` | `"pulsar-operator"` | no |
| <a name="input_pulsar_operator_settings"></a> [pulsar\_operator\_settings](#input\_pulsar\_operator\_settings) | Additional settings which will be passed to the Helm chart values | `map(any)` | `null` | no |
| <a name="input_pulsar_operator_timeout"></a> [pulsar\_operator\_timeout](#input\_pulsar\_operator\_timeout) | Time in seconds to wait for any individual kubernetes operation | `number` | `600` | no |
| <a name="input_vault_operator_chart_name"></a> [vault\_operator\_chart\_name](#input\_vault\_operator\_chart\_name) | The name of the Helm chart to install | `string` | `"vault-operator"` | no |
| <a name="input_vault_operator_chart_repository"></a> [vault\_operator\_chart\_repository](#input\_vault\_operator\_chart\_repository) | The repository containing the Helm chart to install | `string` | `"https://kubernetes-charts.banzaicloud.com"` | no |
| <a name="input_vault_operator_chart_version"></a> [vault\_operator\_chart\_version](#input\_vault\_operator\_chart\_version) | The version of the Helm chart to install | `string` | `"1.13.0"` | no |
| <a name="input_vault_operator_cleanup_on_fail"></a> [vault\_operator\_cleanup\_on\_fail](#input\_vault\_operator\_cleanup\_on\_fail) | Allow deletion of new resources created in this upgrade when upgrade fails | `bool` | `true` | no |
| <a name="input_vault_operator_namespace"></a> [vault\_operator\_namespace](#input\_vault\_operator\_namespace) | The namespace used for the operator deployment | `string` | `"sn-system"` | no |
| <a name="input_vault_operator_release_name"></a> [vault\_operator\_release\_name](#input\_vault\_operator\_release\_name) | The name of the helm release | `string` | `"vault-operator"` | no |
| <a name="input_vault_operator_settings"></a> [vault\_operator\_settings](#input\_vault\_operator\_settings) | Additional settings which will be passed to the Helm chart values | `map(any)` | `null` | no |
| <a name="input_vault_operator_timeout"></a> [vault\_operator\_timeout](#input\_vault\_operator\_timeout) | Time in seconds to wait for any individual kubernetes operation | `number` | `600` | no |

## Outputs

No outputs.
127 changes: 127 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

####
# This top module is an example of how one might use the sub-modules for individual helm charts used by StreamNative
####

module "function_mesh_operator" {
count = var.enable_function_mesh_operator && var.disable_olm ? 1 : 0
source = "./modules/function-mesh-operator"

chart_name = var.function_mesh_operator_chart_name
chart_repository = var.function_mesh_operator_chart_repository
chart_version = var.function_mesh_operator_chart_version
cleanup_on_fail = var.function_mesh_operator_cleanup_on_fail
namespace = var.function_mesh_operator_namespace
release_name = var.function_mesh_operator_release_name
settings = coalesce(var.function_mesh_operator_settings, {}) # The empty map is a placeholder value, reserved for future defaults
timeout = var.function_mesh_operator_timeout
}

module "istio_operator" {
count = var.enable_istio_operator ? 1 : 0
source = "./modules/istio-operator"

chart_name = var.istio_operator_chart_name
chart_repository = var.istio_operator_chart_repository
chart_version = var.istio_operator_chart_version
cleanup_on_fail = var.istio_operator_cleanup_on_fail
namespace = var.istio_operator_namespace
release_name = var.istio_operator_release_name
settings = coalesce(var.istio_operator_settings, {}) # The empty map is a placeholder value, reserved for future defaults
timeout = var.istio_operator_timeout
}

module "olm" {
count = var.disable_olm ? 0 : 1
source = "./modules/operator-lifecycle-manager"

olm_namespace = var.olm_namespace
olm_operators_namespace = var.olm_operators_namespace
settings = coalesce(var.olm_settings, {}) # The empty map is a placeholder value, reserved for future defaults

depends_on = [
kubernetes_namespace.sn_system
]
}

module "olm_subscriptions" {
count = var.disable_olm ? 0 : 1
source = "./modules/olm-subscriptions"

catalog_namespace = var.olm_catalog_namespace
namespace = var.olm_namespace
settings = coalesce(var.olm_subscription_settings, {}) # The empty map is a placeholder value, reserved for future defaults
sn_image = var.olm_sn_image

depends_on = [
module.olm
]
}

module "prometheus_operator" {
count = var.enable_prometheus_operator && var.disable_olm ? 1 : 0
source = "./modules/prometheus-operator"

chart_name = var.prometheus_operator_chart_name
chart_repository = var.prometheus_operator_chart_repository
chart_version = var.prometheus_operator_chart_version
cleanup_on_fail = var.prometheus_operator_cleanup_on_fail
namespace = var.prometheus_operator_namespace
release_name = var.prometheus_operator_release_name

settings = coalesce(var.prometheus_operator_settings, { # Defaults are set to the right. Passing input via var.prometheus_operator_settings will override
"alertmanager.enabled" = "false"
"grafana.enabled" = "false"
"kubeStateMetrics.enabled" = "false"
"nodeExporter.enabled" = "false"
"prometheus.enabled" = "false"
})

timeout = var.prometheus_operator_timeout
}

module "pulsar_operator" {
count = var.enable_pulsar_operator && var.disable_olm ? 1 : 0
source = "./modules/pulsar-operator"

chart_name = var.pulsar_operator_chart_name
chart_repository = var.pulsar_operator_chart_repository
chart_version = var.pulsar_operator_chart_version
cleanup_on_fail = var.pulsar_operator_cleanup_on_fail
namespace = var.pulsar_operator_namespace
release_name = var.pulsar_operator_release_name
settings = coalesce(var.pulsar_operator_settings, {}) # The empty map is a placeholder value, reserved for future defaults
timeout = var.pulsar_operator_timeout
}

module "vault_operator" {
count = var.enable_vault_operator ? 1 : 0
source = "./modules/vault-operator"

chart_name = var.vault_operator_chart_name
chart_repository = var.vault_operator_chart_repository
chart_version = var.vault_operator_chart_version
cleanup_on_fail = var.vault_operator_cleanup_on_fail
namespace = var.vault_operator_namespace
release_name = var.vault_operator_release_name
settings = coalesce(var.vault_operator_settings, {}) # The empty map is a placeholder value, reserved for future defaults
timeout = var.vault_operator_timeout
}
Loading

0 comments on commit 4e238e0

Please sign in to comment.