@@ -218,50 +218,35 @@ func (o *DeleteNodesOptions) completeConfig(nodes []string) error {
218
218
}
219
219
220
220
// ======================================================================================
221
- // delete image_registry
221
+ // delete registry
222
222
// ======================================================================================
223
223
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 {
226
226
// set default value for DeleteImageRegistryOptions
227
- o := & DeleteImageRegistryOptions {
227
+ o := & DeleteRegistryOptions {
228
228
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 )
239
229
}
240
230
// Set the function to get the inventory
241
231
o .CommonOptions .GetInventoryFunc = getInventory
242
232
243
233
return o
244
234
}
245
235
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 {
248
238
options.CommonOptions
249
- // Kubernetes version which the cluster will install.
250
- Kubernetes string
251
239
}
252
240
253
241
// Flags returns the flag sets for DeleteImageRegistryOptions
254
- func (o * DeleteImageRegistryOptions ) Flags () cliflag.NamedFlagSets {
242
+ func (o * DeleteRegistryOptions ) Flags () cliflag.NamedFlagSets {
255
243
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 ))
259
244
260
245
return fss
261
246
}
262
247
263
248
// 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 ) {
265
250
// Initialize playbook metadata for deleting image registry
266
251
playbook := & kkcorev1.Playbook {
267
252
ObjectMeta : metav1.ObjectMeta {
@@ -291,17 +276,5 @@ func (o *DeleteImageRegistryOptions) Complete(cmd *cobra.Command, args []string)
291
276
}
292
277
293
278
// 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
307
280
}
0 commit comments