forked from jfrog/jfrog-credentials-provider
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigmap-provider.yaml
More file actions
157 lines (151 loc) · 4.94 KB
/
configmap-provider.yaml
File metadata and controls
157 lines (151 loc) · 4.94 KB
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
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "jfrog-credential-provider.fullname" . }}-config
namespace: {{ include "jfrog-credential-provider.namespace" . }}
data:
{{- $cloudProvider := include "jfrog-credential-provider.cloudProvider" . }}
{{- if or (eq $cloudProvider "azure") (eq $cloudProvider "gcp") }}
jfrog-provider.yaml: |
{{- else if (eq $cloudProvider "aws") }}
jfrog-provider.json: |
{
{{- end }}
{{- range .Values.providerConfig }}
{{- if or (eq $cloudProvider "azure") (eq $cloudProvider "gcp") }}
name: {{ .name }}
apiVersion: credentialprovider.kubelet.k8s.io/v1
matchImages: {{ .matchImages | toJson }}
defaultCacheDuration: {{ .defaultCacheDuration }}
{{- else if eq $cloudProvider "aws" }}
"name": "{{ .name }}",
"matchImages": {{ .matchImages | toJson }},
"defaultCacheDuration": {{ .defaultCacheDuration | toJson }},
"apiVersion": "credentialprovider.kubelet.k8s.io/v1",
{{- end }}
{{- if and .tokenAttributes .tokenAttributes.enabled (eq $cloudProvider "aws") }}
"tokenAttributes": {
"serviceAccountTokenAudience": "sts.amazonaws.com",
"cacheType": "ServiceAccount",
"requireServiceAccount": false,
"optionalServiceAccountAnnotationKeys": [
"eks.amazonaws.com/role-arn",
"JFrogExchange"
]
},
{{- else if and .tokenAttributes .tokenAttributes.enabled (eq $cloudProvider "azure") }}
tokenAttributes:
{{- if .azure.azure_app_audience }}
serviceAccountTokenAudience: {{ .azure.azure_app_audience }}
{{- else}}
serviceAccountTokenAudience: api://AzureADTokenExchange
{{- end }}
cacheType: ServiceAccount
requireServiceAccount: true
requiredServiceAccountAnnotationKeys:
- azure.workload.identity/client-id
- JFrogExchange
{{- else if and .tokenAttributes .tokenAttributes.enabled (eq $cloudProvider "gcp") }}
tokenAttributes:
{{- if .gcp.jfrog_oidc_audience }}
serviceAccountTokenAudience: {{ .gcp.jfrog_oidc_audience }}
{{- else}}
serviceAccountTokenAudience: "artifactory"
{{- end }}
cacheType: ServiceAccount
requireServiceAccount: true
requiredServiceAccountAnnotationKeys:
- iam.gke.io/gcp-service-account
- JFrogExchange
{{- end }}
{{- if eq $cloudProvider "aws" }}
"env": [
{
"name": "aws_auth_method",
"value": {{ .aws.aws_auth_method | toJson }}
},
{
"name": "artifactory_url",
"value": {{ .artifactoryUrl | toJson }}
},
{
"name": "disable_provider_autoupdate",
"value": "{{ not $.Values.autoUpgrade }}"
},
{{- if .aws.aws_region }}
{
"name": "aws_region",
"value": {{ .aws.aws_region | toJson }}
},
{{- end }}
{{- if eq .aws.aws_auth_method "cognito_oidc" }}
{
"name": "secret_name",
"value": {{ .aws.aws_cognito_user_pool_secret_name | toJson }}
},
{
"name": "user_pool_name",
"value": {{ .aws.aws_cognito_user_pool_name | toJson }}
},
{
"name": "resource_server_name",
"value": {{ .aws.aws_cognito_resource_server_name | toJson }}
},
{
"name": "user_pool_resource_scope",
"value": {{ .aws.aws_cognito_user_pool_resource_scope | toJson }}
},
{
"name": "jfrog_oidc_provider_name",
"value": {{ .aws.jfrog_oidc_provider_name | toJson }}
}
]
}
{{- else if eq .aws.aws_auth_method "assume_role" }}
{
"name": "aws_role_name",
"value": {{ .aws.aws_role_name | toJson }}
},
{
"name": "secret_ttl_seconds",
"value": {{- if .aws.secret_ttl_seconds }}{{ .aws.secret_ttl_seconds | toJson }}{{ else }}"14400"{{ end }}
}
]
}
{{- end }}
{{- end }}
{{- if eq $cloudProvider "gcp" }}
env:
- name: artifactory_url
value: "{{ .artifactoryUrl }}"
- name: google_service_account_email
value: "{{ .gcp.google_service_account_email }}"
- name: jfrog_oidc_audience
value: "{{ .gcp.jfrog_oidc_audience }}"
- name: jfrog_oidc_provider_name
value: "{{ .gcp.jfrog_oidc_provider_name }}"
- name: disable_provider_autoupdate
value: "{{ not $.Values.autoUpgrade }}"
{{- end }}
{{- if eq $cloudProvider "azure" }}
env:
- name: artifactory_url
value: "{{ .artifactoryUrl }}"
- name: azure_app_client_id
value: "{{ .azure.azure_app_client_id }}"
{{- if .azure.azure_cloud_name }}
- name: azure_cloud_name
value: "{{ .azure.azure_cloud_name }}"
{{- end }}
- name: azure_tenant_id
value: "{{ .azure.azure_tenant_id }}"
- name: azure_nodepool_client_id
value: "{{ .azure.azure_nodepool_client_id }}"
- name: azure_app_audience
value: "{{ .azure.azure_app_audience }}"
- name: jfrog_oidc_provider_name
value: "{{ .azure.jfrog_oidc_provider_name }}"
- name: disable_provider_autoupdate
value: "{{ not $.Values.autoUpgrade }}"
{{- end }}
{{- end }}