ori-edge / k8s_gateway

A CoreDNS plugin to resolve all types of external Kubernetes resources
Apache License 2.0
308 stars 65 forks source link

Trim empty lines in yaml output #217

Closed mhumeSF closed 1 year ago

mhumeSF commented 1 year ago

Small edit to trim empty lines in deployment yaml output.

Before

# Source: k8s-gateway/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-gateway
  labels:
    helm.sh/chart: k8s-gateway-2.0.3
    app.kubernetes.io/name: k8s-gateway
    app.kubernetes.io/instance: k8s-gateway
    app.kubernetes.io/version: "0.3.4"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: k8s-gateway
      app.kubernetes.io/instance: k8s-gateway
  template:
    metadata:
      labels:
        app.kubernetes.io/name: k8s-gateway
        app.kubernetes.io/instance: k8s-gateway
      annotations:
        checksum/config: 4595e9c9776dce6b6cda4c35e2fc795b5781fe5c7dfff7eb4343ea476cb2de72
    spec:
      serviceAccountName: k8s-gateway
      containers:
      - name: k8s-gateway
        image: "quay.io/oriedge/k8s_gateway:v0.3.4"
        imagePullPolicy: IfNotPresent
        args: [ "-conf", "/etc/coredns/Corefile" ]
        securityContext:
          runAsUser: 1000
        volumeMounts:
        - name: config-volume
          mountPath: /etc/coredns
        resources:
            {}
        ports:
        - containerPort: 1053
          name: dns-udp
          protocol: UDP

        - containerPort: 9153
          name: metrics
          protocol: TCP

        livenessProbe:
          httpGet:
            path: /health
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 60
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
        readinessProbe:
          httpGet:
            path: /ready
            port: 8181
            scheme: HTTP
          initialDelaySeconds: 10
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
      volumes:
        - name: config-volume
          configMap:
            name: k8s-gateway
            items:
            - key: Corefile
              path: Corefile

            - key: example.db
              path: example.db

After

# Source: k8s-gateway/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-gateway
  labels:
    helm.sh/chart: k8s-gateway-2.0.3
    app.kubernetes.io/name: k8s-gateway
    app.kubernetes.io/instance: k8s-gateway
    app.kubernetes.io/version: "0.3.4"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: k8s-gateway
      app.kubernetes.io/instance: k8s-gateway
  template:
    metadata:
      labels:
        app.kubernetes.io/name: k8s-gateway
        app.kubernetes.io/instance: k8s-gateway
      annotations:
        checksum/config: 4595e9c9776dce6b6cda4c35e2fc795b5781fe5c7dfff7eb4343ea476cb2de72
    spec:
      serviceAccountName: k8s-gateway
      containers:
      - name: k8s-gateway
        image: "quay.io/oriedge/k8s_gateway:v0.3.4"
        imagePullPolicy: IfNotPresent
        args: [ "-conf", "/etc/coredns/Corefile" ]
        securityContext:
          runAsUser: 1000
        volumeMounts:
        - name: config-volume
          mountPath: /etc/coredns
        resources:
            {}
        ports:
        - containerPort: 1053
          name: dns-udp
          protocol: UDP
        - containerPort: 9153
          name: metrics
          protocol: TCP
        livenessProbe:
          httpGet:
            path: /health
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 60
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
        readinessProbe:
          httpGet:
            path: /ready
            port: 8181
            scheme: HTTP
          initialDelaySeconds: 10
          timeoutSeconds: 5
          successThreshold: 1
          failureThreshold: 5
      volumes:
        - name: config-volume
          configMap:
            name: k8s-gateway
            items:
            - key: Corefile
              path: Corefile
            - key: example.db
              path: example.db