Skip to content

Commit

Permalink
feature(main): fix check image type after image pull (#1066)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuisongliu authored May 27, 2022
1 parent ee17bd0 commit 485db0c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/apply/processor/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func (c *CreateProcessor) Check(cluster *v2.Cluster) error {
if err != nil {
return err
}

return nil
}
func (c *CreateProcessor) CheckImageType(cluster *v2.Cluster) error {
ociList, err := c.ImageManager.Inspect(cluster.Spec.Image...)
if err != nil {
return err
Expand All @@ -98,12 +102,14 @@ func (c *CreateProcessor) Check(cluster *v2.Cluster) error {
}
return nil
}

func (c *CreateProcessor) PreProcess(cluster *v2.Cluster) error {
err := c.RegistryManager.Pull(cluster.Spec.Image...)
if err != nil {
return err
}
if err = c.CheckImageType(cluster); err != nil {
return err
}
for _, img := range cluster.Spec.Image {
clusterManifest, err := c.ClusterManager.Create(fmt.Sprintf("%s-%s", cluster.Name, rand.Generator(8)), img)
if err != nil {
Expand Down

0 comments on commit 485db0c

Please sign in to comment.