Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change package name #2355

Merged
merged 2 commits into from
Aug 12, 2024
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
18 changes: 9 additions & 9 deletions cmd/kk/app/options/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cliflag "k8s.io/component-base/cli/flag"

kubekeyv1 "github.com/kubesphere/kubekey/v4/pkg/apis/kubekey/v1"
kkcorev1 "github.com/kubesphere/kubekey/v4/pkg/apis/core/v1"
)

// ======================================================================================
Expand All @@ -39,13 +39,13 @@ func (o *ArtifactExportOptions) Flags() cliflag.NamedFlagSets {
return fss
}

func (o ArtifactExportOptions) Complete(cmd *cobra.Command, args []string) (*kubekeyv1.Pipeline, *kubekeyv1.Config, *kubekeyv1.Inventory, error) {
pipeline := &kubekeyv1.Pipeline{
func (o ArtifactExportOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.Pipeline, *kkcorev1.Config, *kkcorev1.Inventory, error) {
pipeline := &kkcorev1.Pipeline{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "artifact-export-",
Namespace: o.Namespace,
Annotations: map[string]string{
kubekeyv1.BuiltinsProjectAnnotation: "",
kkcorev1.BuiltinsProjectAnnotation: "",
},
},
}
Expand All @@ -57,7 +57,7 @@ func (o ArtifactExportOptions) Complete(cmd *cobra.Command, args []string) (*kub
return nil, nil, nil, fmt.Errorf("%s\nSee '%s -h' for help and examples", cmd.Use, cmd.CommandPath())
}

pipeline.Spec = kubekeyv1.PipelineSpec{
pipeline.Spec = kkcorev1.PipelineSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}
Expand Down Expand Up @@ -87,13 +87,13 @@ func (o *ArtifactImagesOptions) Flags() cliflag.NamedFlagSets {
return fss
}

func (o ArtifactImagesOptions) Complete(cmd *cobra.Command, args []string) (*kubekeyv1.Pipeline, *kubekeyv1.Config, *kubekeyv1.Inventory, error) {
pipeline := &kubekeyv1.Pipeline{
func (o ArtifactImagesOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.Pipeline, *kkcorev1.Config, *kkcorev1.Inventory, error) {
pipeline := &kkcorev1.Pipeline{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "artifact-images-",
Namespace: o.Namespace,
Annotations: map[string]string{
kubekeyv1.BuiltinsProjectAnnotation: "",
kkcorev1.BuiltinsProjectAnnotation: "",
},
},
}
Expand All @@ -105,7 +105,7 @@ func (o ArtifactImagesOptions) Complete(cmd *cobra.Command, args []string) (*kub
return nil, nil, nil, fmt.Errorf("%s\nSee '%s -h' for help and examples", cmd.Use, cmd.CommandPath())
}

pipeline.Spec = kubekeyv1.PipelineSpec{
pipeline.Spec = kkcorev1.PipelineSpec{
Playbook: o.Playbook,
Debug: o.Debug,
Tags: []string{"only_image"},
Expand Down
10 changes: 5 additions & 5 deletions cmd/kk/app/options/certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cliflag "k8s.io/component-base/cli/flag"

kubekeyv1 "github.com/kubesphere/kubekey/v4/pkg/apis/kubekey/v1"
kkcorev1 "github.com/kubesphere/kubekey/v4/pkg/apis/core/v1"
)

func NewCertsRenewOptions() *CertsRenewOptions {
Expand All @@ -40,13 +40,13 @@ func (o *CertsRenewOptions) Flags() cliflag.NamedFlagSets {
return fss
}

func (o *CertsRenewOptions) Complete(cmd *cobra.Command, args []string) (*kubekeyv1.Pipeline, *kubekeyv1.Config, *kubekeyv1.Inventory, error) {
pipeline := &kubekeyv1.Pipeline{
func (o *CertsRenewOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.Pipeline, *kkcorev1.Config, *kkcorev1.Inventory, error) {
pipeline := &kkcorev1.Pipeline{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "certs-renew-",
Namespace: o.Namespace,
Annotations: map[string]string{
kubekeyv1.BuiltinsProjectAnnotation: "",
kkcorev1.BuiltinsProjectAnnotation: "",
},
},
}
Expand All @@ -58,7 +58,7 @@ func (o *CertsRenewOptions) Complete(cmd *cobra.Command, args []string) (*kubeke
return nil, nil, nil, fmt.Errorf("%s\nSee '%s -h' for help and examples", cmd.Use, cmd.CommandPath())
}

pipeline.Spec = kubekeyv1.PipelineSpec{
pipeline.Spec = kkcorev1.PipelineSpec{
Playbook: o.Playbook,
Debug: o.Debug,
Tags: []string{"certs"},
Expand Down
10 changes: 5 additions & 5 deletions cmd/kk/app/options/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cliflag "k8s.io/component-base/cli/flag"

kubekeyv1 "github.com/kubesphere/kubekey/v4/pkg/apis/kubekey/v1"
kkcorev1 "github.com/kubesphere/kubekey/v4/pkg/apis/core/v1"
)

func NewCreateClusterOptions() *CreateClusterOptions {
Expand All @@ -47,13 +47,13 @@ func (o *CreateClusterOptions) Flags() cliflag.NamedFlagSets {
return fss
}

func (o *CreateClusterOptions) Complete(cmd *cobra.Command, args []string) (*kubekeyv1.Pipeline, *kubekeyv1.Config, *kubekeyv1.Inventory, error) {
pipeline := &kubekeyv1.Pipeline{
func (o *CreateClusterOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.Pipeline, *kkcorev1.Config, *kkcorev1.Inventory, error) {
pipeline := &kkcorev1.Pipeline{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "create-cluster-",
Namespace: o.Namespace,
Annotations: map[string]string{
kubekeyv1.BuiltinsProjectAnnotation: "",
kkcorev1.BuiltinsProjectAnnotation: "",
},
},
}
Expand All @@ -65,7 +65,7 @@ func (o *CreateClusterOptions) Complete(cmd *cobra.Command, args []string) (*kub
return nil, nil, nil, fmt.Errorf("%s\nSee '%s -h' for help and examples", cmd.Use, cmd.CommandPath())
}

pipeline.Spec = kubekeyv1.PipelineSpec{
pipeline.Spec = kkcorev1.PipelineSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}
Expand Down
18 changes: 9 additions & 9 deletions cmd/kk/app/options/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cliflag "k8s.io/component-base/cli/flag"

kubekeyv1 "github.com/kubesphere/kubekey/v4/pkg/apis/kubekey/v1"
kkcorev1 "github.com/kubesphere/kubekey/v4/pkg/apis/core/v1"
)

// ======================================================================================
Expand All @@ -39,13 +39,13 @@ func (o *InitOSOptions) Flags() cliflag.NamedFlagSets {
return fss
}

func (o InitOSOptions) Complete(cmd *cobra.Command, args []string) (*kubekeyv1.Pipeline, *kubekeyv1.Config, *kubekeyv1.Inventory, error) {
pipeline := &kubekeyv1.Pipeline{
func (o InitOSOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.Pipeline, *kkcorev1.Config, *kkcorev1.Inventory, error) {
pipeline := &kkcorev1.Pipeline{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "init-os-",
Namespace: o.Namespace,
Annotations: map[string]string{
kubekeyv1.BuiltinsProjectAnnotation: "",
kkcorev1.BuiltinsProjectAnnotation: "",
},
},
}
Expand All @@ -57,7 +57,7 @@ func (o InitOSOptions) Complete(cmd *cobra.Command, args []string) (*kubekeyv1.P
return nil, nil, nil, fmt.Errorf("%s\nSee '%s -h' for help and examples", cmd.Use, cmd.CommandPath())
}

pipeline.Spec = kubekeyv1.PipelineSpec{
pipeline.Spec = kkcorev1.PipelineSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}
Expand Down Expand Up @@ -87,13 +87,13 @@ func (o *InitRegistryOptions) Flags() cliflag.NamedFlagSets {
return fss
}

func (o InitRegistryOptions) Complete(cmd *cobra.Command, args []string) (*kubekeyv1.Pipeline, *kubekeyv1.Config, *kubekeyv1.Inventory, error) {
pipeline := &kubekeyv1.Pipeline{
func (o InitRegistryOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.Pipeline, *kkcorev1.Config, *kkcorev1.Inventory, error) {
pipeline := &kkcorev1.Pipeline{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "init-registry-",
Namespace: o.Namespace,
Annotations: map[string]string{
kubekeyv1.BuiltinsProjectAnnotation: "",
kkcorev1.BuiltinsProjectAnnotation: "",
},
},
}
Expand All @@ -105,7 +105,7 @@ func (o InitRegistryOptions) Complete(cmd *cobra.Command, args []string) (*kubek
return nil, nil, nil, fmt.Errorf("%s\nSee '%s -h' for help and examples", cmd.Use, cmd.CommandPath())
}

pipeline.Spec = kubekeyv1.PipelineSpec{
pipeline.Spec = kkcorev1.PipelineSpec{
Playbook: o.Playbook,
Debug: o.Debug,
}
Expand Down
24 changes: 12 additions & 12 deletions cmd/kk/app/options/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ import (
"k8s.io/klog/v2"
"sigs.k8s.io/yaml"

kubekeyv1 "github.com/kubesphere/kubekey/v4/pkg/apis/kubekey/v1"
kkcorev1 "github.com/kubesphere/kubekey/v4/pkg/apis/core/v1"
)

var defaultConfig = &kubekeyv1.Config{
var defaultConfig = &kkcorev1.Config{
TypeMeta: metav1.TypeMeta{
APIVersion: kubekeyv1.SchemeGroupVersion.String(),
APIVersion: kkcorev1.SchemeGroupVersion.String(),
Kind: "Config",
},
ObjectMeta: metav1.ObjectMeta{Name: "default"}}
var defaultInventory = &kubekeyv1.Inventory{
var defaultInventory = &kkcorev1.Inventory{
TypeMeta: metav1.TypeMeta{
APIVersion: kubekeyv1.SchemeGroupVersion.String(),
APIVersion: kkcorev1.SchemeGroupVersion.String(),
Kind: "Inventory",
},
ObjectMeta: metav1.ObjectMeta{Name: "default"}}
Expand Down Expand Up @@ -73,7 +73,7 @@ func newCommonOptions() CommonOptions {
klog.ErrorS(err, "get current dir error")
o.WorkDir = "/tmp/kubekey"
} else {
o.WorkDir = wd
o.WorkDir = filepath.Join(wd, "kubekey")
}
return o
}
Expand All @@ -91,7 +91,7 @@ func (o *CommonOptions) Flags() cliflag.NamedFlagSets {
return fss
}

func (o *CommonOptions) completeRef(pipeline *kubekeyv1.Pipeline) (*kubekeyv1.Config, *kubekeyv1.Inventory, error) {
func (o *CommonOptions) completeRef(pipeline *kkcorev1.Pipeline) (*kkcorev1.Config, *kkcorev1.Inventory, error) {
if !filepath.IsAbs(o.WorkDir) {
wd, err := os.Getwd()
if err != nil {
Expand Down Expand Up @@ -130,14 +130,14 @@ func (o *CommonOptions) completeRef(pipeline *kubekeyv1.Pipeline) (*kubekeyv1.Co
}

// genConfig generate config by ConfigFile and set value by command args.
func (o *CommonOptions) genConfig() (*kubekeyv1.Config, error) {
func (o *CommonOptions) genConfig() (*kkcorev1.Config, error) {
config := defaultConfig.DeepCopy()
if o.ConfigFile != "" {
cdata, err := os.ReadFile(o.ConfigFile)
if err != nil {
return nil, fmt.Errorf("read config file error: %w", err)
}
config = &kubekeyv1.Config{}
config = &kkcorev1.Config{}
if err := yaml.Unmarshal(cdata, config); err != nil {
return nil, fmt.Errorf("unmarshal config file error: %w", err)
}
Expand Down Expand Up @@ -174,15 +174,15 @@ func (o *CommonOptions) genConfig() (*kubekeyv1.Config, error) {
}

// genConfig generate config by ConfigFile and set value by command args.
func (o *CommonOptions) genInventory() (*kubekeyv1.Inventory, error) {
func (o *CommonOptions) genInventory() (*kkcorev1.Inventory, error) {
inventory := defaultInventory.DeepCopy()
if o.InventoryFile != "" {
cdata, err := os.ReadFile(o.InventoryFile)
if err != nil {
klog.V(4).ErrorS(err, "read config file error")
return nil, err
}
inventory = &kubekeyv1.Inventory{}
inventory = &kkcorev1.Inventory{}
if err := yaml.Unmarshal(cdata, inventory); err != nil {
klog.V(4).ErrorS(err, "unmarshal config file error")
return nil, err
Expand All @@ -200,7 +200,7 @@ func (o *CommonOptions) genInventory() (*kubekeyv1.Inventory, error) {
// if val is json string. convert to map or slice
// if val is TRUE,YES,Y. convert to bool type true.
// if val is FALSE,NO,N. convert to bool type false.
func setValue(config *kubekeyv1.Config, key, val string) error {
func setValue(config *kkcorev1.Config, key, val string) error {
switch {
case strings.HasPrefix(val, "{") && strings.HasSuffix(val, "{"):
var value map[string]any
Expand Down
10 changes: 5 additions & 5 deletions cmd/kk/app/options/precheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cliflag "k8s.io/component-base/cli/flag"

kubekeyv1 "github.com/kubesphere/kubekey/v4/pkg/apis/kubekey/v1"
kkcorev1 "github.com/kubesphere/kubekey/v4/pkg/apis/core/v1"
)

func NewPreCheckOptions() *PreCheckOptions {
Expand All @@ -39,13 +39,13 @@ func (o *PreCheckOptions) Flags() cliflag.NamedFlagSets {
return o.CommonOptions.Flags()
}

func (o *PreCheckOptions) Complete(cmd *cobra.Command, args []string) (*kubekeyv1.Pipeline, *kubekeyv1.Config, *kubekeyv1.Inventory, error) {
pipeline := &kubekeyv1.Pipeline{
func (o *PreCheckOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.Pipeline, *kkcorev1.Config, *kkcorev1.Inventory, error) {
pipeline := &kkcorev1.Pipeline{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "precheck-",
Namespace: o.Namespace,
Annotations: map[string]string{
kubekeyv1.BuiltinsProjectAnnotation: "",
kkcorev1.BuiltinsProjectAnnotation: "",
},
},
}
Expand All @@ -61,7 +61,7 @@ func (o *PreCheckOptions) Complete(cmd *cobra.Command, args []string) (*kubekeyv
o.Playbook = args[len(args)-1]
}

pipeline.Spec = kubekeyv1.PipelineSpec{
pipeline.Spec = kkcorev1.PipelineSpec{
Playbook: o.Playbook,
Debug: o.Debug,
Tags: tags,
Expand Down
10 changes: 5 additions & 5 deletions cmd/kk/app/options/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
cliflag "k8s.io/component-base/cli/flag"

kubekeyv1 "github.com/kubesphere/kubekey/v4/pkg/apis/kubekey/v1"
kkcorev1 "github.com/kubesphere/kubekey/v4/pkg/apis/core/v1"
)

type KubekeyRunOptions struct {
Expand Down Expand Up @@ -75,8 +75,8 @@ func (o *KubekeyRunOptions) Flags() cliflag.NamedFlagSets {
return fss
}

func (o *KubekeyRunOptions) Complete(cmd *cobra.Command, args []string) (*kubekeyv1.Pipeline, *kubekeyv1.Config, *kubekeyv1.Inventory, error) {
pipeline := &kubekeyv1.Pipeline{
func (o *KubekeyRunOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.Pipeline, *kkcorev1.Config, *kkcorev1.Inventory, error) {
pipeline := &kkcorev1.Pipeline{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "run-",
Namespace: o.Namespace,
Expand All @@ -90,8 +90,8 @@ func (o *KubekeyRunOptions) Complete(cmd *cobra.Command, args []string) (*kubeke
return nil, nil, nil, fmt.Errorf("%s\nSee '%s -h' for help and examples", cmd.Use, cmd.CommandPath())
}

pipeline.Spec = kubekeyv1.PipelineSpec{
Project: kubekeyv1.PipelineProject{
pipeline.Spec = kkcorev1.PipelineSpec{
Project: kkcorev1.PipelineProject{
Addr: o.ProjectAddr,
Name: o.ProjectName,
Branch: o.ProjectBranch,
Expand Down
8 changes: 4 additions & 4 deletions cmd/kk/app/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager/signals"

"github.com/kubesphere/kubekey/v4/cmd/kk/app/options"
kubekeyv1 "github.com/kubesphere/kubekey/v4/pkg/apis/kubekey/v1"
kkcorev1 "github.com/kubesphere/kubekey/v4/pkg/apis/core/v1"
_const "github.com/kubesphere/kubekey/v4/pkg/const"
"github.com/kubesphere/kubekey/v4/pkg/manager"
"github.com/kubesphere/kubekey/v4/pkg/proxy"
Expand Down Expand Up @@ -41,9 +41,9 @@ func newPipelineCommand() *cobra.Command {
return fmt.Errorf("could not create client: %w", err)
}
ctx := signals.SetupSignalHandler()
var pipeline = new(kubekeyv1.Pipeline)
var config = new(kubekeyv1.Config)
var inventory = new(kubekeyv1.Inventory)
var pipeline = new(kkcorev1.Pipeline)
var config = new(kkcorev1.Config)
var inventory = new(kkcorev1.Inventory)
if err := client.Get(ctx, ctrlclient.ObjectKey{
Name: o.Name,
Namespace: o.Namespace,
Expand Down
6 changes: 3 additions & 3 deletions cmd/kk/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager/signals"

"github.com/kubesphere/kubekey/v4/cmd/kk/app/options"
kubekeyv1 "github.com/kubesphere/kubekey/v4/pkg/apis/kubekey/v1"
kkcorev1 "github.com/kubesphere/kubekey/v4/pkg/apis/core/v1"
_const "github.com/kubesphere/kubekey/v4/pkg/const"
"github.com/kubesphere/kubekey/v4/pkg/manager"
"github.com/kubesphere/kubekey/v4/pkg/proxy"
Expand Down Expand Up @@ -63,7 +63,7 @@ func newRunCommand() *cobra.Command {
return cmd
}

func run(ctx context.Context, pipeline *kubekeyv1.Pipeline, config *kubekeyv1.Config, inventory *kubekeyv1.Inventory) error {
func run(ctx context.Context, pipeline *kkcorev1.Pipeline, config *kkcorev1.Config, inventory *kkcorev1.Inventory) error {
restconfig, err := proxy.NewConfig(&rest.Config{})
if err != nil {
return fmt.Errorf("could not get rest config: %w", err)
Expand All @@ -84,7 +84,7 @@ func run(ctx context.Context, pipeline *kubekeyv1.Pipeline, config *kubekeyv1.Co
klog.ErrorS(err, "Create inventory error", "pipeline", ctrlclient.ObjectKeyFromObject(pipeline))
return err
}
pipeline.Status.Phase = kubekeyv1.PipelinePhaseRunning
pipeline.Status.Phase = kkcorev1.PipelinePhaseRunning
if err := client.Create(ctx, pipeline); err != nil {
klog.ErrorS(err, "Create pipeline error", "pipeline", ctrlclient.ObjectKeyFromObject(pipeline))
return err
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading