Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: change the default cluster issuer, remove the namespace variable and hardcode the Helm release name #18

Merged
merged 5 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 7 additions & 35 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ The following providers are used by this module:

- [[provider_random]] <<provider_random,random>> (>= 3)

- [[provider_utils]] <<provider_utils,utils>> (>= 1)
- [[provider_null]] <<provider_null,null>>

- [[provider_argocd]] <<provider_argocd,argocd>> (>= 5)

- [[provider_null]] <<provider_null,null>>
- [[provider_utils]] <<provider_utils,utils>> (>= 1)

=== Resources

Expand Down Expand Up @@ -259,15 +259,7 @@ Description: SSL certificate issuer to use. Usually you would configure this val

Type: `string`

Default: `"ca-issuer"`

==== [[input_argocd_namespace]] <<input_argocd_namespace,argocd_namespace>>

Description: Namespace used by Argo CD where the Application and AppProject resources should be created.

Type: `string`

Default: `"argocd"`
Default: `"selfsigned-issuer"`

==== [[input_argocd_project]] <<input_argocd_project,argocd_project>>

Expand Down Expand Up @@ -299,15 +291,7 @@ Description: Override of target revision of the application chart.

Type: `string`

Default: `"v2.2.0"`

==== [[input_namespace]] <<input_namespace,namespace>>

Description: Namespace where the applications's Kubernetes resources should be created. Namespace will be created in case it doesn't exist.

Type: `string`

Default: `"longhorn-system"`
Default: `"v2.3.0"`

==== [[input_helm_values]] <<input_helm_values,helm_values>>

Expand Down Expand Up @@ -541,9 +525,9 @@ Description: ID to pass other modules in order to refer to this module as a depe
|===
|Name |Version
|[[provider_random]] <<provider_random,random>> |>= 3
|[[provider_null]] <<provider_null,null>> |n/a
|[[provider_utils]] <<provider_utils,utils>> |>= 1
|[[provider_argocd]] <<provider_argocd,argocd>> |>= 5
|[[provider_null]] <<provider_null,null>> |n/a
|===

= Resources
Expand Down Expand Up @@ -579,13 +563,7 @@ Description: ID to pass other modules in order to refer to this module as a depe
|[[input_cluster_issuer]] <<input_cluster_issuer,cluster_issuer>>
|SSL certificate issuer to use. Usually you would configure this value as `letsencrypt-staging` or `letsencrypt-prod` on your root `*.tf` files.
|`string`
|`"ca-issuer"`
|no

|[[input_argocd_namespace]] <<input_argocd_namespace,argocd_namespace>>
|Namespace used by Argo CD where the Application and AppProject resources should be created.
|`string`
|`"argocd"`
|`"selfsigned-issuer"`
|no

|[[input_argocd_project]] <<input_argocd_project,argocd_project>>
Expand All @@ -609,13 +587,7 @@ Description: ID to pass other modules in order to refer to this module as a depe
|[[input_target_revision]] <<input_target_revision,target_revision>>
|Override of target revision of the application chart.
|`string`
|`"v2.2.0"`
|no

|[[input_namespace]] <<input_namespace,namespace>>
|Namespace where the applications's Kubernetes resources should be created. Namespace will be created in case it doesn't exist.
|`string`
|`"longhorn-system"`
|`"v2.3.0"`
|no

|[[input_helm_values]] <<input_helm_values,helm_values>>
Expand Down
14 changes: 6 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ resource "argocd_project" "this" {

metadata {
name = var.destination_cluster != "in-cluster" ? "longhorn-${var.destination_cluster}" : "longhorn"
namespace = var.argocd_namespace
annotations = {
"devops-stack.io/argocd_namespace" = var.argocd_namespace
}
namespace = "argocd"
}

spec {
Expand All @@ -19,7 +16,7 @@ resource "argocd_project" "this" {

destination {
name = var.destination_cluster
namespace = var.namespace
namespace = "longhorn-system"
}

orphaned_resources {
Expand All @@ -40,7 +37,7 @@ data "utils_deep_merge_yaml" "values" {
resource "argocd_application" "this" {
metadata {
name = var.destination_cluster != "in-cluster" ? "longhorn-${var.destination_cluster}" : "longhorn"
namespace = var.argocd_namespace
namespace = "argocd"
labels = merge({
"application" = "longhorn"
"cluster" = var.destination_cluster
Expand All @@ -62,13 +59,14 @@ resource "argocd_application" "this" {
path = "charts/longhorn"
target_revision = var.target_revision
helm {
values = data.utils_deep_merge_yaml.values.output
release_name = "longhorn"
values = data.utils_deep_merge_yaml.values.output
}
}

destination {
name = var.destination_cluster
namespace = var.namespace
namespace = "longhorn-system"
}

sync_policy {
Expand Down
14 changes: 1 addition & 13 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ variable "base_domain" {
variable "cluster_issuer" {
description = "SSL certificate issuer to use. Usually you would configure this value as `letsencrypt-staging` or `letsencrypt-prod` on your root `*.tf` files."
type = string
default = "ca-issuer"
}

variable "argocd_namespace" {
description = "Namespace used by Argo CD where the Application and AppProject resources should be created."
type = string
default = "argocd"
default = "selfsigned-issuer"
}

variable "argocd_project" {
Expand All @@ -50,12 +44,6 @@ variable "target_revision" {
default = "v2.3.0" # x-release-please-version
}

variable "namespace" {
description = "Namespace where the applications's Kubernetes resources should be created. Namespace will be created in case it doesn't exist."
type = string
default = "longhorn-system"
}

variable "helm_values" {
description = "Helm chart value overrides. They should be passed as a list of HCL structures."
type = any
Expand Down