-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP/Feedback needed] Add a duplicate strategy to deploy ephemeral environment #274
Conversation
Signed-off-by: GregoireW <24318548+GregoireW@users.noreply.github.com>
Signed-off-by: GregoireW <24318548+GregoireW@users.noreply.github.com>
Signed-off-by: GregoireW <24318548+GregoireW@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work so far. 🙌
Left some initial quick comments here.
limitations under the License. | ||
*/ | ||
|
||
package v1beta2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no API changes here, other than adding another value for the enum which doesn't really count. The API version bump is not justified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, then good news... Wasn't sure of this. I will revert.
// uses kyaml setters. NB the value in the enum annotation for the | ||
// type, above. | ||
UpdateStrategySetters UpdateStrategyName = "Setters" | ||
UpdateStrategyDuplicates UpdateStrategyName = "Duplicates" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't say this is really a new strategy as your implementation here still relies on the kyaml setters. This is more of an extension to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setters will just change value on a given object, Duplicates will duplicates an object (well Create additional object, modify them or delete them). Kyaml is just used to manage this duplication. So big difference.
withoutDiscriminator := func (p imagev1_reflect.ImagePolicy) bool{ | ||
return p.Spec.FilterTags==nil || p.Spec.FilterTags.Discriminator == "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are formatting inconsistencies here. Please use gofmt
, running make locally before committing would do.
withoutDiscriminator := func (p imagev1_reflect.ImagePolicy) bool{ | |
return p.Spec.FilterTags==nil || p.Spec.FilterTags.Discriminator == "" | |
withoutDiscriminator := func (p imagev1_reflect.ImagePolicy) bool { | |
return p.Spec.FilterTags == nil || p.Spec.FilterTags.Discriminator == "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do.
@relu Now you check both PR on image-reflector and here on image-automation, what do you (well the fluxcd team) think about that ? The json I use to apply the policy is something like if so I can finish this :
|
will open a discussion about this |
This has to be used with the PR in the image-reflector-controller : fluxcd/image-reflector-controller#211
This PR add a duplicate strategy.
If this strategy find a kubernetes object referencing an image policy with image distribution, then it will duplicate the object in a new file which name is suffixed with
__xxx
where xxx is the discriminator. (it means a single file cannot contains multiple policy.).for instance, a
test.yaml
file withthen a policy like:
will update the
test.yaml
file to the latest image, but will not use the discriminator:and will create 2 files
test__123.yaml
andtest__124.yaml
which will contains (the 123 exemple) (comment has been removed to prevent loop creation)
The comment has been extended to get a
template
attribute. This attribute is a simple template which can use the attributes, image and name.