diff --git a/k8s/infra/argocd/templates/applicationset.yaml b/k8s/infra/argocd/templates/applicationset.yaml new file mode 100644 index 0000000..e8d87a0 --- /dev/null +++ b/k8s/infra/argocd/templates/applicationset.yaml @@ -0,0 +1,52 @@ +# --- +# apiVersion: argoproj.io/v1alpha1 +# kind: Application +# metadata: +# name: "{{ .Release.Name }}" +# namespace: "{{ .Release.Namespace }}" +# spec: +# project: default +# source: +# repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git" +# targetRevision: "{{ .Values.selfapp.commit }}" +# path: k8s/infra/argocd +# helm: +# parameters: +# - name: "selfapp.sshkey" +# value: {{ .Values.selfapp.sshkey | quote }} +# destination: +# server: https://kubernetes.default.svc +# namespace: "{{ .Release.Namespace }}" +# # syncPolicy: +# # automated: +# # prune: false +# # selfHeal: true +# # allowEmpty: true +--- +apiVersion: argoproj.io/v1alpha1 +kind: ApplicationSet +metadata: + name: "infra" + namespace: "{{ .Release.Namespace }}" +spec: + generators: + - git: + repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git" + targetRevision: "{{ .Values.selfapp.commit }}" + directories: + - path: k8s/infra/* + template: + metadata: + name: '{{path.basename}}' + spec: + project: "default" + source: + repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git" + targetRevision: "{{ .Values.selfapp.commit }}" + path: '{{path}}' + destination: + server: https://kubernetes.default.svc + namespace: '{{path.basename}}' + syncPolicy: + syncOptions: + - CreateNamespace=true \ No newline at end of file diff --git a/k8s/infra/argocd/templates/ingress.yaml b/k8s/infra/argocd/templates/ingress.yaml index b67c71e..cbbdfdb 100644 --- a/k8s/infra/argocd/templates/ingress.yaml +++ b/k8s/infra/argocd/templates/ingress.yaml @@ -14,6 +14,16 @@ spec: services: - name: argocd-server port: 80 + passHostHeader: true + responseForwarding: + flushInterval: 1ms + scheme: https + - name: argocd-server + port: 443 + passHostHeader: true + responseForwarding: + flushInterval: 1ms + scheme: https - kind: Rule match: {{ .Values.selfapp.traefikRule }} && Headers(`Content-Type`, `application/grpc`) priority: 11 diff --git a/k8s/infra/argocd/templates/projects.yaml b/k8s/infra/argocd/templates/projects.yaml new file mode 100644 index 0000000..ca78e36 --- /dev/null +++ b/k8s/infra/argocd/templates/projects.yaml @@ -0,0 +1,14 @@ +--- +apiVersion: argoproj.io/v1alpha1 +kind: AppProject +metadata: + name: infra + namespace: "{{ .Release.Namespace }}" + finalizers: + - resources-finalizer.argocd.argoproj.io +spec: + description: Infrastructure + sourceRepos: + - '*' + destinations: + - server: https://kubernetes.default.svc diff --git a/k8s/infra/argocd/templates/self-app.yaml b/k8s/infra/argocd/templates/self-app.yaml deleted file mode 100644 index 5634ee8..0000000 --- a/k8s/infra/argocd/templates/self-app.yaml +++ /dev/null @@ -1,25 +0,0 @@ ---- -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: "{{ .Release.Name }}" - namespace: "{{ .Release.Namespace }}" -spec: - project: default - source: - repoURL: "git@github.com:{{ .Values.selfapp.repo }}.git" - targetRevision: "{{ .Values.selfapp.commit }}" - path: k8s/infra/argocd - helm: - parameters: - - name: "selfapp.sshkey" - value: {{ .Values.selfapp.sshkey | quote }} - destination: - server: https://kubernetes.default.svc - namespace: "{{ .Release.Namespace }}" - # syncPolicy: - # automated: - # prune: false - # selfHeal: true - # allowEmpty: true - \ No newline at end of file diff --git a/k8s/infra/argocd/values.yaml b/k8s/infra/argocd/values.yaml index acd6d0b..948092d 100644 --- a/k8s/infra/argocd/values.yaml +++ b/k8s/infra/argocd/values.yaml @@ -7,4 +7,5 @@ selfapp: commit: "stable" repo: "asosnovsky/homelab" sshkey: "" - traefikRule: Host(`argocd.sosnovsky.ca`) + # traefikRule: Host(`argocd.sosnovsky.ca`) + traefikRule: Path(`/argo`) diff --git a/k8s/infra/misc/.helmignore b/k8s/infra/misc/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/k8s/infra/misc/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/k8s/infra/misc/Chart.yaml b/k8s/infra/misc/Chart.yaml new file mode 100644 index 0000000..c2d6855 --- /dev/null +++ b/k8s/infra/misc/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: misc +description: A Helm chart for Kubernetes +type: application +version: 0.1.0 diff --git a/k8s/infra/misc/templates/traefik.yaml b/k8s/infra/misc/templates/traefik.yaml new file mode 100644 index 0000000..6946259 --- /dev/null +++ b/k8s/infra/misc/templates/traefik.yaml @@ -0,0 +1,38 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: traefik-dashboard + namespace: kube-system + labels: + app.kubernetes.io/instance: traefik + app.kubernetes.io/name: traefik-dashboard +spec: + type: ClusterIP + ports: + - name: traefik + port: 9000 + targetPort: traefik + protocol: TCP + selector: + app.kubernetes.io/instance: traefik + app.kubernetes.io/name: traefik +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: traefik-ingress + namespace: kube-system + annotations: + kubernetes.io/ingress.class: traefik +spec: + rules: + - http: + paths: + - path: /traefik + pathType: Prefix + backend: + service: + name: traefik-dashboard + port: + number: 9000 \ No newline at end of file diff --git a/k8s/infra/misc/values.yaml b/k8s/infra/misc/values.yaml new file mode 100644 index 0000000..e69de29