-
Notifications
You must be signed in to change notification settings - Fork 635
Add CoreDNS template for community-catalog #746
Conversation
templates/coredns/config.yml
Outdated
version: 0.8.0 | ||
category: External DNS | ||
labels: | ||
io.rancher.orchestration.supported: 'cattle,mesos,swarm,kubernetes' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only cattle here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@niusmallnan only cattle, because for kubernetes it already had coredns helm chart, which better support for kubernetes.
- 53:53/tcp | ||
- 53:53/udp | ||
volumes_from: | ||
- data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a unified indentation
templates/coredns/0/README.md
Outdated
- Log plugin support: weather to enable log plugin. | ||
- Proxy plugin support: weather to enable proxy plugin. | ||
- Cache plugin support: weather to enable cache plugin. | ||
- Loadbalance plugin support: weatherto enable loadbalance plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weatherto
is a typo.
whether
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already fixed.
label: "Forward addresses" | ||
description: "The address which to be forwarded DNS query." | ||
type: "string" | ||
default: "8.8.8.8:53,4.4.4.4:53" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want to use 8.8.4.4
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry my mistake.Already fixed.
@@ -0,0 +1,84 @@ | |||
.catalog: | |||
name: "CoreDNS" | |||
version: "0.8.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if you use the coredns version.
For users, they may not know the meaning of the 0.8 version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to 1.0.1 compatible with coredns version.
volumes_from: | ||
- data | ||
data: | ||
image: zhenyangzhao/coredns-file:v0.8.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if you need a different image here.
Can you reuse the coredns/coredns
image? If not, it's ok.
It's up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this can not be reused.
@@ -0,0 +1,84 @@ | |||
.catalog: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use compose version 2 notation??
-.catalog:
+version: '2'
+catalog:
strategy: recreate | ||
request_line: GET "/health" "HTTP/1.0" | ||
reinitializing_timeout: 60000 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use compose version 2 notation??
-coredns:
- scale: 1
- health_check:
- response_timeout: 4000
- healthy_threshold: 2
- port: 8080
- unhealthy_threshold: 3
- initializing_timeout: 60000
- interval: 2000
- strategy: recreate
- request_line: GET "/health" "HTTP/1.0"
- reinitializing_timeout: 60000
+services:
+ coredns:
+ scale: 1
+ health_check:
+ response_timeout: 4000
+ healthy_threshold: 2
+ port: 8080
+ unhealthy_threshold: 3
+ initializing_timeout: 60000
+ interval: 2000
+ strategy: recreate
+ request_line: GET "/health" "HTTP/1.0"
+ reinitializing_timeout: 60000
PLUGIN_FORWARDS: ${FORWARDS} | ||
volumes: | ||
- /etc/coredns | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please use compose version 2 notation??
-coredns:
- image: coredns/coredns:1.0.1
- labels:
- io.rancher.sidekicks: data
- io.rancher.container.hostname_override: container_name
- command: [ "-conf", "/etc/coredns/Corefile" ]
- ports:
- - 53:53/tcp
- - 53:53/udp
- volumes_from:
- - data
-data:
- image: zhenyangzhao/coredns-file:v0.8.0
- labels:
- io.rancher.container.start_once: 'true'
- environment:
- PLUGIN_ZONES: ${ZONES}
- PLUGIN_ROOT_PATH: ${ROOT_PATH}
- PLUGIN_ETCD_ENDPOINTS: ${ETCD_ENDPOINTS}
- PLUGIN_UPSTREAM: ${UPSTREAM}
- PLUGIN_PROM: ${PLUGIN_PROM}
- PLUGIN_ERRORS: ${PLUGIN_ERRORS}
- PLUGIN_LOG: ${PLUGIN_LOG}
- PLUGIN_HEALTH: true
- PLUGIN_PROXY: ${PLUGIN_PROXY}
- PLUGIN_CACHE: ${PLUGIN_CACHE}
- PLUGIN_LOADBALANCE: ${PLUGIN_LOADBALANCE}
- PLUGIN_FORWARDS: ${FORWARDS}
- volumes:
- - /etc/coredns
+version: '2'
+services:
+ coredns:
+ image: coredns/coredns:1.0.1
+ labels:
+ io.rancher.sidekicks: data
+ io.rancher.container.hostname_override: container_name
+ command: [ "-conf", "/etc/coredns/Corefile" ]
+ ports:
+ - 53:53/tcp
+ - 53:53/udp
+ volumes_from:
+ - data
+ data:
+ image: zhenyangzhao/coredns-file:v0.8.0
+ labels:
+ io.rancher.container.start_once: 'true'
+ environment:
+ PLUGIN_ZONES: ${ZONES}
+ PLUGIN_ROOT_PATH: ${ROOT_PATH}
+ PLUGIN_ETCD_ENDPOINTS: ${ETCD_ENDPOINTS}
+ PLUGIN_UPSTREAM: ${UPSTREAM}
+ PLUGIN_PROM: ${PLUGIN_PROM}
+ PLUGIN_ERRORS: ${PLUGIN_ERRORS}
+ PLUGIN_LOG: ${PLUGIN_LOG}
+ PLUGIN_HEALTH: true
+ PLUGIN_PROXY: ${PLUGIN_PROXY}
+ PLUGIN_CACHE: ${PLUGIN_CACHE}
+ PLUGIN_LOADBALANCE: ${PLUGIN_LOADBALANCE}
+ PLUGIN_FORWARDS: ${FORWARDS}
+ volumes:
+ - coredns_data:/etc/coredns
+volumes:
+ coredns_data:
+ driver: local
+ per_container: true
command: [ "-conf", "/etc/coredns/Corefile" ] | ||
ports: | ||
- 53:53/tcp | ||
- 53:53/udp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think if you add a question PUBLISH_PORT
, with default value of 53, to be able to publish the service in configurable port??
- - 53:53/tcp
- - 53:53/udp
+ - ${PUBLISH_PORT}:${PUBLISH_PORT}/tcp
+ - ${PUBLISH_PORT}:${PUBLISH_PORT}/udp
Also a modification at line 1 of https://github.com/Jason-ZW/Dockerfile/blob/master/coredns/Corefile.tmpl
would be needed.
-.:53 {
+.:{{ getenv "PUBLISH_PORT" }} {
PLUGIN_PROXY: ${PLUGIN_PROXY} | ||
PLUGIN_CACHE: ${PLUGIN_CACHE} | ||
PLUGIN_LOADBALANCE: ${PLUGIN_LOADBALANCE} | ||
PLUGIN_FORWARDS: ${FORWARDS} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using variable PUBLISH_PORT
+ PUBLISH_PORT: ${PUBLISH_PORT}
description: "Etcd service endpoints." | ||
type: "string" | ||
default: "http://localhost:2379" | ||
required: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inside container will be already running an etcd service?? If not, default value wouldn't work...
May be it'd be better to leave blank default value, to force users to set the correct etcd endpoints. btw, multiple values are allowed??
Hi @Jason-ZW , thanks for the PR and contribute. :) Please, take a look to the changes requested. |
@rawmind0 Thanks for reply me. I have modified the code according to all the Suggestions. Could you please to review it again? |
@Jason-ZW , thanks for the changes. The package is right now, but there is a little error at Corefile.tmpl. I've opened a PR to fix it, please take a look. Jason-ZW/Dockerfile#1 Another question, sidekick has to keep running?? It's getting config from env vars, in which circumstances config could automatically change?? May be better to run confd with |
@rawmind0 Already removed run_once label from sidekick container. Already added |
Then, sidekick needs to keep running?? It's getting config from env vars, in which circumstances config could automatically get updated?? |
@rawmind0 Sorry for reply later. I just reviewed coredns's docs, there is no way to refresh server's config but restart or maybe i'm not found.So i rollback the code to make sidekick container start_once=true. Dockerfile already added |
Thanks, i think better like that. Other point, why are you using rancher backend in confd execution?? You are just getting data from env variables, you don't need metadata backend connection. You could use env backend Please, take a look to the changes requested. |
PLUGIN_FORWARDS: ${FORWARDS} | ||
PUBLISH_PORT: ${PUBLISH_PORT} | ||
volumes: | ||
- coredns_data:/etc/coredns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using env backend and disabling network at sidekick.
+ network_mode: none
+ entrypoint:
+ - confd
+ - -backend
+ - env
+ - -onetime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rawmind0 Fixed as you said. :)
@Jason-ZW , thanks for the changes... LGTM... |
@rawmind0 Thank you for your patience.:) |
Hi,all:
This PR added coredns for community-catalog.
Details as below:
CoreDNS image: coredns/coredns:1.0.1
Use confd(backend rancher) sidekick generate CoreDNS's Corefile.
Currently CoreDNS for this catalog only support etcd backend.If you want to use Kubernetes backend,please use coredns helm chart.
support 7+ plugins, user can customization plugin through catalog template.
support A/AAAA,PTR records.
support forward
support upstream
If you want to learn more, please see README documentation.
Hope this PR can be merged.
Best Regards!