Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Commit 81dbfa4

Browse files
feat(cmp-subst): performance improvements (#37)
* feat: lookup env ARGOCD_APP_NAME on empty secret name * docs: simple installation values * fix: drop subshell call for plugin
1 parent 0c7127c commit 81dbfa4

File tree

4 files changed

+76
-5
lines changed

4 files changed

+76
-5
lines changed

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,66 @@ Which will simply build the kustomize.
2828

2929
### ArgoCD
3030

31+
Install it with the [ArgoCD community chart](https://github.com/argoproj/argo-helm/tree/main/charts/argo-cd). These Values should work:
32+
33+
34+
```yaml
35+
...
36+
repoServer:
37+
enabled: true
38+
clusterAdminAccess:
39+
enabled: true
40+
containerSecurityContext:
41+
allowPrivilegeEscalation: false
42+
capabilities:
43+
drop:
44+
- all
45+
readOnlyRootFilesystem: true
46+
runAsUser: 1001
47+
runAsGroup: 1001
48+
volumes:
49+
- emptyDir: {}
50+
name: subst-tmp
51+
- emptyDir: {}
52+
name: subst-kubeconfig
53+
extraContainers:
54+
- name: cmp-subst
55+
args: [/var/run/argocd/argocd-cmp-server]
56+
image: ghcr.io/buttahtoast/subst-cmp:v0.3.0-alpha1
57+
imagePullPolicy: Always
58+
securityContext:
59+
allowPrivilegeEscalation: false
60+
capabilities:
61+
drop:
62+
- all
63+
readOnlyRootFilesystem: true
64+
runAsUser: 1001
65+
runAsGroup: 1001
66+
resources:
67+
limits:
68+
cpu: 500m
69+
memory: 512Mi
70+
requests:
71+
cpu: 100m
72+
memory: 128Mi
73+
volumeMounts:
74+
- mountPath: /var/run/argocd
75+
name: var-files
76+
- mountPath: /home/argocd/cmp-server/plugins
77+
name: plugins
78+
# Starting with v2.4, do NOT mount the same tmp volume as the repo-server container. The filesystem separation helps
79+
# mitigate path traversal attacks.
80+
- mountPath: /tmp
81+
name: subst-tmp
82+
- mountPath: /etc/kubernetes/
83+
name: subst-kubeconfig
84+
...
85+
```
86+
87+
Change version accordingly.
88+
89+
90+
3191

3292

3393

argocd-cmp/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
FROM bash:5
3-
ENV KUBECONFIG=/etc/kubernetes/kubeconfig
3+
ENV ARGOCD_EXEC_TIMEOUT=90s
44
COPY subst /subst
55
COPY argocd-cmp/cmp.yaml /home/argocd/cmp-server/config/plugin.yaml
66
COPY argocd-cmp/entrypoint.sh /entrypoint.sh

argocd-cmp/cmp.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ spec:
1111
fileName: ./kustomization.yaml
1212
generate:
1313
command:
14-
- bash
15-
- -c
16-
- |
17-
/subst render "." --secret-name "${ARGOCD_APP_NAME}" --secret-namespace "argocd" --env-regex "^ARGOCD_ENV_.*$" --must-decrypt --kubeconfig "/etc/kubernetes/kubeconfig"
14+
- /subst
15+
args:
16+
- render
17+
- "."
18+
- --secret-namespace
19+
- "argocd"
20+
- --env-regex
21+
- "^ARGOCD_ENV_.*$"
22+
- --must-decrypt
23+
- --kubeconfig
24+
- "/etc/kubernetes/kubeconfig"

pkg/config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ func LoadConfiguration(cfgFile string, cmd *cobra.Command, directory string) (*C
7777
// Root Directory
7878
cfg.RootDirectory = directory
7979

80+
if cfg.SecretName == "" {
81+
cfg.SecretName = os.Getenv("ARGOCD_APP_NAME")
82+
}
83+
8084
if cfg.SecretName != "" {
8185
regex := regexp.MustCompile(`[^a-zA-Z0-9]+`)
8286
cfg.SecretName = regex.ReplaceAllString(cfg.SecretName, "-")

0 commit comments

Comments
 (0)