dns-injector

module
v0.0.0-...-65cd678 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2021 License: MIT

README

dns-injector

Allow to inject dnsPolicy and dnsConfig settings through annotations.

Dependencies

  • cert-manager with ca-injector

Installation

  1. Add Helm repo
helm repo add ydkn https://repo.ydkn.io/charts
  1. Install the chart on your cluster
helm install dns-injector ydkn/dns-injector

See deploy/charts/dns-injector/values.yaml for configuration options.

Usage

To enable the dns-injector any pod that should be modified needs to have the following label:

dns-injector.ydkn.io/enabled: "true"
Change the DNS policy of a pod

Add a pod with the dns-injector.ydkn.io/policy annotation with the DNS policy value:

apiVersion: v1
kind: Pod
metadata:
  name: dns-example
  labels:
    dns-injector.ydkn.io/enabled: "true"
  annotations:
    dns-injector.ydkn.io/policy: None
spec:
  containers:
    - name: nginx
      image: nginx

This results in the following pod to be scheduled:

apiVersion: v1
kind: Pod
metadata:
  name: dns-example
  labels:
    dns-injector.ydkn.io/enabled: "true"
  annotations:
    dns-injector.ydkn.io/policy: None
spec:
  containers:
    - name: nginx
      image: nginx
  dnsPolicy: None
Change the DNS config of a pod

Create a configmap with a dnsConfig:

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-dnsconfig
data:
  dnsConfig.yaml: |
    nameservers:
      - 1.2.3.4
    options:
      - name: ndots
        value: "0"

Add a pod with the dns-injector.ydkn.io/configmap annotation and the name of the configmap as the value:

apiVersion: v1
kind: Pod
metadata:
  name: dns-example
  labels:
    dns-injector.ydkn.io/enabled: "true"
  annotations:
    dns-injector.ydkn.io/configmap: my-dnsconfig
spec:
  containers:
    - name: nginx
      image: nginx

This results in the following pod to be scheduled:

apiVersion: v1
kind: Pod
metadata:
  name: dns-example
  labels:
    dns-injector.ydkn.io/enabled: "true"
  annotations:
    dns-injector.ydkn.io/configmap: my-dnsconfig
spec:
  containers:
    - name: nginx
      image: nginx
  dnsConfig:
    nameservers:
      - 1.2.3.4
    options:
      - name: ndots
        value: "0"

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Merge Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL