-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule_helm_argo_workflows.tf
200 lines (178 loc) · 5.13 KB
/
module_helm_argo_workflows.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
resource "kubernetes_secret" "helm_argo_workflows_azure_blob_secret" {
metadata {
name = "argo-workflows-azure-blob-storage"
namespace = kubernetes_namespace.argo_workflows_system.id
}
data = {
root-user = var.platform_workflows_storage_account_name
root-password = var.platform_workflows_primary_access_key
}
}
resource "kubernetes_secret" "helm_argo_workflows_argo_server_sso_secret" {
metadata {
name = "argo-server-sso"
namespace = kubernetes_namespace.argo_workflows_system.id
}
data = {
clientId = var.argo_workflows_client_id
clientSecret = var.argo_workflows_client_secret
}
}
module "helm_argo_workflows" {
source = "git::https://gitlab.k8s.cloud.statcan.ca/cloudnative/terraform/modules/terraform-kubernetes-argo-workflows.git?ref=main"
chart_version = "0.22.0"
depends_on = [
kubernetes_secret.helm_argo_workflows_argo_server_sso_secret,
]
helm_namespace = module.namespace_argo_workflows_system.name
helm_repository = lookup(var.platform_helm_repositories, "argo-workflows", "https://argoproj.github.io/argo-helm")
helm_repository_username = var.platform_helm_repository_username
helm_repository_password = var.platform_helm_repository_password
values = <<EOF
images:
pullPolicy: Always
pullSecrets:
- name: "${local.platform_image_pull_secret_name}"
controller:
image:
registry: ${trimsuffix(local.repositories.quay, "/")}
repository: argoproj/workflow-controller
tag: v3.4.4
workflowDefaults:
spec:
activeDeadlineSeconds: 28800
podGC:
strategy: OnPodCompletion
executor:
image:
registry: ${trimsuffix(local.repositories.quay, "/")}
repository: argoproj/argoexec
tag: v3.4.4
server:
image:
registry: ${trimsuffix(local.repositories.quay, "/")}
repository: argoproj/argocli
tag: v3.4.4
extraArgs:
- '--auth-mode=sso'
- '--auth-mode=client'
extraEnv:
- name: "SSO_DELEGATE_RBAC_TO_NAMESPACE"
value: "true"
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: istio
hosts:
- "argo-workflows.${var.ingress_domain}"
https: true
sso:
issuer: "https://login.microsoftonline.com/${var.tenant_id}/v2.0"
clientId:
name: ${kubernetes_secret.helm_argo_workflows_argo_server_sso_secret.metadata.0.name}
key: clientId
clientSecret:
name: ${kubernetes_secret.helm_argo_workflows_argo_server_sso_secret.metadata.0.name}
key: clientSecret
redirectUrl: "https://argo-workflows.${var.ingress_domain}/oauth2/callback"
rbac:
enabled: true
scopes:
- openid
- profile
- email
workflow:
serviceAccount:
create: true
name: "argo-workflows"
rbac:
create: true
useDefaultArtifactRepo: true
useStaticCredentials: true
artifactRepository:
archiveLogs: true
azure:
endpoint: ${var.platform_workflows_primary_blob_endpoint}
container: workflows
# blob: /
# accountKeySecret is a secret selector.
# It references the k8s secret named 'my-azure-storage-credentials'.
# This secret is expected to have have the key 'account-access-key',
# containing the base64 encoded credentials to the storage account.
#
# If a managed identity has been assigned to the machines running the
# workflow (e.g., https://docs.microsoft.com/en-us/azure/aks/use-managed-identity)
# then accountKeySecret is not needed, and useSDKCreds should be
# set to true instead:
useSDKCreds: false
accountKeySecret:
name: argo-workflows-azure-blob-storage
key: root-password
EOF
}
# Argo Workflows for Default Service Account
resource "kubernetes_service_account" "argo_workflows_default" {
metadata {
name = "user-default-login"
namespace = "argo-workflows-system"
annotations = {
"workflows.argoproj.io/rbac-rule" = "true"
"workflows.argoproj.io/rbac-rule-precedence" = "0"
}
}
}
resource "kubernetes_cluster_role" "argo_workflows_namespace" {
metadata {
name = "argo-workflows-namespace"
}
rule {
api_groups = ["argoproj.io"]
resources = [
"eventsources",
"eventsources/finalizers",
"sensors",
"sensors/finalizers",
"workflows",
"workflows/finalizers",
"workfloweventbindings",
"workfloweventbindings/finalizers",
"workflowtemplates",
"workflowtemplates/finalizers",
"cronworkflows",
"cronworkflows/finalizers",
"clusterworkflowtemplates",
"clusterworkflowtemplates/finalizers"
]
verbs = [
"create",
"delete",
"deletecollection",
"get",
"list",
"patch",
"update",
"watch"
]
}
rule {
api_groups = [""]
resources = ["secrets"]
verbs = ["get"]
resource_names = ["argo-workflows-azure-blob-storage"]
}
}
resource "kubernetes_cluster_role" "argo_workflows_workflow" {
metadata {
name = "argo-workflows-workflow"
}
rule {
api_groups = [""]
resources = ["pods"]
verbs = ["get", "watch", "patch"]
}
rule {
api_groups = [""]
resources = ["pods/log"]
verbs = ["get", "watch"]
}
}