Skip to content

Commit

Permalink
Remove monitoring v1 from terraform
Browse files Browse the repository at this point in the history
Co-authored-by: Diogo <[email protected]>
  • Loading branch information
rohitsakala and diogoasouza committed Jul 17, 2024
1 parent adfb99d commit 2416a84
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 710 deletions.
2 changes: 0 additions & 2 deletions docs/data-sources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ The following attributes are exported:
* `oke_config` - (Computed) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `aks_config_v2`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `k3s_config` and `rke_config` (list maxitems:1)
* `description` - (Computed) The description for Cluster (string)
* `cluster_auth_endpoint` - (Computed) Enabling the [local cluster authorized endpoint](https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/#local-cluster-auth-endpoint) allows direct communication with the cluster, bypassing the Rancher API proxy. (list maxitems:1)
* `cluster_monitoring_input` - (Computed) Cluster monitoring config (list maxitems:1)
* `cluster_template_answers` - (Computed) Cluster template answers (list maxitems:1)
* `cluster_template_id` - (Computed) Cluster template ID (string)
* `cluster_template_questions` - (Computed) Cluster template questions (list)
* `cluster_template_revision_id` - (Computed) Cluster template revision ID (string)
* `default_pod_security_policy_template_id` - (Optional/Computed) [Default pod security policy template id](https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/#pod-security-policy-support) (string)
* `enable_cluster_monitoring` - (Computed) Enable built-in cluster monitoring. Default `false` (bool)
* `enable_network_policy` - (Computed) Enable project network isolation. Default `false` (bool)
* `enable_cluster_istio` - (Computed) Enable built-in cluster istio. Default `false` (bool)
* `fleet_workspace_name` - (Computed) Fleet workspace name (string)
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ resource "kubernetes_namespace" "my_namespace" {

* `id` - (Computed) Cluster-wide unique ID of the Rancher 2 project (string)
* `container_resource_limit` - (Computed) Default containers resource limits on project (List maxitem:1)
* `enable_project_monitoring` - (Computed) Enable built-in project monitoring. Default `false` (bool)
* `pod_security_policy_template_id` - (Computed) Default Pod Security Policy ID for the project (string)
* `resource_quota` - (Computed) Resource quota for project. Rancher v2.1.x or higher (list maxitems:1)
* `uuid` - (Computed) UUID of the project as stored by Rancher 2 (string)
Expand Down
69 changes: 4 additions & 65 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Provides a Rancher v2 Cluster resource. This can be used to create Clusters for

## Example Usage

**Note optional/computed arguments** If any `optional/computed` argument of this resource is defined by the user, removing it from tf file will NOT reset its value. To reset it, let its definition at tf file as empty/false object. Ex: `enable_cluster_monitoring = false`, `cloud_provider {}`, `name = ""`
**Note optional/computed arguments** If any `optional/computed` argument of this resource is defined by the user, removing it from tf file will NOT reset its value. To reset it, let its definition at tf file as empty/false object. Ex: `cloud_provider {}`, `name = ""`

### Creating Rancher v2 imported cluster

Expand Down Expand Up @@ -60,9 +60,7 @@ resource "rancher2_cluster" "foo-custom" {
}
```

### Creating Rancher v2 RKE cluster enabling and customizing monitoring

**Note** Cluster monitoring version `0.2.0` and above, can't be enabled until cluster is fully deployed as [`kubeVersion`](https://github.com/rancher/system-charts/blob/52be656700468904b9bf15c3f39cd7112e1f8c9b/charts/rancher-monitoring/v0.2.0/Chart.yaml#L12) requirement has been introduced to helm chart
### Creating Rancher v2 RKE cluster enabling

```hcl
# Create a new rancher2 RKE Cluster
Expand All @@ -74,34 +72,10 @@ resource "rancher2_cluster" "foo-custom" {
plugin = "canal"
}
}
enable_cluster_monitoring = true
cluster_monitoring_input {
answers = {
"exporter-kubelets.https" = true
"exporter-node.enabled" = true
"exporter-node.ports.metrics.port" = 9796
"exporter-node.resources.limits.cpu" = "200m"
"exporter-node.resources.limits.memory" = "200Mi"
"grafana.persistence.enabled" = false
"grafana.persistence.size" = "10Gi"
"grafana.persistence.storageClass" = "default"
"operator.resources.limits.memory" = "500Mi"
"prometheus.persistence.enabled" = "false"
"prometheus.persistence.size" = "50Gi"
"prometheus.persistence.storageClass" = "default"
"prometheus.persistent.useReleaseName" = "true"
"prometheus.resources.core.limits.cpu" = "1000m",
"prometheus.resources.core.limits.memory" = "1500Mi"
"prometheus.resources.core.requests.cpu" = "750m"
"prometheus.resources.core.requests.memory" = "750Mi"
"prometheus.retention" = "12h"
}
version = "0.1.0"
}
}
```

### Creating Rancher v2 RKE cluster enabling/customizing monitoring and istio
### Creating Rancher v2 RKE cluster enabling/customizing istio

```hcl
# Create a new rancher2 RKE Cluster
Expand All @@ -113,43 +87,18 @@ resource "rancher2_cluster" "foo-custom" {
plugin = "canal"
}
}
enable_cluster_monitoring = true
cluster_monitoring_input {
answers = {
"exporter-kubelets.https" = true
"exporter-node.enabled" = true
"exporter-node.ports.metrics.port" = 9796
"exporter-node.resources.limits.cpu" = "200m"
"exporter-node.resources.limits.memory" = "200Mi"
"grafana.persistence.enabled" = false
"grafana.persistence.size" = "10Gi"
"grafana.persistence.storageClass" = "default"
"operator.resources.limits.memory" = "500Mi"
"prometheus.persistence.enabled" = "false"
"prometheus.persistence.size" = "50Gi"
"prometheus.persistence.storageClass" = "default"
"prometheus.persistent.useReleaseName" = "true"
"prometheus.resources.core.limits.cpu" = "1000m",
"prometheus.resources.core.limits.memory" = "1500Mi"
"prometheus.resources.core.requests.cpu" = "750m"
"prometheus.resources.core.requests.memory" = "750Mi"
"prometheus.retention" = "12h"
}
version = "0.1.0"
}
}
# Create a new rancher2 Cluster Sync for foo-custom cluster
resource "rancher2_cluster_sync" "foo-custom" {
cluster_id = rancher2_cluster.foo-custom.id
wait_monitoring = rancher2_cluster.foo-custom.enable_cluster_monitoring
}
# Create a new rancher2 Namespace
resource "rancher2_namespace" "foo-istio" {
name = "istio-system"
project_id = rancher2_cluster_sync.foo-custom.system_project_id
description = "istio namespace"
}
# Create a new rancher2 App deploying istio (should wait until monitoring is up and running)
# Create a new rancher2 App deploying istio
resource "rancher2_app" "istio" {
catalog_name = "system-library"
name = "cluster-istio"
Expand All @@ -168,7 +117,6 @@ resource "rancher2_app" "istio" {
"gateways.istio-ingressgateway.resources.requests.cpu" = "100m"
"gateways.istio-ingressgateway.resources.requests.memory" = "128Mi"
"gateways.istio-ingressgateway.type" = "NodePort"
"global.monitoring.type" = "cluster-monitoring"
"global.rancher.clusterId" = rancher2_cluster_sync.foo-custom.cluster_id
"istio_cni.enabled" = "false"
"istiocoredns.enabled" = "false"
Expand Down Expand Up @@ -653,7 +601,6 @@ The following arguments are supported:
* `oke_config` - (Optional) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `aks_config_v2`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `k3s_config` and `rke_config` (list maxitems:1)
* `description` - (Optional) The description for Cluster (string)
* `cluster_auth_endpoint` - (Optional/Computed) Enabling the [local cluster authorized endpoint](https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/#local-cluster-auth-endpoint) allows direct communication with the cluster, bypassing the Rancher API proxy. (list maxitems:1)
* `cluster_monitoring_input` - (Optional) Cluster monitoring config. Any parameter defined in [rancher-monitoring charts](https://github.com/rancher/system-charts/tree/dev/charts/rancher-monitoring) could be configured (list maxitems:1)
* `cluster_template_answers` - (Optional/Computed) Cluster template answers. For Rancher v2.3.x and above (list maxitems:1)
* `cluster_template_id` - (Optional) Cluster template ID. For Rancher v2.3.x and above (string)
* `cluster_template_questions` - (Optional/Computed) Cluster template questions. For Rancher v2.3.x and above (list)
Expand All @@ -663,7 +610,6 @@ The following arguments are supported:
* `desired_agent_image` - (Optional/Computed) Desired agent image. For Rancher v2.3.x and above (string)
* `desired_auth_image` - (Optional/Computed) Desired auth image. For Rancher v2.3.x and above (string)
* `docker_root_dir` - (Optional/Computed) Desired auth image. For Rancher v2.3.x and above (string)
* `enable_cluster_monitoring` - (Optional/Computed) Enable built-in cluster monitoring (bool)
* `enable_cluster_istio` - (Deprecated) Deploy istio on `system` project and `istio-system` namespace, using rancher2_app resource instead. See above example.
* `enable_network_policy` - (Optional/Computed) Enable project network isolation (bool)
* `fleet_workspace_name` - (Optional/Computed) Fleet workspace name (string)
Expand Down Expand Up @@ -1944,13 +1890,6 @@ The following arguments are supported:
* `enabled` - (Optional) Enable the authorized cluster endpoint. Default `true` (bool)
* `fqdn` - (Optional) FQDN for the authorized cluster endpoint (string)

### `cluster_monitoring_input`

#### Arguments

* `answers` - (Optional/Computed) Key/value answers for monitor input (map)
* `version` - (Optional) rancher-monitoring chart version (string)

### `cluster_template_answers`

#### Arguments
Expand Down
1 change: 0 additions & 1 deletion docs/resources/cluster_sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ The following arguments are supported:
* `cluster_id` - (Required/ForceNew) The cluster ID that is syncing (string)
* `node_pool_ids` - (Optional) The node pool IDs used by the cluster id (list)
* `wait_catalogs` - (Optional) Wait until all catalogs are downloaded and active. Default: `false` (bool)
* `wait_monitoring` - (Optional) Wait until monitoring is up and running. Default: `false` (bool)
* `state_confirm` - (Optional) Wait until active status is confirmed a number of times (wait interval of 5s). Default: `1` means no confirmation (int)

**Note:** `state_confirm` would be useful, if you have troubles for creating/updating custom clusters that eventually are reaching `active` state before they are fully installed. For example: setting `state_confirm = 2` will assure that the cluster has been in `active` state for at least 5 seconds, `state_confirm = 3` assure at least 10 seconds, etc
Expand Down
1 change: 0 additions & 1 deletion docs/resources/cluster_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ resource "rancher2_cluster_template" "foo" {
* `desired_agent_image` - (Optional/Computed) Desired agent image (string)
* `desired_auth_image` - (Optional/Computed) Desired auth image (string)
* `docker_root_dir` - (Optional/Computed) Desired auth image (string)
* `enable_cluster_monitoring` - (Optional) Enable built-in cluster monitoring. Default: `false` (bool)
* `enable_network_policy` - (Optional) Enable project network isolation. Default: `false` (bool)
* `rke_config` - (Required) Rancher Kubernetes Engine Config (list maxitems: 1)
* `windows_prefered_cluster` - (Optional) Windows prefered cluster. Default: `false` (bool)
Expand Down
34 changes: 1 addition & 33 deletions docs/resources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "rancher2_project" "foo" {
```

```hcl
# Create a new rancher2 Project enabling and customizing monitoring
# Create a new rancher2 Project
resource "rancher2_project" "foo" {
name = "foo"
cluster_id = "<CLUSTER_ID>"
Expand All @@ -57,29 +57,6 @@ resource "rancher2_project" "foo" {
requests_cpu = "1m"
requests_memory = "1Mi"
}
enable_project_monitoring = true
project_monitoring_input {
answers = {
"exporter-kubelets.https" = true
"exporter-node.enabled" = true
"exporter-node.ports.metrics.port" = 9796
"exporter-node.resources.limits.cpu" = "200m"
"exporter-node.resources.limits.memory" = "200Mi"
"grafana.persistence.enabled" = false
"grafana.persistence.size" = "10Gi"
"grafana.persistence.storageClass" = "default"
"operator.resources.limits.memory" = "500Mi"
"prometheus.persistence.enabled" = "false"
"prometheus.persistence.size" = "50Gi"
"prometheus.persistence.storageClass" = "default"
"prometheus.persistent.useReleaseName" = "true"
"prometheus.resources.core.limits.cpu" = "1000m",
"prometheus.resources.core.limits.memory" = "1500Mi"
"prometheus.resources.core.requests.cpu" = "750m"
"prometheus.resources.core.requests.memory" = "750Mi"
"prometheus.retention" = "12h"
}
}
}
```

Expand All @@ -91,9 +68,7 @@ The following arguments are supported:
* `cluster_id` - (Required) The cluster id where create project (string)
* `container_resource_limit` - (Optional) Default containers resource limits on project (List maxitem:1)
* `description` - (Optional) A project description (string)
* `enable_project_monitoring` - (Optional) Enable built-in project monitoring. Default `false` (bool)
* `pod_security_policy_template_id` - (Optional) Default Pod Security Policy ID for the project (string)
* `project_monitoring_input` - (Optional) Project monitoring config. Any parameter defined in [rancher-monitoring charts](https://github.com/rancher/system-charts/tree/dev/charts/rancher-monitoring) could be configured (list maxitems:1)
* `resource_quota` - (Optional) Resource quota for project. Rancher v2.1.x or higher (list maxitems:1)
* `wait_for_cluster` - (Optional) Wait for cluster becomes active. Default `false` (bool)
* `annotations` - (Optional/Computed) Annotations for Node Pool object (map)
Expand All @@ -116,13 +91,6 @@ The following attributes are exported:
* `requests_cpu` - (Optional) CPU reservation for containers (string)
* `requests_memory` - (Optional) Memory reservation for containers (string)

### `project_monitoring_input`

#### Arguments

* `answers` - (Optional/Computed) Key/value answers for monitor input (map)
* `version` - (Optional) rancher-monitoring chart version (string)

### `resource_quota`

#### Arguments
Expand Down
4 changes: 0 additions & 4 deletions rancher2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,10 +909,6 @@ func (c *Config) isClusterConnected(id string) (bool, *managementClient.Cluster,
return c.checkClusterCondition(id, clusterConnectedCondition)
}

func (c *Config) isClusterMonitoringEnabledCondition(id string) (bool, *managementClient.Cluster, error) {
return c.checkClusterCondition(id, clusterMonitoringEnabledCondition)
}

func (c *Config) ClusterExist(id string) error {
_, err := c.GetClusterByID(id)
if err != nil {
Expand Down
14 changes: 0 additions & 14 deletions rancher2/data_source_rancher2_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,6 @@ func dataSourceRancher2Cluster() *schema.Resource {
Schema: clusterAuthEndpoint(),
},
},
"cluster_monitoring_input": {
Type: schema.TypeList,
MaxItems: 1,
Computed: true,
Description: "Cluster monitoring configuration",
Elem: &schema.Resource{
Schema: monitoringInputFields(),
},
},
"cluster_registration_token": {
Type: schema.TypeList,
MaxItems: 1,
Expand Down Expand Up @@ -191,11 +182,6 @@ func dataSourceRancher2Cluster() *schema.Resource {
Computed: true,
Description: "Default pod security admission configuration template name",
},
"enable_cluster_monitoring": {
Type: schema.TypeBool,
Computed: true,
Description: "Enable built-in cluster monitoring",
},
"enable_network_policy": {
Type: schema.TypeBool,
Computed: true,
Expand Down
5 changes: 0 additions & 5 deletions rancher2/data_source_rancher2_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ func dataSourceRancher2Project() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"enable_project_monitoring": {
Type: schema.TypeBool,
Computed: true,
Description: "Enable built-in project monitoring",
},
"pod_security_policy_template_id": {
Type: schema.TypeString,
Computed: true,
Expand Down
Loading

0 comments on commit 2416a84

Please sign in to comment.