Skip to content

Commit

Permalink
fixes according review
Browse files Browse the repository at this point in the history
  • Loading branch information
zetaab committed Jan 16, 2023
1 parent 9cc9bef commit 1e9304b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/nodeup/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ type BootConfig struct {
}

type ConfigServerOptions struct {
// Servers is the addresses of the configuration servers to use (kops-controller)
// Servers are the addresses of the configuration servers to use (kops-controller)
Servers []string `json:"servers,omitempty"`
// CACertificates are the certificates to trust for fi.CertificateIDCA.
CACertificates string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,7 @@ ensure-install-dir

echo "H4sIAAAAAAAA/2yST2/bMAzF7/4URIHeCttZt2IQeikSrA22DMGyYWfGohWishhQkrd8+0Fu3D9YT4b4e8R70nPnJdulhJ6dqQAGDOhol0TR0dJjjBQNJM1UPeY9eUpFhUHCaZAc73I6GOjRR6oAOqeSjyvlkdRAPMVEg32e/xBJBppyLp5blZFtEdLfRBrQTyTHRLr6vjOwaNv65mPd1ov2FZEBOZj5WHvppkUKuPe0on12joN7wGA96RwdgEbuEkt4QLUGBhpETzWOyL7s3S7adsNXQSz18c34ch5y+cYvSnT76fKKB3T/S+fpG20F0BOmrHSPiWJ5PoDlbr1hp1gi3f3eGbgoOS8mtg4/lWjrs+PCfgUlx+Wyr1Sli24qbYulgWZEbTzvm3NJzYugAvDivtFI3sCHCuAodh16xaWEhBxI1yW2gScbPdWPn2PN0hwxRzLX9c3TzgYD9xTT2ZBSN5looESxGc40FrFKoi59LcyvqMfs00sT82123YFsnh7vmcVDTlb+hHvFjrakLNbAdRvfR0vlxB36rdhYfpdY/QMAAP//AQAA//+ifSCJzQIAAA==" | base64 -d | gzip -d > conf/cluster_spec.yaml

<<<<<<< HEAD
echo "H4sIAAAAAAAA/6yUTY+qSBSG9/4K9uZeERXBpBeHokBUEASh6R1i8SUfxYeWmvnxk7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UjUtrrWRlCQFVNWZ9L9vThUOVkxRnUmo9fvWn/v6TrokhXDhe7SQkCSR748oacjKBUm5Vqttk++dJRPNG2XjQuZs2M/Rn8CAAD//wEAAP//G4LZN5wFAAA=" | base64 -d | gzip -d > conf/kube_env.yaml

download-release
echo "== nodeup node config done =="
Expand Down
23 changes: 11 additions & 12 deletions upup/pkg/fi/nodeup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (c *NodeUpCommand) Run(out io.Writer) error {
// If we're using a config server instead of vfs, nodeConfig will hold our configuration
var nodeConfig *nodeup.NodeConfig

if len(bootConfig.ConfigServer.Servers) > 0 {
if bootConfig.ConfigServer != nil && len(bootConfig.ConfigServer.Servers) > 0 {
response, err := getNodeConfigFromServers(ctx, &bootConfig, region)
if err != nil {
return fmt.Errorf("failed to get node config from server: %w", err)
Expand Down Expand Up @@ -164,9 +164,7 @@ func (c *NodeUpCommand) Run(out io.Writer) error {
return fmt.Errorf("error parsing BootConfig config response: %v", err)
}
nodeupConfigHash = sha256.Sum256([]byte(nodeConfig.NodeupConfig))
if len(bootConfig.ConfigServer.Servers) > 0 {
nodeupConfig.CAs[fi.CertificateIDCA] = bootConfig.ConfigServer.CACertificates
}
nodeupConfig.CAs[fi.CertificateIDCA] = bootConfig.ConfigServer.CACertificates
} else if bootConfig.InstanceGroupName != "" {
nodeupConfigLocation := configBase.Join("igconfig", bootConfig.InstanceGroupRole.ToLowerString(), bootConfig.InstanceGroupName, "nodeupconfig.yaml")

Expand Down Expand Up @@ -768,28 +766,29 @@ func getNodeConfigFromServers(ctx context.Context, bootConfig *nodeup.BootConfig
client := &kopscontrollerclient.Client{
Authenticator: authenticator,
Resolver: resolver,
CAs: []byte(bootConfig.ConfigServer.CACertificates),
}

var merr error
for _, server := range bootConfig.ConfigServer.Servers {
u, loopErr := url.Parse(server)
if loopErr != nil {
merr = multierr.Append(merr, fmt.Errorf("unable to parse configuration server url %q: %w", server, loopErr))
u, err := url.Parse(server)
if err != nil {
merr = multierr.Append(merr, fmt.Errorf("unable to parse configuration server url %q: %w", server, err))
continue
}
client.BaseURL = *u
client.CAs = []byte(bootConfig.ConfigServer.CACertificates)

request := nodeup.BootstrapRequest{
APIVersion: nodeup.BootstrapAPIVersion,
IncludeNodeConfig: true,
}
var resp nodeup.BootstrapResponse
err := client.Query(ctx, &request, &resp)
if err == nil {
return &resp, nil
} else {
err = client.Query(ctx, &request, &resp)
if err != nil {
merr = multierr.Append(merr, err)
continue
}
return &resp, nil
}
return nil, merr
}
Expand Down

0 comments on commit 1e9304b

Please sign in to comment.