Skip to content

Commit

Permalink
Merge pull request #571 from deckhouse/nm-fix-bashible-apiserver-cont…
Browse files Browse the repository at this point in the history
…ext-for-static

[node-manager][bashible-apiserver] Fix: no context for node groups in static cluster
  • Loading branch information
nabokihms committed Jan 12, 2022
2 parents 7d3769e + ec65827 commit a54961e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 510 deletions.
15 changes: 8 additions & 7 deletions dhctl/pkg/kubernetes/actions/deckhouse/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ func (d *LogPrinter) Print(ctx context.Context) (bool, error) {
case <-ctx.Done():
return false, ErrTimedOut
default:
ready, err := d.checkDeckhousePodReady()
if err != nil {
return false, err
}
if ready {
return true, nil
}

request := d.kubeCl.CoreV1().Pods("d8-system").GetLogs(d.deckhousePod.Name, &logOptions)
result, err := request.DoRaw(context.TODO())
if err != nil {
Expand All @@ -278,13 +286,6 @@ func (d *LogPrinter) Print(ctx context.Context) (bool, error) {
}

d.printLogsByLine(result)
ready, err := d.checkDeckhousePodReady()
if err != nil {
return false, err
}
if ready {
return true, nil
}

time.Sleep(time.Second)
currentTime := metav1.NewTime(time.Now())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,12 @@ func (c *BashibleContext) Get(contextKey string) (map[string]interface{}, error)

raw, ok := c.data[contextKey]
if !ok {
return nil, fmt.Errorf("context not found for secretKey \"%s\"", contextKey)
// log exists keys for debug purposes
keys := make([]string, 0, len(c.data))
for k := range c.data {
keys = append(keys, k)
}
return nil, fmt.Errorf("context not found for secretKey \"%s\". Have keys: %v", contextKey, keys)
}

converted, ok := raw.(map[string]interface{})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,13 @@ func (cb *ContextBuilder) generateBashibleChecksum(checksumCollector hash.Hash,
res[k] = v
}

var providerType string
cloudProvider, ok := bundleNgContext.CloudProvider.(map[string]interface{})
if !ok {
// absent cloud provider means static nodes
return errors.New("cloud provider has wrong type")
}
providerType, ok := cloudProvider["type"].(string)
if !ok {
return fmt.Errorf("cloudProvider.type is not a string")
if ok {
providerType, ok = cloudProvider["type"].(string)
if !ok {
return fmt.Errorf("cloudProvider.type is not a string")
}
}

// render steps
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit a54961e

Please sign in to comment.