Skip to content

Commit b69ce13

Browse files
committed
fix: rename image_registry to registry
Signed-off-by: joyceliu <[email protected]>
1 parent 756b1f4 commit b69ce13

File tree

10 files changed

+26
-50
lines changed

10 files changed

+26
-50
lines changed

builtin/capkk/roles/uninstall/cri/tasks/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
- .kube_version | semverCompare ">=v1.24.0"
1515
- .cridockerd_version | empty | not
1616

17-
- name: Delete residue files
17+
- name: Delete cri residue files
1818
command: |
1919
rm -f /usr/local/bin/crictl

builtin/capkk/roles/uninstall/cri/tasks/uninstall_containerd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
rm -rf /etc/systemd/system/containerd.service*
77
systemctl daemon-reload
88
9-
- name: Delete residue files
9+
- name: Delete containerd residue files
1010
command: |
1111
rm -rf {{ .cri.containerd.data_root }}
1212
rm -rf /etc/containerd

builtin/capkk/roles/uninstall/cri/tasks/uninstall_cridockerd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
rm -rf /etc/systemd/system/cri-dockerd.service*
88
systemctl daemon-reload
99
10-
- name: Delete residue files
10+
- name: Delete cri-dockerd residue files
1111
command: |
1212
rm -rf /etc/cri-dockerd
1313
rm -f /usr/local/bin/cri-dockerd

builtin/capkk/roles/uninstall/cri/tasks/uninstall_docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- name: Uninstall containerd
1111
include_tasks: uninstall_containerd.yaml
1212

13-
- name: Delete residue files
13+
- name: Delete docker residue files
1414
command: |
1515
rm -rf {{ .cri.docker.data_root }}
1616
rm -rf /etc/docker
File renamed without changes.

builtin/core/roles/precheck/env_check/tasks/main.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@
1515

1616
- include_tasks: nfs.yaml
1717
tags: ["nfs"]
18+
19+
- include_tasks: image_registry.yaml
20+
tags: ["image_registry"]

builtin/core/roles/uninstall/cri/tasks/uninstall_docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- name: Uninstall containerd
1111
include_tasks: uninstall_containerd.yaml
1212

13-
- name: Delete residue files
13+
- name: Delete docker residue files
1414
command: |
1515
rm -rf {{ .cri.docker.data_root }}
1616
rm -rf /etc/docker

cmd/kk/app/builtin/delete.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func NewDeleteCommand() *cobra.Command {
3535
// Add subcommands for cluster, nodes, and image registry deletion
3636
cmd.AddCommand(newDeleteClusterCommand())
3737
cmd.AddCommand(newDeleteNodesCommand())
38-
cmd.AddCommand(newDeleteImageRegistryCommand())
38+
cmd.AddCommand(newDeleteRegistryCommand())
3939

4040
return cmd
4141
}
@@ -108,18 +108,18 @@ func newDeleteNodesCommand() *cobra.Command {
108108
return cmd
109109
}
110110

