Skip to content
Closed
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

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

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

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

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

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