1
0
mirror of synced 2026-04-02 13:56:56 +00:00

Add delete, export, get image-update

This uses the established abstractions to implement the usual
subcommands for the ImageUpdateAutomation type.

I've called the sub-subcommand in each case `image-update`, as a
fairly safe shorthand for the much longer `image-update-automation`.

Signed-off-by: Michael Bridgen <michael@weave.works>
This commit is contained in:
Michael Bridgen
2020-12-07 16:43:10 +00:00
parent 433628791b
commit f316aff2d3
11 changed files with 345 additions and 21 deletions

View File

@@ -94,7 +94,7 @@ func createAutoImageUpdateRun(cmd *cobra.Command, args []string) error {
},
Branch: imageUpdateArgs.branch,
},
RunInterval: &metav1.Duration{Duration: interval},
Interval: metav1.Duration{Duration: interval},
Update: autov1.UpdateStrategy{
Setters: &autov1.SettersStrategy{},
},
@@ -107,7 +107,7 @@ func createAutoImageUpdateRun(cmd *cobra.Command, args []string) error {
}
if export {
return printExport(exportImageUpdateAutomation(&update))
return printExport(exportImageUpdate(&update))
}
// I don't need these until attempting to upsert the object, but
@@ -189,21 +189,3 @@ func isImageUpdateAutomationReady(ctx context.Context, kubeClient client.Client,
return false, nil
}
}
func exportImageUpdateAutomation(update *autov1.ImageUpdateAutomation) interface{} {
gvk := autov1.GroupVersion.WithKind("ImageUpdateAutomation") // TODO replace with constant
export := autov1.ImageUpdateAutomation{
TypeMeta: metav1.TypeMeta{
Kind: gvk.Kind,
APIVersion: gvk.GroupVersion().String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: update.Name,
Namespace: update.Namespace,
Labels: update.Labels,
Annotations: update.Annotations,
},
Spec: update.Spec,
}
return export
}