111-
// newDeleteImageRegistryCommand creates a new command for deleting the image registry created by kubekey.
111+
// newDeleteRegistryCommand creates a new command for deleting the image registry created by kubekey.
112112
// It uses the delete_image_registry.yaml playbook to remove the image registry and optionally its container runtime.
113-
func newDeleteImageRegistryCommand() *cobra.Command {
113+
func newDeleteRegistryCommand() *cobra.Command {
114114
// Initialize options for deleting the image registry
115-
o := builtin.NewDeleteImageRegistryOptions()
115+
o := builtin.NewDeleteRegistryOptions()
116116

117117
cmd := &cobra.Command{
118-
Use: "image_registry",
119-
Short: "Delete a image_registry which create by kubekey.",
118+
Use: "registry",
119+
Short: "Delete a image registry which create by kubekey.",
120120
RunE: func(cmd *cobra.Command, args []string) error {
121121
// Complete the configuration and create a playbook for deleting the image registry
122-
playbook, err := o.Complete(cmd, []string{"playbooks/delete_image_registry.yaml"})
122+
playbook, err := o.Complete(cmd, []string{"playbooks/delete_registry.yaml"})
123123
if err != nil {
124124
return err
125125
}

cmd/kk/app/options/builtin/delete.go

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -218,50 +218,35 @@ func (o *DeleteNodesOptions) completeConfig(nodes []string) error {
218218
}
219219

220220
// ======================================================================================
221-
// delete image_registry
221+
// delete registry
222222
// ======================================================================================
223223

224-
// NewDeleteImageRegistryOptions creates a new DeleteImageRegistryOptions with default values
225-
func NewDeleteImageRegistryOptions() *DeleteImageRegistryOptions {
224+
// NewDeleteRegistryOptions creates a new DeleteRegistryOptions with default values
225+
func NewDeleteRegistryOptions() *DeleteRegistryOptions {
226226
// set default value for DeleteImageRegistryOptions
227-
o := &DeleteImageRegistryOptions{
227+
o := &DeleteRegistryOptions{
228228
CommonOptions: options.NewCommonOptions(),
229-
Kubernetes: defaultKubeVersion,
230-
}
231-
// Set the function to get the config for the specified Kubernetes version
232-
o.CommonOptions.GetConfigFunc = func() (*kkcorev1.Config, error) {
233-
data, err := getConfig(o.Kubernetes)
234-
if err != nil {
235-
return nil, err
236-
}
237-
config := &kkcorev1.Config{}
238-
return config, errors.Wrapf(yaml.Unmarshal(data, config), "failed to unmarshal local configFile for kube_version: %q.", o.Kubernetes)
239229
}
240230
// Set the function to get the inventory
241231
o.CommonOptions.GetInventoryFunc = getInventory
242232

243233
return o
244234
}
245235

246-
// DeleteImageRegistryOptions contains options for deleting an image_registry created by kubekey
247-
type DeleteImageRegistryOptions struct {
236+
// DeleteRegistryOptions contains options for deleting an image_registry created by kubekey
237+
type DeleteRegistryOptions struct {
248238
options.CommonOptions
249-
// Kubernetes version which the cluster will install.
250-
Kubernetes string
251239
}
252240

253241
// Flags returns the flag sets for DeleteImageRegistryOptions
254-
func (o *DeleteImageRegistryOptions) Flags() cliflag.NamedFlagSets {
242+
func (o *DeleteRegistryOptions) Flags() cliflag.NamedFlagSets {
255243
fss := o.CommonOptions.Flags()
256-
kfs := fss.FlagSet("config")
257-
// Add a flag for specifying the Kubernetes version
258-
kfs.StringVar(&o.Kubernetes, "with-kubernetes", o.Kubernetes, fmt.Sprintf("Specify a supported version of kubernetes. default is %s", o.Kubernetes))
259244

260245
return fss
261246
}
262247

263248
// Complete validates and completes the DeleteImageRegistryOptions configuration
264-
func (o *DeleteImageRegistryOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.Playbook, error) {
249+
func (o *DeleteRegistryOptions) Complete(cmd *cobra.Command, args []string) (*kkcorev1.Playbook, error) {
265250
// Initialize playbook metadata for deleting image registry
266251
playbook := &kkcorev1.Playbook{
267252
ObjectMeta: metav1.ObjectMeta{
@@ -291,17 +276,5 @@ func (o *DeleteImageRegistryOptions) Complete(cmd *cobra.Command, args []string)
291276
}
292277

293278
// Complete config specific to delete image registry
294-
return playbook, o.completeConfig()
295-
}
296-
297-
// completeConfig updates the configuration with container manager settings
298-
func (o *DeleteImageRegistryOptions) completeConfig() error {
299-
// If kube_version is not set in config, set it to the specified Kubernetes version
300-
if _, ok, _ := unstructured.NestedFieldNoCopy(o.CommonOptions.Config.Value(), "kube_version"); !ok {
301-
if err := unstructured.SetNestedField(o.CommonOptions.Config.Value(), o.Kubernetes, "kube_version"); err != nil {
302-
return errors.Wrapf(err, "failed to set %q to config", "kube_version")
303-
}
304-
}
305-
306-
return nil
279+
return playbook, nil
307280
}

pkg/executor/task_executor.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ func (e *taskExecutor) Exec(ctx context.Context) error {
8282
// runTaskLoop runs a task in a loop until it completes or times out.
8383
// It periodically reconciles the task status and executes the task when it enters the running phase.
8484
func (e *taskExecutor) runTaskLoop(ctx context.Context) error {
85-
klog.V(5).InfoS("begin run task", "task", ctrlclient.ObjectKeyFromObject(e.task))
86-
defer klog.V(5).InfoS("end run task", "task", ctrlclient.ObjectKeyFromObject(e.task))
85+
klog.V(3).InfoS("begin run task", "task", ctrlclient.ObjectKeyFromObject(e.task))
86+
defer klog.V(3).InfoS("end run task", "task", ctrlclient.ObjectKeyFromObject(e.task))
8787

8888
// Add role prefix to log output if role annotation exists
8989
var roleLog string

0 commit comments

Comments
 (0)