1- locals {
2- cluster_name = " scaleway-test"
3- cluster_region = " fr-par"
4- cluster_zone = " fr-par-1"
5- tags = [" test" , " ${ local . cluster_name } " ]
6- }
7-
8- module "cluster" {
9- source = " git::https://github.com/camptocamp/devops-stack.git//modules/scaleway?ref=v1-alpha"
10-
11- kubernetes_version = " 1.24.3"
12-
13- cluster_type = " kapsule"
14- cluster_name = local. cluster_name
15- cluster_tags = local. tags
16- region = local. cluster_region
17- zone = local. cluster_zone
18- lb_type = " LB-S"
19-
1+ # ###########################
2+ # INFRA + K8s PHASE
3+ # ###########################
4+ module "scaleway" {
5+ source = " [email protected] :camptocamp/devops-stack-module-cluster-scaleway.git" 6+
7+ base_domain = var. base_domain
8+ cluster_name = var. cluster_name
9+ cluster_description = var. cluster_description
10+ cluster_tags = var. cluster_tags
11+ cluster_type = var. cluster_type
12+ kubernetes_version = var. kubernetes_version
13+ lb_name = var. lb_name
14+ lb_type = var. lb_type
15+ zone = var. zone
16+ node_pools = var. node_pools
2017}
2118
19+ # ###########################
20+ # BOOTSPRAP APPLICATION PHASE
21+ # ###########################
2222
2323module "argocd_bootstrap" {
24- source = " git::https://github.com/camptocamp/devops-stack-module-argocd.git//bootstrap?ref=v1-alpha"
25- cluster_name = local. cluster_name
26- base_domain = module. cluster . base_domain
27- cluster_issuer = " letsencrypt-prod"
28-
29- argocd = {
30- admin_enabled = " true"
31- }
32-
33- depends_on = [
34- module . cluster ,
35- ]
24+ source = " git::https://github.com/camptocamp/devops-stack-module-argocd.git//bootstrap?ref=v4.4.0"
3625}
3726
27+ module "ingress_controller" {
28+ source = " git::https://github.com/camptocamp/devops-stack-module-traefik.git?ref=v5.0.0"
3829
39- module "ingress" {
40- source = " git::https://github.com/camptocamp/devops-stack-module-traefik.git//scaleway?ref=v1-alpha"
41-
42- cluster_name = local. cluster_name
43- argocd_namespace = module. argocd_bootstrap . argocd_namespace
44- base_domain = module. cluster . base_domain
30+ cluster_name = var. cluster_name
31+ base_domain = module. scaleway . base_domain
32+ enable_service_monitor = var. ingress_enable_service_monitor
4533
4634 helm_values = [{
4735 traefik = {
4836 service = {
4937 type = " LoadBalancer"
5038 annotations = {
51- " service.beta.kubernetes.io/scw-loadbalancer-id" = module.cluster .lb_id
39+ " service.beta.kubernetes.io/scw-loadbalancer-id" = module.scaleway .lb_id
5240 }
5341 }
5442 }
@@ -60,131 +48,103 @@ module "ingress" {
6048}
6149
6250module "cert-manager" {
63- source = " git::https://github.com/camptocamp/devops-stack-module-cert-manager.git//scaleway?ref=remove-read-only-attribut"
64-
65- cluster_name = local. cluster_name
66- argocd_namespace = module. argocd_bootstrap . argocd_namespace
67- base_domain = module. cluster . base_domain
51+ source = " git::https://github.com/camptocamp/devops-stack-module-cert-manager.git//self-signed?ref=v8.1.0"
6852
69- helm_values = [{
70- cert-manager = {
71- clusterIssuers = {
72- letsencrypt = {
73- enabled = true
74- }
75- acme = {
76- solvers = [
77- {
78- http01 = {
79- ingress = {}
80- }
81- }
82- ]
83- }
84- }
85- }
86- }]
53+ enable_service_monitor = var. cert_manager_enable_service_monitor
8754
8855 dependency_ids = {
8956 argocd = module.argocd_bootstrap.id
9057 }
9158}
9259
93- module "argocd " {
94- source = " git::https://github.com/camptocamp/devops-stack-module-argocd .git?ref=v1-alpha "
60+ module "authentication_with_keycloak " {
61+ source = " git::https://github.com/camptocamp/devops-stack-module-keycloak .git?ref=v2.0.1 "
9562
96- bootstrap_values = module . argocd_bootstrap . bootstrap_values
63+ cluster_name = var . cluster_name
9764 argocd_namespace = module. argocd_bootstrap . argocd_namespace
65+ base_domain = var. base_domain
66+ cluster_issuer = var. cluster_issuer
9867
99- oidc = {}
68+ dependency_ids = {
69+ ingress_controller = module.ingress_controller.id
70+ cert-manager = module.cert- manager.id
71+ }
72+ }
10073
101- helm_values = [{
102- argo-cd = {
103- global = {
104- image = {
105- repository = " camptocamp/argocd"
106- tag = " v2.3.4_c2c.3"
107- }
108- }
109- server = {
110- config = {
111- configManagementPlugins = <<- EOT
112- - name: kustomized-helm
113- init:
114- command: ["/bin/sh", "-c"]
115- args: ["helm dependency build || true"]
116- generate:
117- command: ["/bin/sh", "-c"]
118- args: ["echo \"$HELM_VALUES\" | helm template . --name-template $ARGOCD_APP_NAME --namespace $ARGOCD_APP_NAMESPACE $HELM_ARGS -f - --include-crds > all.yaml && kustomize build"]
119- - name: helmfile
120- init:
121- command: ["argocd-helmfile"]
122- args: ["init"]
123- generate:
124- command: ["argocd-helmfile"]
125- args: ["generate"]
126- lockRepo: true
127- EOT
128- }
129- }
74+ module "authorization_with_keycloak" {
75+ source = " git::https://github.com/camptocamp/devops-stack-module-keycloak.git//oidc_bootstrap?ref=v2.0.1"
76+
77+ cluster_name = var. cluster_name
78+ base_domain = var. base_domain
79+ cluster_issuer = var. cluster_issuer
80+ user_map = {
81+ jdoe = {
82+ username = " jdoe"
83+ 84+ first_name = " John"
85+ last_name = " Doe"
13086 }
131- }]
87+ }
88+ dependency_ids = {
89+ keycloak = module.authentication_with_keycloak.id
90+ }
91+ }
92+
93+
94+ module "kube-prometheus-stack" {
95+ source = " git::https://github.com/camptocamp/devops-stack-module-kube-prometheus-stack?ref=v9.2.0"
96+
97+ cluster_name = var. cluster_name
98+ base_domain = module. scaleway . base_domain
99+ cluster_issuer = var. cluster_issuer
100+
101+ metrics_storage_main = null
102+
103+ prometheus = {
104+ oidc = module.authorization_with_keycloak.oidc
105+ }
106+ alertmanager = {
107+ oidc = module.authorization_with_keycloak.oidc
108+ }
109+ grafana = {
110+ oidc = module.authorization_with_keycloak.oidc
111+ }
132112
133113 dependency_ids = {
134- argocd = module.argocd_bootstrap.id
135- cert_manager = module.cert- manager.id
114+ ingress_controller = module.ingress_controller.id
115+ cert-manager = module.cert- manager.id
116+ oidc = module.authentication_with_keycloak.id
136117 }
137118}
138119
139- # module "monitoring" {
140- # source = "git::https://github.com/camptocamp/devops-stack-module-kube-prometheus-stack.git?ref=v1-alpha"
141- #
142- # cluster_name = local.cluster_name
143- #
144- # prometheus = {
145- # oidc = {
146- # issuer_url = module.oidc.issuer_url
147- # api_url = "${module.oidc.issuer_url}/healthz"
148- # client_id = module.oidc.clients.prometheus.id
149- # client_secret = module.oidc.clients.prometheus.secret
150- #
151- # oauth2_proxy_extra_args = [
152- # ]
153- # }
154- # }
155- #
156- # alertmanager = {
157- # oidc = {
158- # issuer_url = module.oidc.issuer_url
159- # api_url = "${module.oidc.issuer_url}/healthz"
160- # client_id = module.oidc.clients.alertmanager.id
161- # client_secret = module.oidc.clients.alertmanager.secret
162- #
163- # oauth2_proxy_extra_args = [
164- # ]
165- # }
166- # }
167- #
168- # grafana = {
169- # oidc = {
170- # oauth_url = "${module.oidc.issuer_url}/auth"
171- # token_url = "${module.oidc.issuer_url}/token"
172- # api_url = "${module.oidc.issuer_url}/userinfo"
173- # client_id = module.oidc.clients.grafana.id
174- # client_secret = module.oidc.clients.grafana.secret
175- #
176- # oauth2_proxy_extra_args = [
177- # ]
178- # }
179- # }
180- #
181- # argocd_namespace = module.argocd_bootstrap.argocd_namespace
182- # base_domain = module.cluster.base_domain
183- # cluster_issuer = "letsencrypt-prod"
184- # metrics_archives = {}
185- #
186- # dependency_ids = {
187- # argocd = module.argocd_bootstrap.id
188- # oidc = module.oidc.id
189- # }
190- # }
120+ module "argocd" {
121+ source = " git::https://github.com/camptocamp/devops-stack-module-argocd.git?ref=v4.4.0"
122+
123+ base_domain = module. scaleway . base_domain
124+ cluster_name = var. cluster_name
125+ cluster_issuer = var. cluster_issuer
126+ server_secretkey = module. argocd_bootstrap . argocd_server_secretkey
127+ accounts_pipeline_tokens = module. argocd_bootstrap . argocd_accounts_pipeline_tokens
128+
129+ admin_enabled = true
130+ # app_autosync = {}
131+
132+ oidc = {
133+ name = " OIDC"
134+ issuer = module.authorization_with_keycloak.oidc.issuer_url
135+ clientID = module.authorization_with_keycloak.oidc.client_id
136+ clientSecret = module.authorization_with_keycloak.oidc.client_secret
137+ requestedIDTokenClaims = {
138+ groups = {
139+ essential = true
140+ }
141+ }
142+ }
143+
144+ dependency_ids = {
145+ ingress_controller = module.ingress_controller.id
146+ cert-manager = module.cert- manager.id
147+ oidc = module.authorization_with_keycloak.id
148+ # kube-prometheus-stack = module.kube-prometheus-stack.id
149+ }
150+ }
0 commit comments