This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 558
ip-masq-agent as addon #3916
Merged
Merged
ip-masq-agent as addon #3916
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f6f53f3
ip-masq-agent as addon
jackfrancis bb18c90
vmss fix, unit test
jackfrancis f175b62
tests
jackfrancis 75051c0
add 168.63.129.16/32 to nonMasqueradeCIDRs list
jackfrancis 948fb55
reformat
jackfrancis fcceeb4
containers need names!
jackfrancis 7084e5d
use VNET CIDR instead of subnet CIDR
jackfrancis 39f7a25
wrap in double-quotes and default val
jackfrancis b638e64
distinct azure cni / kubenet implementation
jackfrancis c06bd16
correct sed
jackfrancis f6be7db
add e2e test
jackfrancis 0de1292
requests/limits
jackfrancis 456b944
fix omissions in vmss master
jackfrancis 921a595
enable ip-masq-agent params
jackfrancis c237194
enable addon enforcement as const
jackfrancis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: DaemonSet | ||
metadata: | ||
name: azure-ip-masq-agent | ||
namespace: kube-system | ||
labels: | ||
component: azure-ip-masq-agent | ||
kubernetes.io/cluster-service: "true" | ||
addonmanager.kubernetes.io/mode: Reconcile | ||
tier: node | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
k8s-app: azure-ip-masq-agent | ||
tier: node | ||
spec: | ||
hostNetwork: true | ||
nodeSelector: | ||
beta.kubernetes.io/os: linux | ||
containers: | ||
- name: azure-ip-masq-agent | ||
image: gcr.io/google-containers/ip-masq-agent-amd64:v2.0.0 | ||
securityContext: | ||
privileged: true | ||
volumeMounts: | ||
- name: azure-ip-masq-agent-config-volume | ||
mountPath: /etc/config | ||
resources: | ||
requests: | ||
cpu: <kubernetesIPMasqAgentCPURequests> | ||
memory: <kubernetesIPMasqAgentMemoryRequests> | ||
limits: | ||
cpu: <kubernetesIPMasqAgentCPULimit> | ||
memory: <kubernetesIPMasqAgentMemoryLimit> | ||
volumes: | ||
- name: azure-ip-masq-agent-config-volume | ||
configMap: | ||
name: azure-ip-masq-agent-config | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: azure-ip-masq-agent-config | ||
namespace: kube-system | ||
labels: | ||
component: azure-ip-masq-agent | ||
kubernetes.io/cluster-service: "true" | ||
addonmanager.kubernetes.io/mode: EnsureExists | ||
data: | ||
ip-masq-agent: |- | ||
nonMasqueradeCIDRs: | ||
- <kubernetesNonMasqueradeCidr> | ||
- <azureCNINonMasqueradeIP> | ||
masqLinkLocal: <masqLinkLocalValue> | ||
resyncInterval: 60s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,6 +219,16 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params | |
} | ||
} | ||
} | ||
if kubernetesConfig.IsIPMasqAgentEnabled() { | ||
ipMasqAgentAddon := kubernetesConfig.GetAddonByName(IPMASQAgentAddonName) | ||
i := ipMasqAgentAddon.GetAddonContainersIndexByName(IPMASQAgentAddonName) | ||
if i > -1 { | ||
addValue(parametersMap, "kubernetesIPMasqAgentCPURequests", ipMasqAgentAddon.Containers[c].CPURequests) | ||
addValue(parametersMap, "kubernetesIPMasqAgentMemoryRequests", ipMasqAgentAddon.Containers[c].MemoryRequests) | ||
addValue(parametersMap, "kubernetesIPMasqAgentCPULimit", ipMasqAgentAddon.Containers[c].CPULimits) | ||
addValue(parametersMap, "kubernetesIPMasqAgentMemoryLimit", ipMasqAgentAddon.Containers[c].MemoryLimits) | ||
} | ||
} | ||
if kubernetesConfig.LoadBalancerSku == "Standard" { | ||
random := rand.New(rand.NewSource(time.Now().UnixNano())) | ||
elbsvcName := random.Int() | ||
|
@@ -249,7 +259,15 @@ func assignKubernetesParameters(properties *api.Properties, parametersMap params | |
CloudProviderRateLimitBucket: kubernetesConfig.CloudProviderRateLimitBucket, | ||
}) | ||
addValue(parametersMap, "kubeClusterCidr", kubernetesConfig.ClusterSubnet) | ||
addValue(parametersMap, "kubernetesNonMasqueradeCidr", kubernetesConfig.KubeletConfig["--non-masquerade-cidr"]) | ||
if properties.OrchestratorProfile.IsAzureCNI() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JunSun17 Kindly review this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks good to me. |
||
if properties.MasterProfile != nil && properties.MasterProfile.IsCustomVNET() { | ||
addValue(parametersMap, "kubernetesNonMasqueradeCidr", properties.MasterProfile.VnetCidr) | ||
} else { | ||
addValue(parametersMap, "kubernetesNonMasqueradeCidr", DefaultVNETCIDR) | ||
} | ||
} else { | ||
addValue(parametersMap, "kubernetesNonMasqueradeCidr", properties.OrchestratorProfile.KubernetesConfig.ClusterSubnet) | ||
} | ||
addValue(parametersMap, "kubernetesKubeletClusterDomain", kubernetesConfig.KubeletConfig["--cluster-domain"]) | ||
addValue(parametersMap, "dockerBridgeCidr", kubernetesConfig.DockerBridgeSubnet) | ||
addValue(parametersMap, "networkPolicy", kubernetesConfig.NetworkPolicy) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@JunSun17 Kindly review this logic
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.
looks good to me, |d -> |g?