Skip to content

Commit f1224d4

Browse files
committed
[EPMDEDP-8257]: feat: Provision argocd client in Keycloak Enable
Introduce argocd.enabled flag which enables ArgoCD integration with SSO Signed-off-by: Sergiy Kulanov <[email protected]> Change-Id: I947050cf8f964b6869c3b1c962a6d8949cd06607
1 parent 5df6d3d commit f1224d4

File tree

7 files changed

+171
-3
lines changed

7 files changed

+171
-3
lines changed

deploy-templates/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ A Helm chart for EDP Install
1010

1111
| Name | Email | Url |
1212
| ---- | ------ | --- |
13-
| epmd-edp | [email protected] | https://solutionshub.epam.com/solution/epam-delivery-platform |
14-
| sergk | | https://github.com/SergK |
13+
| epmd-edp | <[email protected]> | <https://solutionshub.epam.com/solution/epam-delivery-platform> |
14+
| sergk | | <https://github.com/SergK> |
1515

1616
## Source Code
1717

@@ -40,6 +40,8 @@ A Helm chart for EDP Install
4040
| EDPComponents | object | `{}` | |
4141
| admin-console-operator.enabled | bool | `true` | |
4242
| annotations | object | `{}` | |
43+
| argocd.enabled | bool | `false` | Enable ArgoCD integration |
44+
| argocd.url | string | `""` (defaults to https://argocd.{{ .Values.global.dnsWildCard }}) | ArgoCD URL in format schema://URI |
4345
| awsRegion | string | `nil` | |
4446
| cd-pipeline-operator.enabled | bool | `true` | |
4547
| codebase-operator.enabled | bool | `true` | |
@@ -93,4 +95,4 @@ A Helm chart for EDP Install
9395
| vcs.enabled | string | `"false"` | |
9496

9597
----------------------------------------------
96-
Autogenerated from chart metadata using [helm-docs v1.7.0](https://github.com/norwoodj/helm-docs/releases/v1.7.0)
98+
Autogenerated from chart metadata using [helm-docs v1.10.0](https://github.com/norwoodj/helm-docs/releases/v1.10.0)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- $argocdDefaultURL := printf "https://argocd.%s" .Values.global.dnsWildCard -}}
2+
{{- if .Values.argocd.enabled }}
3+
apiVersion: v1.edp.epam.com/v1alpha1
4+
kind: KeycloakClient
5+
metadata:
6+
name: argocd
7+
spec:
8+
advancedProtocolMappers: true
9+
clientId: agocd
10+
directAccess: true
11+
public: false
12+
targetRealm: {{ .Values.global.edpName }}-main
13+
webUrl: "{{ .Values.argocd.url | default $argocdDefaultURL }}"
14+
{{- end }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- if .Values.argocd.enabled }}
2+
apiVersion: v1.edp.epam.com/v1alpha1
3+
kind: KeycloakClientScope
4+
metadata:
5+
name: groups
6+
spec:
7+
name: groups
8+
realm: main
9+
description: "Group Membership"
10+
protocol: openid-connect
11+
protocolMappers:
12+
- name: groups
13+
protocol: openid-connect
14+
protocolMapper: "oidc-group-membership-mapper"
15+
config:
16+
"access.token.claim": "true"
17+
"claim.name": "groups"
18+
"full.path": "false"
19+
"id.token.claim": "true"
20+
"userinfo.token.claim": "true"
21+
{{- end }}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{- if .Values.argocd.enabled }}
2+
apiVersion: v1.edp.epam.com/v1alpha1
3+
kind: KeycloakRealmGroup
4+
metadata:
5+
name: argocd-admins
6+
spec:
7+
name: ArgoCDAdmins
8+
realm: main
9+
{{- end }}

deploy-templates/values.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ global:
4040
# AWS Region, e.g. "eu-central-1"
4141
awsRegion:
4242

43+
argocd:
44+
# -- Enable ArgoCD integration
45+
enabled: false
46+
# -- ArgoCD URL in format schema://URI
47+
# @default -- `""` (defaults to https://argocd.{{ .Values.global.dnsWildCard }})
48+
url: ""
49+
4350
perf:
4451
enabled: "false"
4552

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Install Argo CD
2+
3+
Inspect the prerequisites and the main steps to perform for enabling Argo CD in EDP.
4+
5+
## Prerequisites
6+
7+
* [Keycloak is installed](./install-keycloak.md)
8+
* [EDP is installed](./install-edp.md)
9+
* Kubectl version 1.18.0 is installed. Please refer to the [Kubernetes official website](https://v1-18.docs.kubernetes.io/docs/setup/release/notes/) for details.
10+
* [Helm](https://helm.sh) version 3.6.0 is installed. Please refer to the [Helm page](https://github.com/helm/helm/releases/tag/v3.6.0) on GitHub for details.
11+
12+
## Installation
13+
14+
Argo CD enablement for EDP consists of two major steps:
15+
16+
* Argo CD integration with EDP (SSO enablement, codebase onboarding, etc.)
17+
* Argo CD installation
18+
19+
### Integrate With EDP
20+
21+
To enable Argo CD integration, ensure that the `argocd.enabled` flag [values.yaml](https://github.com/epam/edp-install/blob/master/deploy-templates/values.yaml) is set to `true`
22+
23+
### Install With Helm
24+
25+
Argo CD can be installed in many ways, please follow the [official documentation](https://argo-cd.readthedocs.io/en/stable/operator-manual/installation/) for more details.
26+
27+
Follow the steps below to install Argo CD using Helm:
28+
29+
* Check out the *values.yaml* file sample of the Argo CD customization, which is based on `HA mode without autoscaling`:
30+
31+
<details>
32+
<summary><b>View: values.yaml</b></summary>
33+
34+
```yaml
35+
redis-ha:
36+
enabled: true
37+
38+
controller:
39+
enableStatefulSet: true
40+
41+
server:
42+
replicas: 2
43+
extraArgs:
44+
- "--insecure"
45+
env:
46+
- name: ARGOCD_API_SERVER_REPLICAS
47+
value: '2'
48+
ingress:
49+
enabled: true
50+
hosts:
51+
- "argocd.{{ .Values.global.dnsWildCard }}"
52+
config:
53+
# required when SSO is enabled
54+
url: "https://argocd.{{ .Values.global.dnsWildCard }}"
55+
application.instanceLabelKey: argocd.argoproj.io/instance-edp
56+
oidc.config: |
57+
name: Keycloak
58+
issuer: https://{{ .Values.global.keycloakEndpoint }}/auth/realms/{{ .Values.global.edpName }}-main
59+
clientID: argocd
60+
clientSecret: $oidc.keycloak.clientSecret
61+
requestedScopes:
62+
- openid
63+
- profile
64+
- email
65+
- groups
66+
rbacConfig:
67+
# users may be still be able to login,
68+
# but will see no apps, projects, etc...
69+
policy.default: ''
70+
scopes: '[groups]'
71+
policy.csv: |
72+
# default global admins
73+
g, Argo CDAdmins, role:admin
74+
75+
configs:
76+
secret:
77+
extra:
78+
oidc.keycloak.clientSecret: "REPLACE"
79+
80+
repoServer:
81+
replicas: 2
82+
83+
# we use Keycloak so no DEX is required
84+
dex:
85+
enabled: false
86+
87+
# Disabled for multitenancy env with single instance deployment
88+
applicationSet:
89+
enabled: false
90+
```
91+
92+
</details>
93+
94+
Populate Argo CD values with the values from the EDP [values.yaml](https://github.com/epam/edp-install/blob/master/deploy-templates/values.yaml):
95+
96+
* .Values.global.dnsWildCard - EDP DNS WildCard
97+
* .Values.global.keycloakEndpoint - Keycloak Hostname
98+
* .Values.global.edpName - EDP name
99+
100+
* Run installation
101+
102+
```bash
103+
kubectl create ns argocd
104+
helm repo add argo https://argoproj.github.io/argo-helm
105+
helm install argocd argo/argo-cd -f values.yaml
106+
```
107+
108+
* Update `argocd-secret` secret (in argocd namespace) by providing correct keycloak client secret (`oidc.keycloak.clientSecret`) with value from the `keycloak-client-argocd-secret` secret in EDP namespace and restart the deployment:
109+
110+
```bash
111+
ARGOCD_CLIENT=$(kubectl -n <EDP_NAMESPACE> get secret keycloak-client-argocd-secret -o jsonpath='{.data.clientSecret}')
112+
kubectl -n argocd patch secret argocd-secret -p="{\"data\":{\"oidc.keycloak.clientSecret\": \"${ARGOCD_CLIENT}\"}}" -v=1
113+
kubectl -n argocd rollout restart deployment argocd-server
114+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ nav:
8989
- Set Up Kubernetes: operator-guide/kubernetes-cluster-settings.md
9090
- Set Up OpenShift: operator-guide/openshift-cluster-settings.md
9191
- Install EDP: operator-guide/install-edp.md
92+
- Install Argo CD: operator-guide/install-argocd.md
9293
- Configuration:
9394
- Add Other Code Language: operator-guide/add-other-code-language.md
9495
- Backup With Velero:

0 commit comments

Comments
 (0)