diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b4a34c8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +\#*# +*~ diff --git a/argo1/Chart.lock b/argo1/Chart.lock new file mode 100644 index 0000000..ce8a73d --- /dev/null +++ b/argo1/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: argo-cd + repository: https://argoproj.github.io/argo-helm + version: 5.29.1 +- name: argocd-apps + repository: https://argoproj.github.io/argo-helm + version: 0.0.9 +digest: sha256:61b3270da67eb8bc6986a8cda0b41b3319dbb07df1295d0ca8cfb5cd31ccc837 +generated: "2023-04-22T13:16:58.406086-05:00" diff --git a/argo1/Chart.yaml b/argo1/Chart.yaml new file mode 100644 index 0000000..3c864d8 --- /dev/null +++ b/argo1/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: argo1 +description: A Helm chart for your management ArgoCD of your management ArgoCD + +type: application +version: 0.1.0 +appVersion: &argoVersion 5.29.1 + +argoRepo: &argoRepo "https://argoproj.github.io/argo-helm" +argoChart: &argoChart argo-cd +dependencies: +- name: *argoChart + version: *argoVersion + repository: *argoRepo +#- name: argo-cd +# version: "5.29.1" +# repository: "https://argoproj.github.io/argo-helm" +#- name: argocd-apps +# version: 0.0.9 +# repository: "https://argoproj.github.io/argo-helm" diff --git a/argo1/README.md b/argo1/README.md new file mode 100644 index 0000000..e69de29 diff --git a/argo1/argo1 b/argo1/argo1 new file mode 160000 index 0000000..b6fe7dc --- /dev/null +++ b/argo1/argo1 @@ -0,0 +1 @@ +Subproject commit b6fe7dcf5c3104cec26db52bde711a4537d58bb8 diff --git a/argo1/argo1-bad.yaml b/argo1/argo1-bad.yaml new file mode 100644 index 0000000..4026654 --- /dev/null +++ b/argo1/argo1-bad.yaml @@ -0,0 +1,26 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo1 + namespace: argocd +spec: + destination: + name: in-cluster + namespace: argocd + server: https://kubernetes.default.svc + project: default + source: + path: . + repoURL: https://git.strudelline.net/infra/repo1 + targetRevision: HEAD + syncPolicy: + automated: + selfHeal: true + retry: + backoff: + duration: 5s + factor: 2 + maxDuration: 3m0s + limit: 10 + syncOptions: + - CreateNamespace=true diff --git a/argo1/argo2-good.yaml b/argo1/argo2-good.yaml new file mode 100644 index 0000000..50a4b1e --- /dev/null +++ b/argo1/argo2-good.yaml @@ -0,0 +1,25 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: argo2 + namespace: argocd +spec: + destination: + namespace: argocd + server: https://kubernetes.default.svc + project: default + source: + path: . + repoURL: https://git.strudelline.net/infra/argo1 + targetRevision: main + syncPolicy: + automated: + selfHeal: true + retry: + backoff: + duration: 5s + factor: 2 + maxDuration: 3m0s + limit: 10 + syncOptions: + - CreateNamespace=true diff --git a/argo1/blah.yaml b/argo1/blah.yaml new file mode 100644 index 0000000..8ae76ec --- /dev/null +++ b/argo1/blah.yaml @@ -0,0 +1,19 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: concourse + namespace: argocd +spec: + project: default + source: + repoURL: 'https://concourse-charts.storage.googleapis.com/' + targetRevision: 17.1.1 + helm: + values: |- + clusterName: Concourse + secrets: + create: true + chart: concourse + destination: + namespace: concourse + name: in-cluster diff --git a/argo1/charts/argo-cd-5.29.1.tgz b/argo1/charts/argo-cd-5.29.1.tgz new file mode 100644 index 0000000..ce12a8a Binary files /dev/null and b/argo1/charts/argo-cd-5.29.1.tgz differ diff --git a/argo1/charts/argocd-apps-0.0.9.tgz b/argo1/charts/argocd-apps-0.0.9.tgz new file mode 100644 index 0000000..fc000bd Binary files /dev/null and b/argo1/charts/argocd-apps-0.0.9.tgz differ diff --git a/argo1/deploy.sh b/argo1/deploy.sh new file mode 100644 index 0000000..ac91b85 --- /dev/null +++ b/argo1/deploy.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +cd "$(dirname "$0")" + +TARGETNS="argocd" +ORIGNS="$(kubectl config view --minify -o jsonpath='{..namespace}')" + +( + set -e + jq -n --args '{"apiVersion":"v1","kind":"Namespace","metadata":{"name": $ARGS.positional[0]}}' "$TARGETNS" | kubectl apply -f - + + [ x"$TARGETNS" != x"$ORIGNS" ] && kubectl config set-context --current --namespace $TARGETNS + helm upgrade -i --create-namespace -n $TARGETNS argo1 argo/argo-cd -f values.yaml + kubectl wait -n $TARGETNS deploy/argocd-server --for=condition=available + #kubectl apply -f application.yaml + # + argocd --core app sync argocd +) + +[ x"$TARGETNS" != x"$ORIGNS" ] && kubectl config set-context --current --namespace "$ORIGNS" diff --git a/argo1/infra.yaml b/argo1/infra.yaml new file mode 100644 index 0000000..876e5c1 --- /dev/null +++ b/argo1/infra.yaml @@ -0,0 +1,21 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: local-git-argo1 + namespace: argocd + labels: + argocd.argoproj.io/secret-type: repository +stringData: + type: git + url: git@github.com/jamesandariese/argo1 + project: default + sshPrivateKey: | + -----BEGIN OPENSSH PRIVATE KEY----- + b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW + QyNTUxOQAAACCzR5/gYPwL+YJw+N6Tip03tLH3257Ysc3TJqfymV7PpwAAALAezw3sHs8N + 7AAAAAtzc2gtZWQyNTUxOQAAACCzR5/gYPwL+YJw+N6Tip03tLH3257Ysc3TJqfymV7Ppw + AAAEBohw71h5SaZ6zd3c7MSUUNlWoI40LK+D8wxk1BcCeUybNHn+Bg/Av5gnD43pOKnTe0 + sffbntixzdMmp/KZXs+nAAAAKGphbWVzQEphbWVzcy1NQlAuY2FzY2FkZS5zdHJ1ZGVsbG + luZS5uZXQBAgMEBQ== + -----END OPENSSH PRIVATE KEY----- diff --git a/argo1/install-crds.sh b/argo1/install-crds.sh new file mode 100644 index 0000000..6388b27 --- /dev/null +++ b/argo1/install-crds.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +cd "$(dirname "$0")" + +( + set -e + eval "$(yq -o json . Chart.yaml | jq -r '.dependencies[0] | @sh "CHART=\(.name)\nVERSION=\(.version)\nREPO=\(.repository)"')" + helm template argocd-crds "$CHART" --repo "$REPO" --version "$VERSION" | yq 'select(.kind == "CustomResourceDefinition")' | kubectl apply -f - +) + +RC=$? +if [ $RC -ne 0 ];then + 1>&2 echo "exiting due to error" + exit $RC +fi diff --git a/argo1/poop/_helpers.tpl b/argo1/poop/_helpers.tpl new file mode 100644 index 0000000..101ad8a --- /dev/null +++ b/argo1/poop/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "argo1.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "argo1.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "argo1.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "argo1.labels" -}} +helm.sh/chart: {{ include "argo1.chart" . }} +{{ include "argo1.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "argo1.selectorLabels" -}} +app.kubernetes.io/name: {{ include "argo1.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "argo1.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "argo1.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/argo1/poop/argocd.yaml b/argo1/poop/argocd.yaml new file mode 100644 index 0000000..960ec40 --- /dev/null +++ b/argo1/poop/argocd.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: "{{ .Release.Name }}" + namespace: "{{ .Release.Namespace }}" +spec: + project: default + source: + repoURL: "{{ .Chart.dependencies[0].repository }}" + targetRevision: "{{ .Chart.dependencies[0].version }}" + chart: "{{ .Chart.dependencies[0].name }}" + helm: + values: | + {{ .Values.argocd.values | nindent 12 }} + destination: + namespace: "{{ .Values.argocd.namespace }}" + name: in-cluster diff --git a/argo1/poop/sshkey b/argo1/poop/sshkey new file mode 100644 index 0000000..01784e1 --- /dev/null +++ b/argo1/poop/sshkey @@ -0,0 +1,8 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACCzR5/gYPwL+YJw+N6Tip03tLH3257Ysc3TJqfymV7PpwAAALAezw3sHs8N +7AAAAAtzc2gtZWQyNTUxOQAAACCzR5/gYPwL+YJw+N6Tip03tLH3257Ysc3TJqfymV7Ppw +AAAEBohw71h5SaZ6zd3c7MSUUNlWoI40LK+D8wxk1BcCeUybNHn+Bg/Av5gnD43pOKnTe0 +sffbntixzdMmp/KZXs+nAAAAKGphbWVzQEphbWVzcy1NQlAuY2FzY2FkZS5zdHJ1ZGVsbG +luZS5uZXQBAgMEBQ== +-----END OPENSSH PRIVATE KEY----- diff --git a/argo1/poop/sshkey.pub b/argo1/poop/sshkey.pub new file mode 100644 index 0000000..4f31434 --- /dev/null +++ b/argo1/poop/sshkey.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILNHn+Bg/Av5gnD43pOKnTe0sffbntixzdMmp/KZXs+n james@Jamess-MBP.cascade.strudelline.net diff --git a/argo1/secrets.yaml b/argo1/secrets.yaml new file mode 100644 index 0000000..8195d42 --- /dev/null +++ b/argo1/secrets.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: local-git-creds + namespace: argocd + labels: + argocd.argoproj.io/secret-type: repo-creds +stringData: + type: git + url: https://git.strudelline.net/ + password: JwCJznZZMJU4se + username: svc-argocd + project: default + diff --git a/argo1/templates.back/argocd.yaml b/argo1/templates.back/argocd.yaml new file mode 100644 index 0000000..6cb93f1 --- /dev/null +++ b/argo1/templates.back/argocd.yaml @@ -0,0 +1,18 @@ +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: "{{ .Release.Name }}" + namespace: "{{ .Release.Namespace }}" +spec: + project: default + source: + repoURL: "{{ (index .Chart.Dependencies 0).Repository }}" + targetRevision: "{{ (index .Chart.Dependencies 0).Version }}" + chart: "{{ (index .Chart.Dependencies 0).Name }}" + helm: + values: | + {{ (index .Values "argo-cd") | toYaml | nindent 12 }} + destination: + namespace: "{{ .Release.Namespace }}" + name: in-cluster diff --git a/argo1/templates/self.yaml b/argo1/templates/self.yaml new file mode 100644 index 0000000..1ffac32 --- /dev/null +++ b/argo1/templates/self.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: "{{ .Release.Name }}" + namespace: "{{ .Release.Namespace }}" +spec: + project: default + source: +{{ .Values.bootstrap.source | toYaml | nindent 4 }} + destination: + namespace: "{{ .Release.Namespace }}" + name: in-cluster diff --git a/argo1/values.yaml b/argo1/values.yaml new file mode 100644 index 0000000..bdf01c0 --- /dev/null +++ b/argo1/values.yaml @@ -0,0 +1,57 @@ +bootstrap: + source: + repoURL: "git@github.com/jamesandariese/argo1" + targetRevision: "main" + path: . + +argo-cd: + crds: + install: false + + configs: + params: + "server.insecure": "true" + + controller: + replicas: 2 + + server: + ingress: + enabled: true + hosts: &hhosts + - argocd.strudelline.net + tls: + - hosts: *hhosts + secretName: wildcard-tls + ingressGrpc: + enabled: true + hosts: &ghosts + - grpc-argocd.strudelline.net + tls: + - hosts: *ghosts + secretName: wildcard-tls +#argocd-apps: +# applications: +# - name: argo1 +# destination: +# name: in-cluster +# namespace: argocd +# source: +# path: . +# repoURL: 'https://git.strudelline.net/infra/argo1' +# targetRevision: main +# sources: [] +# project: default +# syncPolicy: +# automated: +# prune: false +# selfHeal: true +# syncOptions: +# - CreateNamespace=true +# retry: +# limit: 10 +# backoff: +# duration: 5s +# maxDuration: 3m0s +# factor: 2 + diff --git a/argo1/x.yaml b/argo1/x.yaml new file mode 100644 index 0000000..c03d268 --- /dev/null +++ b/argo1/x.yaml @@ -0,0 +1,19 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + annotations: + meta.helm.sh/release-name: argo1 + meta.helm.sh/release-namespace: argocd + labels: + app.kubernetes.io/managed-by: Helm + name: argo1 + namespace: argocd +spec: + destination: + namespace: argocd + server: https://kubernetes.default.svc + project: default + source: + path: . + repoURL: https://git.strudelline.net/infra/repo1 + targetRevision: HEAD