feat: move kubernetes dir into templates to support jinja2 across all files (#831)
This commit is contained in:
1 parent
7b0a154fed
commit
fe41cf6ea5
134 files changed
+192
-177
No files matched your search
@@ -0,0 +1,15 @@
|
||||
---
|
||||
originRequest:
|
||||
http2Origin: true
|
||||
|
||||
# https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/configuration/ingress
|
||||
ingress:
|
||||
- hostname: "${SECRET_DOMAIN}"
|
||||
service: https://ingress-nginx-controller.networking.svc.cluster.local:443
|
||||
originRequest:
|
||||
originServerName: "ingress.${SECRET_DOMAIN}"
|
||||
- hostname: "*.${SECRET_DOMAIN}"
|
||||
service: https://ingress-nginx-controller.networking.svc.cluster.local:443
|
||||
originRequest:
|
||||
originServerName: "ingress.${SECRET_DOMAIN}"
|
||||
- service: http_status:404
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
apiVersion: externaldns.k8s.io/v1alpha1
|
||||
kind: DNSEndpoint
|
||||
metadata:
|
||||
name: cloudflared
|
||||
namespace: networking
|
||||
annotations:
|
||||
external-dns.alpha.kubernetes.io/target: "ingress.${SECRET_DOMAIN}"
|
||||
spec:
|
||||
endpoints:
|
||||
- dnsName: "ingress.${SECRET_DOMAIN}"
|
||||
recordType: CNAME
|
||||
targets: ["${SECRET_CLOUDFLARE_TUNNEL_ID}.cfargotunnel.com"]
|
||||
@@ -0,0 +1,102 @@
|
||||
---
|
||||
apiVersion: helm.toolkit.fluxcd.io/v2beta1
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: cloudflared
|
||||
namespace: networking
|
||||
spec:
|
||||
interval: 30m
|
||||
chart:
|
||||
spec:
|
||||
chart: app-template
|
||||
version: 1.5.1
|
||||
sourceRef:
|
||||
kind: HelmRepository
|
||||
name: bjw-s
|
||||
namespace: flux-system
|
||||
maxHistory: 2
|
||||
install:
|
||||
createNamespace: true
|
||||
remediation:
|
||||
retries: 3
|
||||
upgrade:
|
||||
cleanupOnFail: true
|
||||
remediation:
|
||||
retries: 3
|
||||
uninstall:
|
||||
keepHistory: false
|
||||
values:
|
||||
controller:
|
||||
replicas: 1
|
||||
strategy: RollingUpdate
|
||||
annotations:
|
||||
reloader.stakater.com/auto: "true"
|
||||
image:
|
||||
repository: docker.io/cloudflare/cloudflared
|
||||
tag: 2023.6.1
|
||||
env:
|
||||
NO_AUTOUPDATE: "true"
|
||||
TUNNEL_CRED_FILE: /etc/cloudflared/creds/credentials.json
|
||||
TUNNEL_METRICS: 0.0.0.0:8080
|
||||
TUNNEL_TRANSPORT_PROTOCOL: auto
|
||||
TUNNEL_ID:
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: cloudflared-secret
|
||||
key: TUNNEL_ID
|
||||
args:
|
||||
- tunnel
|
||||
- --config
|
||||
- /etc/cloudflared/config/config.yaml
|
||||
- run
|
||||
- "$(TUNNEL_ID)"
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
port: 8080
|
||||
serviceMonitor:
|
||||
main:
|
||||
enabled: true
|
||||
endpoints:
|
||||
- port: http
|
||||
scheme: http
|
||||
path: /metrics
|
||||
interval: 1m
|
||||
scrapeTimeout: 30s
|
||||
probes:
|
||||
liveness: &probes
|
||||
enabled: true
|
||||
custom: true
|
||||
spec:
|
||||
httpGet:
|
||||
path: /ready
|
||||
port: http
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 1
|
||||
failureThreshold: 3
|
||||
readiness: *probes
|
||||
startup:
|
||||
enabled: false
|
||||
persistence:
|
||||
config:
|
||||
enabled: true
|
||||
type: configMap
|
||||
name: cloudflared-configmap
|
||||
subPath: config.yaml
|
||||
mountPath: /etc/cloudflared/config/config.yaml
|
||||
readOnly: true
|
||||
creds:
|
||||
enabled: true
|
||||
type: secret
|
||||
name: cloudflared-secret
|
||||
subPath: credentials.json
|
||||
mountPath: /etc/cloudflared/creds/credentials.json
|
||||
readOnly: true
|
||||
resources:
|
||||
requests:
|
||||
cpu: 5m
|
||||
memory: 10Mi
|
||||
limits:
|
||||
memory: 256Mi
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: networking
|
||||
resources:
|
||||
- ./dnsendpoint.yaml
|
||||
- ./secret.sops.yaml
|
||||
- ./helmrelease.yaml
|
||||
configMapGenerator:
|
||||
- name: cloudflared-configmap
|
||||
files:
|
||||
- ./configs/config.yaml
|
||||
generatorOptions:
|
||||
disableNameSuffixHash: true
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: cloudflared-secret
|
||||
namespace: networking
|
||||
stringData:
|
||||
TUNNEL_ID: "{{ bootstrap_cloudflare_tunnel_id }}"
|
||||
credentials.json: |
|
||||
{
|
||||
"AccountTag": "{{ bootstrap_cloudflare_account_tag }}",
|
||||
"TunnelSecret": "{{ bootstrap_cloudflare_tunnel_secret }}",
|
||||
"TunnelID": "{{ bootstrap_cloudflare_tunnel_id }}"
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||
kind: Kustomization
|
||||
metadata:
|
||||
name: cluster-apps-cloudflared
|
||||
namespace: flux-system
|
||||
spec:
|
||||
dependsOn:
|
||||
- name: cluster-apps-external-dns
|
||||
path: ./kubernetes/apps/networking/cloudflared/app
|
||||
prune: true
|
||||
sourceRef:
|
||||
kind: GitRepository
|
||||
name: home-kubernetes
|
||||
wait: false # no flux ks dependents
|
||||
interval: 30m
|
||||
retryInterval: 1m
|
||||
timeout: 5m
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.5.0
|
||||
api-approved.kubernetes.io: "https://github.com/kubernetes-sigs/external-dns/pull/2007"
|
||||
creationTimestamp: null
|
||||
name: dnsendpoints.externaldns.k8s.io
|
||||
spec:
|
||||
group: externaldns.k8s.io
|
||||
names:
|
||||
kind: DNSEndpoint
|
||||
listKind: DNSEndpointList
|
||||
plural: dnsendpoints
|
||||
singular: dnsendpoint
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
properties:
|
||||
apiVersion:
|
||||
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
|
||||
type: string
|
||||
kind:
|
||||
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
spec:
|
||||
description: DNSEndpointSpec defines the desired state of DNSEndpoint
|
||||
properties:
|
||||
endpoints:
|
||||
items:
|
||||
description: Endpoint is a high-level way of a connection between a service and an IP
|
||||
properties:
|
||||
dnsName:
|
||||
description: The hostname of the DNS record
|
||||
type: string
|
||||
labels:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: Labels stores labels defined for the Endpoint
|
||||
type: object
|
||||
providerSpecific:
|
||||
description: ProviderSpecific stores provider specific config
|
||||
items:
|
||||
description: ProviderSpecificProperty holds the name and value of a configuration which is specific to individual DNS providers
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
recordTTL:
|
||||
description: TTL for the record
|
||||
format: int64
|
||||
type: integer
|
||||
recordType:
|
||||
description: RecordType type of record, e.g. CNAME, A, SRV, TXT etc
|
||||
type: string
|
||||
setIdentifier:
|
||||
description: Identifier to distinguish multiple records with the same name and type (e.g. Route53 records with routing policies other than 'simple')
|
||||
type: string
|
||||
targets:
|
||||
description: The targets the DNS record points to
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
type: array
|
||||
type: object
|
||||
status:
|
||||
description: DNSEndpointStatus defines the observed state of DNSEndpoint
|
||||
properties:
|
||||
observedGeneration:
|
||||
description: The generation observed by the external-dns controller.
|
||||
format: int64
|
||||
type: integer
|
||||
type: object
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
status:
|
||||
acceptedNames:
|
||||
kind: ""
|
||||
plural: ""
|
||||
conditions: []
|
||||
storedVersions: []
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
apiVersion: helm.toolkit.fluxcd.io/v2beta1
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: &app external-dns
|
||||
namespace: networking
|
||||
spec:
|
||||
interval: 30m
|
||||
chart:
|
||||
spec:
|
||||
chart: external-dns
|
||||
version: 1.13.0
|
||||
sourceRef:
|
||||
kind: HelmRepository
|
||||
name: external-dns
|
||||
namespace: flux-system
|
||||
maxHistory: 2
|
||||
install:
|
||||
createNamespace: true
|
||||
remediation:
|
||||
retries: 3
|
||||
upgrade:
|
||||
cleanupOnFail: true
|
||||
remediation:
|
||||
retries: 3
|
||||
uninstall:
|
||||
keepHistory: false
|
||||
values:
|
||||
fullnameOverride: *app
|
||||
provider: cloudflare
|
||||
env:
|
||||
- name: CF_API_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: external-dns-secret
|
||||
key: api-token
|
||||
extraArgs:
|
||||
- --annotation-filter=external-dns.alpha.kubernetes.io/target
|
||||
- --cloudflare-proxied
|
||||
- --crd-source-apiversion=externaldns.k8s.io/v1alpha1
|
||||
- --crd-source-kind=DNSEndpoint
|
||||
policy: sync
|
||||
sources: ["crd", "ingress"]
|
||||
txtPrefix: k8s.
|
||||
txtOwnerId: default
|
||||
domainFilters: ["${SECRET_DOMAIN}"]
|
||||
serviceMonitor:
|
||||
enabled: true
|
||||
podAnnotations:
|
||||
secret.reloader.stakater.com/reload: external-dns-secret
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: networking
|
||||
resources:
|
||||
- ./dnsendpoint-crd.yaml
|
||||
- ./secret.sops.yaml
|
||||
- ./helmrelease.yaml
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: external-dns-secret
|
||||
namespace: networking
|
||||
stringData:
|
||||
api-token: "{{ bootstrap_cloudflare_token }}"
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||
kind: Kustomization
|
||||
metadata:
|
||||
name: cluster-apps-external-dns
|
||||
namespace: flux-system
|
||||
spec:
|
||||
path: ./kubernetes/apps/networking/external-dns/app
|
||||
prune: true
|
||||
sourceRef:
|
||||
kind: GitRepository
|
||||
name: home-kubernetes
|
||||
wait: true
|
||||
interval: 30m
|
||||
retryInterval: 1m
|
||||
timeout: 5m
|
||||
@@ -0,0 +1,71 @@
|
||||
---
|
||||
apiVersion: helm.toolkit.fluxcd.io/v2beta1
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: ingress-nginx
|
||||
namespace: networking
|
||||
spec:
|
||||
interval: 30m
|
||||
chart:
|
||||
spec:
|
||||
chart: ingress-nginx
|
||||
version: 4.7.1
|
||||
sourceRef:
|
||||
kind: HelmRepository
|
||||
name: ingress-nginx
|
||||
namespace: flux-system
|
||||
maxHistory: 2
|
||||
install:
|
||||
createNamespace: true
|
||||
remediation:
|
||||
retries: 3
|
||||
upgrade:
|
||||
cleanupOnFail: true
|
||||
remediation:
|
||||
retries: 3
|
||||
uninstall:
|
||||
keepHistory: false
|
||||
dependsOn:
|
||||
- name: cloudflared
|
||||
namespace: networking
|
||||
values:
|
||||
controller:
|
||||
extraEnvs:
|
||||
- name: TZ
|
||||
value: "${TIMEZONE}"
|
||||
service:
|
||||
annotations:
|
||||
external-dns.alpha.kubernetes.io/hostname: "ingress.${SECRET_DOMAIN}"
|
||||
io.cilium/lb-ipam-ips: "{{ bootstrap_ingress_nginx_addr }}"
|
||||
externalTrafficPolicy: Cluster
|
||||
publishService:
|
||||
enabled: true
|
||||
ingressClassResource:
|
||||
default: true
|
||||
config:
|
||||
client-header-timeout: 120
|
||||
client-body-buffer-size: "100M"
|
||||
client-body-timeout: 120
|
||||
enable-brotli: "true"
|
||||
hsts-max-age: "31449600"
|
||||
keep-alive: 120
|
||||
keep-alive-requests: 10000
|
||||
proxy-body-size: "100M"
|
||||
ssl-protocols: "TLSv1.3 TLSv1.2"
|
||||
metrics:
|
||||
enabled: true
|
||||
serviceMonitor:
|
||||
enabled: true
|
||||
namespace: networking
|
||||
namespaceSelector:
|
||||
any: true
|
||||
extraArgs:
|
||||
default-ssl-certificate: "networking/${SECRET_DOMAIN/./-}-staging-tls"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 250Mi
|
||||
limits:
|
||||
memory: 500Mi
|
||||
defaultBackend:
|
||||
enabled: false
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: networking
|
||||
resources:
|
||||
- ./helmrelease.yaml
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- ./staging.yaml
|
||||
# - ./production.yaml
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: "${SECRET_DOMAIN/./-}-production"
|
||||
namespace: networking
|
||||
spec:
|
||||
secretName: "${SECRET_DOMAIN/./-}-production-tls"
|
||||
issuerRef:
|
||||
name: letsencrypt-production
|
||||
kind: ClusterIssuer
|
||||
commonName: "${SECRET_DOMAIN}"
|
||||
dnsNames:
|
||||
- "${SECRET_DOMAIN}"
|
||||
- "*.${SECRET_DOMAIN}"
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
---
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: "${SECRET_DOMAIN/./-}-staging"
|
||||
namespace: networking
|
||||
spec:
|
||||
secretName: "${SECRET_DOMAIN/./-}-staging-tls"
|
||||
issuerRef:
|
||||
name: letsencrypt-staging
|
||||
kind: ClusterIssuer
|
||||
commonName: "${SECRET_DOMAIN}"
|
||||
dnsNames:
|
||||
- "${SECRET_DOMAIN}"
|
||||
- "*.${SECRET_DOMAIN}"
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||
kind: Kustomization
|
||||
metadata:
|
||||
name: cluster-apps-ingress-nginx-certificates
|
||||
namespace: flux-system
|
||||
spec:
|
||||
dependsOn:
|
||||
- name: cluster-apps-cert-manager-issuers
|
||||
path: ./kubernetes/apps/networking/ingress-nginx/certificates
|
||||
prune: true
|
||||
sourceRef:
|
||||
kind: GitRepository
|
||||
name: home-kubernetes
|
||||
wait: true
|
||||
interval: 30m
|
||||
retryInterval: 1m
|
||||
timeout: 5m
|
||||
---
|
||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||
kind: Kustomization
|
||||
metadata:
|
||||
name: cluster-apps-ingress-nginx
|
||||
namespace: flux-system
|
||||
spec:
|
||||
dependsOn:
|
||||
- name: cluster-apps-ingress-nginx-certificates
|
||||
path: ./kubernetes/apps/networking/ingress-nginx/app
|
||||
prune: true
|
||||
sourceRef:
|
||||
kind: GitRepository
|
||||
name: home-kubernetes
|
||||
wait: false # no flux ks dependents
|
||||
interval: 30m
|
||||
retryInterval: 1m
|
||||
timeout: 5m
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
apiVersion: helm.toolkit.fluxcd.io/v2beta1
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: k8s-gateway
|
||||
namespace: networking
|
||||
spec:
|
||||
interval: 30m
|
||||
chart:
|
||||
spec:
|
||||
chart: k8s-gateway
|
||||
version: 2.0.4
|
||||
sourceRef:
|
||||
kind: HelmRepository
|
||||
name: k8s-gateway
|
||||
namespace: flux-system
|
||||
maxHistory: 2
|
||||
install:
|
||||
createNamespace: true
|
||||
remediation:
|
||||
retries: 3
|
||||
upgrade:
|
||||
cleanupOnFail: true
|
||||
remediation:
|
||||
retries: 3
|
||||
uninstall:
|
||||
keepHistory: false
|
||||
values:
|
||||
fullnameOverride: k8s-gateway
|
||||
domain: "${SECRET_DOMAIN}"
|
||||
ttl: 1
|
||||
service:
|
||||
type: LoadBalancer
|
||||
port: 53
|
||||
annotations:
|
||||
io.cilium/lb-ipam-ips: "{{ bootstrap_k8s_gateway_addr }}"
|
||||
externalTrafficPolicy: Cluster
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: networking
|
||||
resources:
|
||||
- ./helmrelease.yaml
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||
kind: Kustomization
|
||||
metadata:
|
||||
name: cluster-apps-k8s-gateway
|
||||
namespace: flux-system
|
||||
spec:
|
||||
path: ./kubernetes/apps/networking/k8s-gateway/app
|
||||
prune: true
|
||||
sourceRef:
|
||||
kind: GitRepository
|
||||
name: home-kubernetes
|
||||
wait: false # no flux ks dependents
|
||||
interval: 30m
|
||||
retryInterval: 1m
|
||||
timeout: 5m
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- ./namespace.yaml
|
||||
- ./cloudflared/ks.yaml
|
||||
- ./external-dns/ks.yaml
|
||||
- ./ingress-nginx/ks.yaml
|
||||
- ./k8s-gateway/ks.yaml
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: networking
|
||||
labels:
|
||||
kustomize.toolkit.fluxcd.io/prune: disabled
|
||||
Reference in new issue
Block a user