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

Add validation for replicas #717

Merged
merged 1 commit into from
Aug 20, 2020

Conversation

savitaashture
Copy link
Contributor

@savitaashture savitaashture commented Aug 17, 2020

Changes

  1. Add changes to validate invalid replicas specified by user as part of eventlistener spec.
  2. Modified in order not to show replicas field after EL creation when replicas are not specified as part of EL spec.

Fix: #716

Signed-off-by: Savita Ashture sashture@redhat.com

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Release Notes

EventListener spec validation ensures proper validation when user specifies spec.replicas values as negative or zero
ex:

cat <<EOF | kubectl create -f -
apiVersion: triggers.tekton.dev/v1alpha1
kind: EventListener
metadata:
  name: bitbucket-listener
spec:
  serviceAccountName: tekton-triggers-bitbucket-sa
  replicas: 0
  triggers:
    - name: bitbucket-triggers
      bindings:
        - ref: bitbucket-binding
      template:
        name: bitbucket-template
EOF

Gives response like below

Error from server (BadRequest): error when creating "STDIN": admission webhook "validation.webhook.triggers.tekton.dev" denied the request: validation failed: invalid value: 0: spec.replicas

@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 17, 2020
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 93.1% 93.3% 0.2

Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 18, 2020
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 19, 2020
@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 93.1% 93.4% 0.3

@tekton-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-tekton-triggers-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/triggers/v1alpha1/event_listener_validation.go 93.1% 93.4% 0.3

@savitaashture
Copy link
Contributor Author

/test pull-tekton-triggers-integration-tests

@dibyom
Copy link
Member

dibyom commented Aug 19, 2020

/test pull-tekton-triggers-integration-tests

Thanks @savitaashture
This is a feature right? So, we should add something to the release notes section.

@dibyom
Copy link
Member

dibyom commented Aug 19, 2020

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 19, 2020
@savitaashture
Copy link
Contributor Author

This is a feature right? So, we should add something to the release notes section.

@dibyom Yes this is a feature
Updated release notes section

Thank you

@savitaashture
Copy link
Contributor Author

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 19, 2020
@dibyom
Copy link
Member

dibyom commented Aug 19, 2020

/test pull-tekton-triggers-integration-tests

@dibyom
Copy link
Member

dibyom commented Aug 20, 2020

/approve

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 20, 2020
@tekton-robot tekton-robot merged commit 1605ff6 into tektoncd:master Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle validation for replicas
4 participants