-
Notifications
You must be signed in to change notification settings - Fork 260
Support k8s DNS & endpoint policy #127
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
Conversation
cni/network/network.go
Outdated
| "github.com/Azure/azure-container-networking/network" | ||
| "github.com/Azure/azure-container-networking/platform" | ||
| "github.com/Azure/azure-container-networking/telemetry" | ||
| "github.com/Microsoft/hcsshim" |
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.
this file is common to both linux and windows..we should move this to separate file
| * We can delete this if statement once they fix it. | ||
| * Issue link: https://github.com/kubernetes/kubernetes/issues/57253 | ||
| */ | ||
| epInfo, _ = plugin.nm.GetEndpointInfo(networkId, endpointId) |
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.
this should not be common to linux and windows. can you please move this to separate file(windows)
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.
done.
| Address string `json:"ipAddress,omitempty"` | ||
| QueryInterval string `json:"queryInterval,omitempty"` | ||
| } | ||
| DNS cniTypes.DNS `json:"dns"` |
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.
space damage
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.
The alignment is correct.
cni/network/network_windows.go
Outdated
| * We can delete this if statement once they fix it. | ||
| * Issue link: https://github.com/kubernetes/kubernetes/issues/57253 | ||
| */ | ||
| func HandleConsecutiveAdd(containerId, endpointId string, dnsServers []string, nwInfo *network.NetworkInfo, nwCfg *cni.NetworkConfig) (*cniTypesCurr.Result, error) { |
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.
remove dnsservers parameter
cni/network/network.go
Outdated
|
|
||
| // Parse Pod arguments. | ||
| podCfg, err := cni.ParseCniArgs(args.Args) | ||
| k8sNamespace := "default" |
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.
cni will be always invoked with namespace. if not we throw error. don't want to assume default if not specified
cni/policy.go
Outdated
| } | ||
|
|
||
| // GetPoliciesFromNwCfg returns network policies from network config. | ||
| func GetPoliciesFromNwCfg(kvp []KVPair) []Policy { |
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.
pls define this in netconfig.go
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.
done.
network/endpoint.go
Outdated
| } | ||
|
|
||
| // HotAttachEndpoint is a wrapper of hcsshim's HotAttachEndpoint. | ||
| func (endpoint *EndpointInfo) HotAttachEndpoint(containerID string) error { |
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.
move this inside _windows.go
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.
done.
network/endpoint_windows.go
Outdated
| VirtualNetwork: nw.HnsId, | ||
| DNSSuffix: epInfo.DNS.Suffix, | ||
| DNSServerList: strings.Join(epInfo.DNS.Servers, ","), | ||
| Policies: cni.SerializePolicies(cni.EndpointPolicy, epInfo.Policies), |
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.
cannot call cni specific functions from common code..put this inside policy_windows.go
network/endpoint_windows.go
Outdated
| "net" | ||
| "strings" | ||
|
|
||
| "github.com/Azure/azure-container-networking/cni" |
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.
this should be removed
network/network_windows.go
Outdated
| NetworkAdapterName: extIf.Name, | ||
| DNSSuffix: nwInfo.DNS.Suffix, | ||
| DNSServerList: strings.Join(nwInfo.DNS.Servers, ","), | ||
| Policies: cni.SerializePolicies(cni.NetworkPolicy, nwInfo.Policies), |
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.
cant call cni methods 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.
fixed.
| // Initialize endpoint info. | ||
| epInfo := &network.EndpointInfo{ | ||
| var dns network.DNSInfo | ||
| if len(nwCfg.DNS.Search) > 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.
check for nameserver also
cni/network/network.go
Outdated
| // Populate DNS info. | ||
| epInfo.DNS.Suffix = result.DNS.Domain | ||
| epInfo.DNS.Servers = result.DNS.Nameservers | ||
| setPolicies(epInfo, policies) |
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.
no need to separate this for Linux and windows
| Mode string | ||
| Subnets []SubnetInfo | ||
| DNS DNSInfo | ||
| Policies []policy.Policy |
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.
define this structure for linux also
What this PR does / why we need it:
This PR adds kubernetes DNS & endpoint policy support to Azure CNI.
It also fixes IP leaking in Windows.
Special notes for your reviewer:
This PR needs PR Azure/acs-engine#2822 from acs-engine.