Skip to content
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

Refactor: refactor kube-trigger to cue-template-based trigger #19

Merged
merged 1 commit into from
Jan 11, 2023

Conversation

FogDong
Copy link
Member

@FogDong FogDong commented Jan 11, 2023

Signed-off-by: FogDong dongtianxin.tx@alibaba-inc.com

This PR reactor kube-trigger to cue-template-based trigger, and the config is like below:

# A trigger is a group of Source, Filters, and Actions.
# You can add multiple triggers.
triggers:
  - source:
      template: k8s-resource-watcher
      properties:
        # We are interested in ConfigMap events.
        apiVersion: "v1"
        kind: ConfigMap
        namespace: default
        # Only watch update event.
        events:
          - update
    filters:
      - template: cue-validator
        # Filter the events above.
        properties:
            # Filter by validating the object data using CUE.
            # For example, we are filtering by ConfigMap names (metadata.name) from above.
            # Only ConfigMaps with names that satisfy this regexp "this-will-trigger-update-.*" will be kept.
            template: |
              metadata: name: =~"this-will-trigger-update-.*"
    actions:
      # Bump Application Revision to update Application.
      - template: bump-application-revision
        properties:
          namespace: default
          # Select Applications to bump using labels.
          labelSelectors:
            my-label: my-value

Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
Copy link
Member

@charlie0129 charlie0129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, LGTM

@charlie0129 charlie0129 merged commit 9914231 into kubevela:main Jan 11, 2023
semmet95 pushed a commit to semmet95/kube-trigger that referenced this pull request May 10, 2023
…la#19)

Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>

Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
Signed-off-by: Amit Singh <singhamitch@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants