-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add prototypes in the init command
- Loading branch information
Showing
10 changed files
with
261 additions
and
8 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#@data/values-schema | ||
--- | ||
#@overlay/match-child-defaults missing_ok=True | ||
application: | ||
namespace: argocd |
14 changes: 14 additions & 0 deletions
14
internal/myks/assets/prototypes/argocd/vendir/base.ytt.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#@ load("@ytt:data", "data") | ||
--- | ||
apiVersion: vendir.k14s.io/v1alpha1 | ||
kind: Config | ||
directories: | ||
- path: ytt/argocd | ||
contents: | ||
- path: . | ||
git: | ||
url: #@ data.values.git.url | ||
ref: #@ data.values.git.version | ||
includePaths: | ||
- manifests/ha/install.yaml | ||
newRootPath: manifests/ha |
8 changes: 8 additions & 0 deletions
8
internal/myks/assets/prototypes/argocd/vendir/vendir-data.ytt.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#@data/values-schema | ||
--- | ||
git: | ||
#! WARNING: The order of the keys (alphabetical) is important for renovate. | ||
#! When changed, renovate won't be able to detect the new version. | ||
#! renovate: datasource=git-tags | ||
url: https://github.com/argoproj/argo-cd | ||
version: v2.7.3 |
109 changes: 109 additions & 0 deletions
109
internal/myks/assets/prototypes/argocd/ytt/argocd-vault-plugin.ytt.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#@ load("@ytt:data", "data") | ||
#@ load("@ytt:overlay", "overlay") | ||
#@ load("@ytt:yaml", "yaml") | ||
|
||
#@ cm = "cmp-plugin" | ||
#@ sa = "argocd-repo-server" | ||
#@ gcp_sa = data.values.application.gcpServiceAccountEmail | ||
|
||
|
||
#! Modify existing argocd-repo-server service account to use workload identity. | ||
#@overlay/match by=overlay.subset({"kind": "ServiceAccount", "metadata": {"name": sa}}) | ||
--- | ||
#@overlay/match-child-defaults missing_ok=True | ||
metadata: | ||
annotations: | ||
iam.gke.io/gcp-service-account: #@ gcp_sa | ||
|
||
#! The following overlay is used to add the argocd-vault-plugin to ArgoCD. | ||
#! It is done by patching the argocd-repo-server deployment in the following way: | ||
#! 1. Mount cmp-plugin configmap, which contains the argocd-vault-plugin configuration. | ||
#! 2. Add the argocd-vault-plugin container, which will run the argocd-vault-plugin binary. | ||
#! Additional volumes are mounted to make it work with ArgoCD. | ||
#! 3. Add the download-tools initContainer to download the argocd-vault-plugin binary, | ||
#! which is shared with the argocd-vault-plugin container via the download-tools emptyDir volume. | ||
#@overlay/match by=overlay.subset({"kind": "Deployment", "metadata": {"name": "argocd-repo-server"}}) | ||
--- | ||
#@overlay/match-child-defaults missing_ok=True | ||
spec: | ||
template: | ||
spec: | ||
serviceAccountName: #@ sa | ||
nodeSelector: | ||
iam.gke.io/gke-metadata-server-enabled: "true" | ||
volumes: | ||
- name: cmp-plugin | ||
configMap: | ||
name: #@ cm | ||
- name: custom-tools | ||
emptyDir: {} | ||
- name: cmp-tmp | ||
emptyDir: {} | ||
initContainers: | ||
- name: download-tools | ||
image: registry.access.redhat.com/ubi8 | ||
env: | ||
- name: AVP_VERSION | ||
value: 1.14.0 | ||
command: [sh, -c] | ||
args: | ||
- ' | ||
curl https://github.com/argoproj-labs/argocd-vault-plugin/releases/download/v$(AVP_VERSION)/argocd-vault-plugin_$(AVP_VERSION)_linux_amd64 | ||
--location | ||
--output /custom-tools/argocd-vault-plugin | ||
&& chmod 0755 /custom-tools/argocd-vault-plugin' | ||
volumeMounts: | ||
- name: custom-tools | ||
mountPath: /custom-tools | ||
containers: | ||
- name: argocd-vault-plugin | ||
command: [/var/run/argocd/argocd-cmp-server] | ||
image: registry.access.redhat.com/ubi8 | ||
securityContext: | ||
runAsNonRoot: true | ||
runAsUser: 999 | ||
volumeMounts: | ||
- name: var-files | ||
mountPath: /var/run/argocd | ||
- name: plugins | ||
mountPath: /home/argocd/cmp-server/plugins | ||
- name: cmp-tmp | ||
mountPath: /tmp | ||
|
||
#! Register plugins into sidecar | ||
- name: cmp-plugin | ||
mountPath: /home/argocd/cmp-server/config/plugin.yaml | ||
subPath: avp.yaml | ||
|
||
#! Important: Mount tools into $PATH | ||
- name: custom-tools | ||
mountPath: /usr/local/bin/argocd-vault-plugin | ||
subPath: argocd-vault-plugin | ||
|
||
#@ def avp_plugin_config(): | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: ConfigManagementPlugin | ||
metadata: | ||
name: argocd-vault-plugin | ||
spec: | ||
version: v1.0.0 | ||
generate: | ||
command: ['bash', '-c'] | ||
args: | ||
- |- | ||
export AVP_TYPE=gcpsecretmanager | ||
find . \ | ||
-regextype egrep \ | ||
-iregex '.*\.(yaml|yml)' \ | ||
-printf '---\n' \ | ||
-exec cat {} \; \ | ||
| argocd-vault-plugin generate - | ||
#@ end | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: #@ cm | ||
data: | ||
avp.yaml: #@ yaml.encode(avp_plugin_config()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#@ load("@ytt:data", "data") | ||
#@ load("@ytt:overlay", "overlay") | ||
|
||
#@ ns = data.values.application.namespace | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: #@ ns | ||
|
||
#@overlay/match by=overlay.all, expects="1+" | ||
--- | ||
metadata: | ||
#@overlay/match missing_ok=True | ||
namespace: #@ ns |
13 changes: 13 additions & 0 deletions
13
internal/myks/assets/prototypes/httpbingo/vendir/base.ytt.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#@ load("@ytt:data", "data") | ||
--- | ||
apiVersion: vendir.k14s.io/v1alpha1 | ||
kind: Config | ||
directories: | ||
- path: #@ "charts/" + data.values.chart.name | ||
contents: | ||
- path: . | ||
helmChart: | ||
name: #@ data.values.chart.name | ||
version: #@ data.values.chart.version | ||
repository: | ||
url: #@ data.values.chart.url |
10 changes: 10 additions & 0 deletions
10
internal/myks/assets/prototypes/httpbingo/vendir/vendir-data.ytt.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#@data/values-schema | ||
--- | ||
chart: | ||
#! WARNING: The order of the keys (alphabetical) is important for renovate. | ||
#! When changed, renovate won't be able to detect the new version. | ||
#! See renovate.json for more details. | ||
#! renovate: datasource=helm | ||
name: httpbingo | ||
url: https://estahn.github.io/charts | ||
version: 0.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters