Skip to content

Commit 14793f1

Browse files
committed
refactor addons repo info
Signed-off-by: Carlos Santana <csantana23@gmail.com>
1 parent 2dbc4bf commit 14793f1

File tree

31 files changed

+605
-367
lines changed

31 files changed

+605
-367
lines changed
Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
1+
---
12
apiVersion: argoproj.io/v1alpha1
2-
kind: Application
3+
kind: ApplicationSet
34
metadata:
45
name: bootstrap-addons
5-
namespace: 'argocd'
6+
namespace: argocd
67
spec:
7-
destination:
8-
server: https://kubernetes.default.svc
9-
namespace: 'argocd'
10-
project: default
11-
source:
12-
path: ${path}
13-
repoURL: ${repoURL}
14-
targetRevision: ${targetRevision}
15-
directory:
16-
recurse: true
17-
exclude: exclude/*
188
syncPolicy:
19-
automated: {}
9+
preserveResourcesOnDeletion: true
10+
generators:
11+
- clusters:
12+
selector:
13+
matchExpressions:
14+
- key: akuity.io/argo-cd-cluster-name
15+
operator: NotIn
16+
values: [in-cluster]
17+
template:
18+
metadata:
19+
name: 'bootstrap-addons'
20+
spec:
21+
project: default
22+
source:
23+
repoURL: '{{metadata.annotations.addons_repo_url}}'
24+
path: '{{metadata.annotations.addons_repo_basepath}}{{metadata.annotations.addons_repo_path}}'
25+
targetRevision: '{{metadata.annotations.addons_repo_revision}}'
26+
directory:
27+
recurse: true
28+
exclude: exclude/*
29+
destination:
30+
namespace: 'argocd'
31+
name: '{{name}}'
32+
syncPolicy:
33+
automated: {}

argocd/iac/terraform/examples/eks/complete/main.tf

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ locals {
4747
environment = "dev"
4848
region = "us-west-2"
4949
cluster_version = "1.27"
50-
gitops_url = var.gitops_url
51-
gitops_revision = var.gitops_revision
52-
gitops_path = var.gitops_path
50+
gitops_addons_url = "${var.gitops_addons_org}/${var.gitops_addons_repo}"
51+
gitops_addons_basepath = var.gitops_addons_basepath
52+
gitops_addons_path = var.gitops_addons_path
53+
gitops_addons_revision = var.gitops_addons_revision
5354

5455
aws_addons = {
5556
enable_cert_manager = true
@@ -96,20 +97,18 @@ locals {
9697
aws_vpc_id = module.vpc.vpc_id
9798
},
9899
{
99-
gitops_bridge_repo_url = local.gitops_url
100-
gitops_bridge_repo_revision = local.gitops_revision
100+
addons_repo_url = local.gitops_addons_url
101+
addons_repo_basepath = local.gitops_addons_basepath
102+
addons_repo_path = local.gitops_addons_path
103+
addons_repo_revision = local.gitops_addons_revision
101104
},
102105
try(local.aws_addons.enable_velero, false) ? {
103106
velero_backup_s3_bucket_prefix = try(local.velero_backup_s3_bucket_prefix,"")
104107
velero_backup_s3_bucket_name = try(local.velero_backup_s3_bucket_name,"") } : {} # Required when enabling addon velero
105108
)
106109

107110
argocd_bootstrap_app_of_apps = {
108-
addons = templatefile("${path.module}/bootstrap/addons.yaml", {
109-
repoURL = local.gitops_url
110-
targetRevision = local.gitops_revision
111-
path = local.gitops_path
112-
})
111+
addons = file("${path.module}/bootstrap/addons.yaml")
113112
workloads = file("${path.module}/bootstrap/workloads.yaml")
114113
}
115114

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
variable "gitops_url" {
1+
variable "gitops_addons_org" {
2+
description = "Git repository org/user contains for addons"
3+
default = "https://github.com/gitops-bridge-dev"
4+
}
5+
variable "gitops_addons_repo" {
26
description = "Git repository contains for addons"
3-
default = "https://github.com/gitops-bridge-dev/gitops-bridge-argocd-control-plane-template"
7+
default = "gitops-bridge-argocd-control-plane-template"
48
}
5-
variable "gitops_revision" {
6-
description = "Git repository revision/branch/ref for addons"
7-
default = "HEAD"
9+
variable "gitops_addons_basepath" {
10+
description = "Git repository base path for addons"
11+
default = ""
812
}
9-
variable "gitops_path" {
13+
variable "gitops_addons_path" {
1014
description = "Git repository path for addons"
1115
default = "bootstrap/control-plane/addons"
1216
}
17+
variable "gitops_addons_revision" {
18+
description = "Git repository revision/branch/ref for addons"
19+
default = "HEAD"
20+
}
Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
1+
---
12
apiVersion: argoproj.io/v1alpha1
2-
kind: Application
3+
kind: ApplicationSet
34
metadata:
45
name: bootstrap-addons
5-
namespace: 'argocd'
6+
namespace: argocd
67
spec:
7-
destination:
8-
server: https://kubernetes.default.svc
9-
namespace: 'argocd'
10-
project: default
11-
source:
12-
path: ${path}
13-
repoURL: ${repoURL}
14-
targetRevision: ${targetRevision}
15-
directory:
16-
recurse: true
17-
exclude: exclude/*
188
syncPolicy:
19-
automated: {}
9+
preserveResourcesOnDeletion: true
10+
generators:
11+
- clusters:
12+
selector:
13+
matchExpressions:
14+
- key: akuity.io/argo-cd-cluster-name
15+
operator: NotIn
16+
values: [in-cluster]
17+
template:
18+
metadata:
19+
name: 'bootstrap-addons'
20+
spec:
21+
project: default
22+
source:
23+
repoURL: '{{metadata.annotations.addons_repo_url}}'
24+
path: '{{metadata.annotations.addons_repo_basepath}}{{metadata.annotations.addons_repo_path}}'
25+
targetRevision: '{{metadata.annotations.addons_repo_revision}}'
26+
directory:
27+
recurse: true
28+
exclude: exclude/*
29+
destination:
30+
namespace: 'argocd'
31+
name: '{{name}}'
32+
syncPolicy:
33+
automated: {}

argocd/iac/terraform/examples/eks/crossplane/main.tf

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ provider "kubernetes" {
4343
}
4444

4545
locals {
46-
name = "ex-${replace(basename(path.cwd), "_", "-")}"
47-
environment = "control-plane"
48-
region = "us-west-2"
49-
cluster_version = "1.27"
50-
gitops_url = var.gitops_url
51-
gitops_revision = var.gitops_revision
52-
gitops_path = var.gitops_path
46+
name = "ex-${replace(basename(path.cwd), "_", "-")}"
47+
environment = "control-plane"
48+
region = "us-west-2"
49+
cluster_version = "1.27"
50+
gitops_addons_url = "${var.gitops_addons_org}/${var.gitops_addons_repo}"
51+
gitops_addons_basepath = var.gitops_addons_basepath
52+
gitops_addons_path = var.gitops_addons_path
53+
gitops_addons_revision = var.gitops_addons_revision
5354

5455
aws_addons = {
5556
enable_cert_manager = true
@@ -106,17 +107,15 @@ locals {
106107
aws_upbound_crossplane_iam_role_arn = module.crossplane_irsa_aws.iam_role_arn
107108
},
108109
{
109-
gitops_bridge_repo_url = local.gitops_url
110-
gitops_bridge_repo_revision = local.gitops_revision
110+
addons_repo_url = local.gitops_addons_url
111+
addons_repo_basepath = local.gitops_addons_basepath
112+
addons_repo_path = local.gitops_addons_path
113+
addons_repo_revision = local.gitops_addons_revision
111114
}
112115
)
113116

114117
argocd_bootstrap_app_of_apps = {
115-
addons = templatefile("${path.module}/bootstrap/addons.yaml", {
116-
repoURL = local.gitops_url
117-
targetRevision = local.gitops_revision
118-
path = local.gitops_path
119-
})
118+
addons = file("${path.module}/bootstrap/addons.yaml")
120119
workloads = file("${path.module}/bootstrap/workloads.yaml")
121120
}
122121

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
variable "gitops_url" {
1+
variable "gitops_addons_org" {
2+
description = "Git repository org/user contains for addons"
3+
default = "https://github.com/gitops-bridge-dev"
4+
}
5+
variable "gitops_addons_repo" {
26
description = "Git repository contains for addons"
3-
default = "https://github.com/gitops-bridge-dev/gitops-bridge-argocd-control-plane-template"
7+
default = "gitops-bridge-argocd-control-plane-template"
48
}
5-
variable "gitops_revision" {
6-
description = "Git repository revision/branch/ref for addons"
7-
default = "HEAD"
9+
variable "gitops_addons_basepath" {
10+
description = "Git repository base path for addons"
11+
default = ""
812
}
9-
variable "gitops_path" {
13+
variable "gitops_addons_path" {
1014
description = "Git repository path for addons"
1115
default = "bootstrap/control-plane/addons"
1216
}
17+
variable "gitops_addons_revision" {
18+
description = "Git repository revision/branch/ref for addons"
19+
default = "HEAD"
20+
}

argocd/iac/terraform/examples/eks/external-secrets/main.tf

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ locals {
4747
environment = "dev"
4848
region = "us-west-2"
4949
cluster_version = "1.27"
50-
gitops_addons_org = var.gitops_addons_org
51-
gitops_addons_repo = var.gitops_addons_repo
50+
gitops_addons_url = "${var.gitops_addons_org}/${var.gitops_addons_repo}"
5251
gitops_addons_basepath = var.gitops_addons_basepath
5352
gitops_addons_path = var.gitops_addons_path
5453
gitops_addons_revision = var.gitops_addons_revision
55-
gitops_addons_url = "${local.gitops_addons_org}/${local.gitops_addons_repo}"
5654

5755
gitops_workload_org = var.gitops_workload_org
5856
gitops_workload_repo = var.gitops_workload_repo
@@ -110,10 +108,10 @@ locals {
110108
aws_vpc_id = module.vpc.vpc_id
111109
},
112110
{
113-
gitops_bridge_repo_url = local.gitops_addons_url
114-
gitops_bridge_repo_basepath = local.gitops_addons_basepath
115-
gitops_bridge_repo_path = local.gitops_addons_path
116-
gitops_bridge_repo_revision = local.gitops_addons_revision
111+
addons_repo_url = local.gitops_addons_url
112+
addons_repo_basepath = local.gitops_addons_basepath
113+
addons_repo_path = local.gitops_addons_path
114+
addons_repo_revision = local.gitops_addons_revision
117115
},
118116
{
119117
workload_repo_url = local.gitops_workload_url
Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
1+
---
12
apiVersion: argoproj.io/v1alpha1
2-
kind: Application
3+
kind: ApplicationSet
34
metadata:
45
name: bootstrap-addons
5-
namespace: 'argocd'
6+
namespace: argocd
67
spec:
7-
destination:
8-
server: https://kubernetes.default.svc
9-
namespace: 'argocd'
10-
project: default
11-
source:
12-
path: ${path}
13-
repoURL: ${repoURL}
14-
targetRevision: ${targetRevision}
15-
directory:
16-
recurse: true
17-
exclude: exclude/*
188
syncPolicy:
19-
automated: {}
9+
preserveResourcesOnDeletion: true
10+
generators:
11+
- clusters:
12+
selector:
13+
matchExpressions:
14+
- key: akuity.io/argo-cd-cluster-name
15+
operator: NotIn
16+
values: [in-cluster]
17+
template:
18+
metadata:
19+
name: 'bootstrap-addons'
20+
spec:
21+
project: default
22+
source:
23+
repoURL: '{{metadata.annotations.addons_repo_url}}'
24+
path: '{{metadata.annotations.addons_repo_basepath}}{{metadata.annotations.addons_repo_path}}'
25+
targetRevision: '{{metadata.annotations.addons_repo_revision}}'
26+
directory:
27+
recurse: true
28+
exclude: exclude/*
29+
destination:
30+
namespace: 'argocd'
31+
name: '{{name}}'
32+
syncPolicy:
33+
automated: {}

argocd/iac/terraform/examples/eks/hello-world/main.tf

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ provider "kubernetes" {
4343
}
4444

4545
locals {
46-
name = "ex-${replace(basename(path.cwd), "_", "-")}"
47-
environment = "dev"
48-
region = "us-west-2"
49-
cluster_version = "1.27"
50-
gitops_url = var.gitops_url
51-
gitops_revision = var.gitops_revision
52-
gitops_path = var.gitops_path
46+
name = "ex-${replace(basename(path.cwd), "_", "-")}"
47+
environment = "dev"
48+
region = "us-west-2"
49+
cluster_version = "1.27"
50+
gitops_addons_url = "${var.gitops_addons_org}/${var.gitops_addons_repo}"
51+
gitops_addons_basepath = var.gitops_addons_basepath
52+
gitops_addons_path = var.gitops_addons_path
53+
gitops_addons_revision = var.gitops_addons_revision
5354

5455
aws_addons = {
5556
enable_cert_manager = true
@@ -96,17 +97,15 @@ locals {
9697
aws_vpc_id = module.vpc.vpc_id
9798
},
9899
{
99-
gitops_bridge_repo_url = local.gitops_url
100-
gitops_bridge_repo_revision = local.gitops_revision
100+
addons_repo_url = local.gitops_addons_url
101+
addons_repo_basepath = local.gitops_addons_basepath
102+
addons_repo_path = local.gitops_addons_path
103+
addons_repo_revision = local.gitops_addons_revision
101104
}
102105
)
103106

104107
argocd_bootstrap_app_of_apps = {
105-
addons = templatefile("${path.module}/bootstrap/addons.yaml", {
106-
repoURL = local.gitops_url
107-
targetRevision = local.gitops_revision
108-
path = local.gitops_path
109-
})
108+
addons = file("${path.module}/bootstrap/addons.yaml")
110109
workloads = file("${path.module}/bootstrap/workloads.yaml")
111110
}
112111

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
variable "gitops_url" {
1+
variable "gitops_addons_org" {
2+
description = "Git repository org/user contains for addons"
3+
default = "https://github.com/gitops-bridge-dev"
4+
}
5+
variable "gitops_addons_repo" {
26
description = "Git repository contains for addons"
3-
default = "https://github.com/gitops-bridge-dev/gitops-bridge-argocd-control-plane-template"
7+
default = "gitops-bridge-argocd-control-plane-template"
48
}
5-
variable "gitops_revision" {
6-
description = "Git repository revision/branch/ref for addons"
7-
default = "HEAD"
9+
variable "gitops_addons_basepath" {
10+
description = "Git repository base path for addons"
11+
default = ""
812
}
9-
variable "gitops_path" {
13+
variable "gitops_addons_path" {
1014
description = "Git repository path for addons"
1115
default = "bootstrap/control-plane/addons"
1216
}
17+
variable "gitops_addons_revision" {
18+
description = "Git repository revision/branch/ref for addons"
19+
default = "HEAD"
20+
}

0 commit comments

Comments
 (0)