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
4 changes: 0 additions & 4 deletions api/core/v1/playbook_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ type PlaybookSpec struct {
// SkipTags is the tags of playbook which skip execute
// +optional
SkipTags []string `json:"skipTags,omitempty"`
// If Debug mode is true, It will retain runtime data after a successful execution of Playbook,
// which includes task execution status and parameters.
// +optional
Debug bool `json:"debug,omitempty"`
// Volumes in job pod.
// +optional
Volumes []corev1.Volume `json:"workVolume,omitempty"`
Expand Down
1 change: 0 additions & 1 deletion cmd/kk/app/options/builtin/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func (o *AddNodeOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.

playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}
// override kube_version in config
if err := o.CommonOptions.Complete(playbook); err != nil {
Expand Down
2 changes: 0 additions & 2 deletions cmd/kk/app/options/builtin/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func (o *ArtifactExportOptions) Complete(cmd *cobra.Command, args []string) (*kk

playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
SkipTags: []string{"certs"},
}
if err := o.CommonOptions.Complete(playbook); err != nil {
Expand Down Expand Up @@ -124,7 +123,6 @@ func (o *ArtifactImagesOptions) Complete(cmd *cobra.Command, args []string) (*kk

playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
Tags: []string{"only_image"},
}

Expand Down
1 change: 0 additions & 1 deletion cmd/kk/app/options/builtin/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (o *CertsRenewOptions) Complete(cmd *cobra.Command, args []string) (*kkcore
o.Playbook = args[0]
playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
Tags: []string{"certs"},
}

Expand Down
1 change: 0 additions & 1 deletion cmd/kk/app/options/builtin/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func (o *CreateClusterOptions) Complete(cmd *cobra.Command, args []string) (*kkc

playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}
if err := o.CommonOptions.Complete(playbook); err != nil {
return nil, err
Expand Down
3 changes: 0 additions & 3 deletions cmd/kk/app/options/builtin/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ func (o *DeleteClusterOptions) Complete(cmd *cobra.Command, args []string) (*kkc
// Set playbook specification
playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}

// Complete common options (e.g., config, inventory)
Expand Down Expand Up @@ -189,7 +188,6 @@ func (o *DeleteNodesOptions) Complete(cmd *cobra.Command, args []string) (*kkcor
// Set playbook specification
playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}

// Complete common options (e.g., config, inventory)
Expand Down Expand Up @@ -267,7 +265,6 @@ func (o *DeleteRegistryOptions) Complete(cmd *cobra.Command, args []string) (*kk
// Set playbook specification
playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}

// Complete common options (e.g., config, inventory)
Expand Down
2 changes: 0 additions & 2 deletions cmd/kk/app/options/builtin/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ func (o *InitOSOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.P

playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}

if err := o.CommonOptions.Complete(playbook); err != nil {
Expand Down Expand Up @@ -146,7 +145,6 @@ func (o *InitRegistryOptions) Complete(cmd *cobra.Command, args []string) (*kkco

playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}

return playbook, o.CommonOptions.Complete(playbook)
Expand Down
1 change: 0 additions & 1 deletion cmd/kk/app/options/builtin/precheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ func (o *PreCheckOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1

playbook.Spec = kkcorev1.PlaybookSpec{
Playbook: o.Playbook,
Debug: o.Debug,
Tags: tags,
}

Expand Down
4 changes: 0 additions & 4 deletions cmd/kk/app/options/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ type CommonOptions struct {
Workdir string
// Artifact is the path to the offline package for kubekey.
Artifact string
// Debug indicates whether to retain runtime data after a successful execution of the playbook.
// This includes task execution status and parameters.
Debug bool
// Namespace specifies the namespace for all resources.
Namespace string

Expand Down Expand Up @@ -166,7 +163,6 @@ func (o *CommonOptions) Flags() cliflag.NamedFlagSets {
gfs.StringVarP(&o.ConfigFile, "config", "c", o.ConfigFile, "the config file path. support *.yaml ")
gfs.StringArrayVar(&o.Set, "set", o.Set, "set value in config. format --set key=val or --set k1=v1,k2=v2")
gfs.StringVarP(&o.InventoryFile, "inventory", "i", o.InventoryFile, "the host list file path. support *.yaml")
gfs.BoolVarP(&o.Debug, "debug", "d", o.Debug, "Debug mode, after a successful execution of Playbook, will retain runtime data, which includes task execution status and parameters.")
gfs.StringVarP(&o.Namespace, "namespace", "n", o.Namespace, "the namespace which playbook will be executed, all reference resources(playbook, config, inventory, task) should in the same namespace")

return fss
Expand Down
1 change: 0 additions & 1 deletion cmd/kk/app/options/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func (o *KubeKeyRunOptions) Complete(cmd *cobra.Command, args []string) (*kkcore
Playbook: o.Playbook,
Tags: o.Tags,
SkipTags: o.SkipTags,
Debug: o.Debug,
}

if o.InventoryFile != "" {
Expand Down
14 changes: 0 additions & 14 deletions pkg/executor/playbook_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
"context"
"fmt"
"io"
"os"
"path/filepath"
"time"

"github.com/cockroachdb/errors"
Expand All @@ -32,7 +30,6 @@ import (
"k8s.io/klog/v2"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"

_const "github.com/kubesphere/kubekey/v4/pkg/const"
"github.com/kubesphere/kubekey/v4/pkg/converter"
"github.com/kubesphere/kubekey/v4/pkg/project"
"github.com/kubesphere/kubekey/v4/pkg/variable"
Expand Down Expand Up @@ -139,17 +136,6 @@ func (e playbookExecutor) syncStatus(ctx context.Context, err error) {
if err := e.client.Status().Patch(ctx, e.playbook, ctrlclient.MergeFrom(cp)); err != nil {
klog.ErrorS(err, "update playbook error", "playbook", ctrlclient.ObjectKeyFromObject(e.playbook))
}

go func() {
if !e.playbook.Spec.Debug && e.playbook.Status.Phase == kkcorev1.PlaybookPhaseSucceeded {
<-ctx.Done()
fmt.Fprintf(e.logOutput, "%s [Playbook %s] clean runtime directory\n", time.Now().Format(time.TimeOnly+" MST"), ctrlclient.ObjectKeyFromObject(e.playbook))
// clean runtime directory
if err := os.RemoveAll(filepath.Join(_const.GetWorkdirFromConfig(e.playbook.Spec.Config), _const.RuntimeDir)); err != nil {
klog.ErrorS(err, "clean runtime directory error", "playbook", ctrlclient.ObjectKeyFromObject(e.playbook), "runtime_dir", filepath.Join(_const.GetWorkdirFromConfig(e.playbook.Spec.Config), _const.RuntimeDir))
}
}
}()
}

// execBatchHosts executor block in play order by: "pre_tasks" > "roles" > "tasks" > "post_tasks"
Expand Down