Skip to content

Implement readiness plugin on node-local-dns #669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/node-cache/app/cache_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ type ConfigParams struct {
CoreFile string // Path to config file used by node-cache
KubednsCMPath string // Directory where kube-dns configmap will be mounted
UpstreamSvcName string // Name of the service whose clusterIP is the upstream for node-cache for cluster domain
HealthPort string // port for the healthcheck
HealthPort string // port for the liveness healthcheck from health plugin
ReadyPort string // port for the readiness healthcheck from ready plugin
SetupIptables bool
SkipTeardown bool // Indicates whether the iptables rules and interface should be torn down
}
Expand Down Expand Up @@ -142,6 +143,11 @@ func (c *CacheApp) initIptables() {
"--dport", c.params.HealthPort, "-j", "NOTRACK", "-m", "comment", "--comment", iptablesCommentSkipConntrack}},
{utiliptables.Table("raw"), utiliptables.ChainOutput, []string{"-p", "tcp", "-s", localIP,
"--sport", c.params.HealthPort, "-j", "NOTRACK", "-m", "comment", "--comment", iptablesCommentSkipConntrack}},
// skip connection tracking for healthcheck requests generated by readiness probe to ready plugin
{utiliptables.Table("raw"), utiliptables.ChainOutput, []string{"-p", "tcp", "-d", localIP,
"--dport", c.params.ReadyPort, "-j", "NOTRACK", "-m", "comment", "--comment", iptablesCommentSkipConntrack}},
{utiliptables.Table("raw"), utiliptables.ChainOutput, []string{"-p", "tcp", "-s", localIP,
"--sport", c.params.ReadyPort, "-j", "NOTRACK", "-m", "comment", "--comment", iptablesCommentSkipConntrack}},
}...)
}
c.iptables = newIPTables(c.isIPv6())
Expand Down
5 changes: 5 additions & 0 deletions cmd/node-cache/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
_ "github.com/coredns/coredns/plugin/loop"
_ "github.com/coredns/coredns/plugin/metrics"
_ "github.com/coredns/coredns/plugin/pprof"
_ "github.com/coredns/coredns/plugin/ready"
_ "github.com/coredns/coredns/plugin/reload"
_ "github.com/coredns/coredns/plugin/rewrite"
_ "github.com/coredns/coredns/plugin/template"
Expand Down Expand Up @@ -89,6 +90,7 @@ func parseAndValidateFlags() (*app.ConfigParams, error) {
flag.StringVar(&params.KubednsCMPath, "kubednscm", "", "Path where the kube-dns configmap will be mounted")
flag.StringVar(&params.UpstreamSvcName, "upstreamsvc", "kube-dns", "Service name whose cluster IP is upstream for node-cache")
flag.StringVar(&params.HealthPort, "health-port", "8080", "port used by health plugin")
flag.StringVar(&params.ReadyPort, "ready-port", "8181", "port used by ready plugin")
flag.BoolVar(&params.SkipTeardown, "skipteardown", false, "indicates whether iptables rules should be torn down on exit")
flag.Parse()

Expand Down Expand Up @@ -118,6 +120,9 @@ func parseAndValidateFlags() (*app.ConfigParams, error) {
if _, err := strconv.Atoi(params.HealthPort); err != nil {
return nil, fmt.Errorf("invalid healthcheck port specified - %q", params.HealthPort)
}
if _, err := strconv.Atoi(params.ReadyPort); err != nil {
return nil, fmt.Errorf("invalid ready port specified - %q", params.ReadyPort)
}
if f = flag.Lookup("conf"); f != nil {
params.CoreFile = f.Value.String()
clog.Infof("Using Corefile %s", params.CoreFile)
Expand Down
58 changes: 58 additions & 0 deletions vendor/github.com/coredns/coredns/plugin/ready/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions vendor/github.com/coredns/coredns/plugin/ready/list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions vendor/github.com/coredns/coredns/plugin/ready/readiness.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 81 additions & 0 deletions vendor/github.com/coredns/coredns/plugin/ready/ready.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions vendor/github.com/coredns/coredns/plugin/ready/setup.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ github.com/coredns/coredns/plugin/pkg/uniq
github.com/coredns/coredns/plugin/pkg/up
github.com/coredns/coredns/plugin/pkg/upstream
github.com/coredns/coredns/plugin/pprof
github.com/coredns/coredns/plugin/ready
github.com/coredns/coredns/plugin/reload
github.com/coredns/coredns/plugin/rewrite
github.com/coredns/coredns/plugin/template
Expand Down