-
Notifications
You must be signed in to change notification settings - Fork 205
Support the event watcher in the app config #3729
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
Conversation
|
@knanao 👍 @knanao @khanhtc1202 I think firstly we should list all available configuration patterns to find the suitable one. Let's comment all patterns you can think of. apiVersion: pipecd.dev/v1beta1
kind: ApplicationKind
spec:
name: foo
labels:
team: bar
events:
- name: helloworld-image-update
labels:
env: dev
appName: helloworld
pushHandler:
commitMessage: Update values by Event watcher
replacements:
- file: deployment.yaml
yamlField: $.spec.template.spec.containers[0].imageapiVersion: pipecd.dev/v1beta1
kind: ApplicationKind
spec:
name: foo
labels:
team: bar
eventWatcher:
- event:
name: helloworld-image-update
labels:
env: dev
appName: helloworld
handler:
gitUpdate:
replacements:
- file: deployment.yaml
yamlField: $.spec.template.spec.containers[0].image
commitMessage: Update values by Event watcherapiVersion: pipecd.dev/v1beta1
kind: ApplicationKind
spec:
name: foo
labels:
team: bar
eventWatcher:
- event:
name: helloworld-image-update
labels:
env: dev
appName: helloworld
gitPushHandler:
replacements:
- file: deployment.yaml
yamlField: $.spec.template.spec.containers[0].image
commitMessage: Update values by Event watcherapiVersion: pipecd.dev/v1beta1
kind: ApplicationKind
spec:
name: foo
labels:
team: bar
eventWatcher:
- event:
name: helloworld-image-update
labels:
env: dev
appName: helloworld
handler:
type: GIT_UPDATE
config:
replacements:
- file: deployment.yaml
yamlField: $.spec.template.spec.containers[0].image
commitMessage: Update values by Event watcher |
|
@nghialv apiVersion: pipecd.dev/v1beta1
kind: ApplicationKind
spec:
name: foo
labels:
team: bar
eventWatcher:
- matcher:
name: helloworld-image-update
labels:
env: dev
appName: helloworld
handler:
gitUpdate:
replacements:
- file: deployment.yaml
yamlField: $.spec.template.spec.containers[0].image
commitMessage: Update values by Event watcher
apiVersion: pipecd.dev/v1beta1
kind: ApplicationKind
spec:
name: foo
labels:
team: bar
eventWatcher:
- matcher:
name: helloworld-image-update
labels:
env: dev
appName: helloworld
handler:
type: GIT_UPDATE
config:
replacements:
- file: deployment.yaml
yamlField: $.spec.template.spec.containers[0].image
commitMessage: Update values by Event watcherapiVersion: pipecd.dev/v1beta1
kind: ApplicationKind
spec:
name: foo
labels:
team: bar
eventWatcher:
- matcher:
name: helloworld-image-update
labels:
env: dev
appName: helloworld
gitUpdator:
replacements:
- file: deployment.yaml
yamlField: $.spec.template.spec.containers[0].image
commitMessage: Update values by Event watcherapiVersion: pipecd.dev/v1beta1
kind: ApplicationKind
spec:
name: foo
labels:
team: bar
eventWatcher:
- matchers:
- name: helloworld-image-update
labels:
env: dev
appName: helloworld
handler:
type: GIT_UPDATE
config:
replacements:
- file: deployment.yaml
yamlField: $.spec.template.spec.containers[0].image
commitMessage: Update values by Event watcher |
|
Finally, we decided it into the config pattern of 6. |
|
@nghialv @khanhtc1202 apiVersion: pipecd.dev/v1beta1
kind: ApplicationKind
spec:
name: foo
labels:
team: bar
eventWatchers:
- matcher:
name: helloworld-image-update
labels:
env: dev
appName: helloworld
handler:
type: GIT_UPDATE
config:
replacements:
- file: deployment.yaml
yamlField: $.spec.template.spec.containers[0].image
commitMessage: Update values by Event watcher |
|
how about |
|
Since the elements of the event watcher are arrays, |
Co-authored-by: Khanh Tran <[email protected]>
I'm a bit concerned about this. We want to make EventWatcher configuration under .pipe/ directory deprecated, so I think instead of making the configuration in .piped/ be referred first (with higher priority), the configuration in the application configuration should have a higher priority. And if both exist, only application configuration eventsWatcher should be applied, we only apply the EventWatcher config under .pipe/ dir if it's the only one that existed. WDYT? |
|
@khanhtc1202
If we had to prioritize, I would agree totally.
The reason for this implementation without prioritization is to allow for migration from one environment to another. In order to be able to migrate gradually from one environment to another, it is necessary to temporarily make a state in which settings can be entered in both .pipe/ and application config hence I did like this. But I would like to hear from guys. |
|
I get your point 👍 But still think if we allow both places, duplicates may occur 🤔 My idea is to allow only one (in application config or in .pipe/ dir) users will be aware of the change and migrate it while adding a new eventWatcher to their application's configuration. |
I think the duplicates won't occur in this implementation because it is processed sequentially.
yeah, it's not user-friendly actually hence I adapted like that. wdyt? @nghialv |
|
@knanao @khanhtc1202 I also think having a phase where both configuration ways are supported is more user-friendly. |
|
@knanao Thank you. Looks fine. Just added a nit. |
Co-authored-by: nghialv <[email protected]>
nghialv
left a comment
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.
👍
khanhtc1202
left a comment
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.
Here you go 👍
What this PR does / why we need it:
This allows settings related to EventWatcher to be defined in the application configuration file as well as
./pipe.Both configurations of the EventWatcher under ./pipe and under the application configuration file are referred to.
NOTE: In the future ./pipe will be Deprecated.
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: