Skip to content

Commit

Permalink
Why does it fail?
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
  • Loading branch information
kke committed Jan 14, 2025
1 parent f216974 commit 646790e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions phase/apply_manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ func (p *ApplyManifests) Run() error {

func (p *ApplyManifests) apply(name string, content []byte) error {
if !p.IsWet() {
p.DryMsgf(p.leader, "apply manifest %s", name)
p.DryMsgf(p.leader, "apply manifest %s (%d bytes)", name, len(content))
return nil
}

log.Infof("%s: apply manifest %s (%d bytes)", p.leader, name, len(content))
log.Debugf("%s: manifest content:\n%s", p.leader, content)
kubectlCmd := p.leader.Configurer.KubectlCmdf(p.leader, p.leader.K0sDataDir(), "apply -f -")
var stdout, stderr bytes.Buffer

Expand All @@ -61,9 +63,9 @@ func (p *ApplyManifests) apply(name string, content []byte) error {
}
if err := cmd.Wait(); err != nil {
log.Errorf("kubectl apply failed for manifest %s", name)
log.Errorf("kubectl apply stdout: %s", stdout.String())
log.Errorf("kubectl apply stderr: %s", stderr.String())
return fmt.Errorf("failed to apply manifest %s: %w", name, err)
}
log.Infof("kubectl apply: %s", stdout.String())
return nil
}

0 comments on commit 646790e

Please sign in to comment.