-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ImageSwapPolicy defines the mutation strategy used by the webhook.
feat: ImageCopyPolicy defines the image copy strategy used by the webhook.� feat: check if image exists before mutating feat: skopeo will retry 3 times before failing feat: debug logs will show skopeo output
- Loading branch information
Showing
10 changed files
with
219 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package types | ||
|
||
import "fmt" | ||
|
||
type ImageSwapPolicy int | ||
|
||
const ( | ||
ImageSwapPolicyAlways = iota | ||
ImageSwapPolicyExists | ||
) | ||
|
||
func (p ImageSwapPolicy) String() string { | ||
return [...]string{"always", "exists"}[p] | ||
} | ||
|
||
func ParseImageSwapPolicy(p string) (ImageSwapPolicy, error) { | ||
switch p { | ||
case ImageSwapPolicy(ImageSwapPolicyAlways).String(): | ||
return ImageSwapPolicyAlways, nil | ||
case ImageSwapPolicy(ImageSwapPolicyExists).String(): | ||
return ImageSwapPolicyExists, nil | ||
} | ||
return ImageSwapPolicyExists, fmt.Errorf("unknown image swap policy string: '%s', defaulting to exists", p) | ||
} | ||
|
||
type ImageCopyPolicy int | ||
|
||
const ( | ||
ImageCopyPolicyDelayed = iota | ||
ImageCopyPolicyImmediate | ||
ImageCopyPolicyForce | ||
) | ||
|
||
func (p ImageCopyPolicy) String() string { | ||
return [...]string{"delayed", "immediate", "force"}[p] | ||
} | ||
|
||
func ParseImageCopyPolicy(p string) (ImageCopyPolicy, error) { | ||
switch p { | ||
case ImageCopyPolicy(ImageCopyPolicyDelayed).String(): | ||
return ImageCopyPolicyDelayed, nil | ||
case ImageCopyPolicy(ImageCopyPolicyImmediate).String(): | ||
return ImageCopyPolicyImmediate, nil | ||
case ImageCopyPolicy(ImageCopyPolicyForce).String(): | ||
return ImageCopyPolicyForce, nil | ||
} | ||
return ImageCopyPolicyDelayed, fmt.Errorf("unknown image copy policy string: '%s', defaulting to delayed", p) | ||
} |
Oops, something went wrong.