Skip to content
Merged
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
6 changes: 6 additions & 0 deletions pkg/agent/bakerapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ type agentBakerImpl struct{}
func (agentBaker *agentBakerImpl) GetNodeBootstrapping(ctx context.Context,
config *datamodel.NodeBootstrappingConfiguration) (*datamodel.NodeBootstrapping, error) {
// validate and fix input before passing config to the template generator.
if config.AgentPoolProfile == nil {
return nil, fmt.Errorf("config.AgentPoolProfile is nil")
}
if config.AgentPoolProfile.IsWindows() {
validateAndSetWindowsNodeBootstrappingConfiguration(config)
} else {
Expand All @@ -42,6 +45,9 @@ func (agentBaker *agentBakerImpl) GetNodeBootstrapping(ctx context.Context,
return nodeBootstrapping, nil
}

if config.CloudSpecConfig == nil {
return nil, fmt.Errorf("config.CloudSpecConfig is nil")
}
osImageConfigMap, hasCloud := datamodel.AzureCloudToOSImageMap[config.CloudSpecConfig.CloudName]
if !hasCloud {
return nil, fmt.Errorf("don't have settings for cloud %s", config.CloudSpecConfig.CloudName)
Expand Down
1 change: 1 addition & 0 deletions pkg/agent/dumpText.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pkg/agent/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ func IsKubernetesVersionGe(actualVersion, version string) bool {

func getCustomDataFromJSON(jsonStr string) string {
var customDataObj map[string]string
jsonStr = strings.ReplaceAll(jsonStr, "\r", "\r\n")
jsonStr = strings.ReplaceAll(jsonStr, "\n", "\\n")
jsonStr = strings.ReplaceAll(jsonStr, "\t", "\\t")
err := json.Unmarshal([]byte(jsonStr), &customDataObj)
if err != nil {
panic(err)
Expand Down
25 changes: 23 additions & 2 deletions pkg/agent/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,21 @@ func isVHD(profile *datamodel.AgentPoolProfile) string {
}

func getOutBoundCmd(nbc *datamodel.NodeBootstrappingConfiguration, cloudSpecConfig *datamodel.AzureEnvironmentSpecConfig) string {
if nbc.ContainerService == nil {
return "nbc.ContainerService is nil"
}
cs := nbc.ContainerService

if cs.Properties == nil {
return "cs.Properties is nil"
}
if cs.Properties.FeatureFlags.IsFeatureEnabled("BlockOutboundInternet") {
return ""
}

if cloudSpecConfig == nil {
return "cloudSpecConfig is nil"
}
registry := ""
if cloudSpecConfig.CloudName == datamodel.AzureChinaCloud {
registry = `gcr.azk8s.cn`
Expand All @@ -190,8 +201,18 @@ func getOutBoundCmd(nbc *datamodel.NodeBootstrappingConfiguration, cloudSpecConf

// curl on Ubuntu 16.04 (shipped prior to AKS 1.18) doesn't support proxy TLS.
// so we need to use nc for the connectivity check.
clusterVersion, _ := semver.Make(cs.Properties.OrchestratorProfile.OrchestratorVersion)
minVersion, _ := semver.Make("1.18.0")
clusterVersion, err := semver.Make(cs.Properties.OrchestratorProfile.OrchestratorVersion)
if err != nil {
if err != nil {
return err.Error()
}
}
minVersion, err := semver.Make("1.18.0")
if err != nil {
if err != nil {
return err.Error()
}
}

connectivityCheckCommand := ""
if clusterVersion.GTE(minVersion) {
Expand Down