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

feat(annotations): Adds annotation flag for service create and update #422

Merged
merged 4 commits into from
Oct 4, 2019

Conversation

navidshaikh
Copy link
Collaborator

Fixes #327

Proposed Changes

  • Adds specified annotations to service object meta and revision template meta
  • Adds --annotation / -a flag to service create and update options
  • User can specify '-' at the end of the annotation key to remove an annotation
  • Adds unit and e2e tests
  • Updates docs accordingly

/lint

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Sep 30, 2019
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@navidshaikh: 0 warnings.

In response to this:

Fixes #327

Proposed Changes

  • Adds specified annotations to service object meta and revision template meta
  • Adds --annotation / -a flag to service create and update options
  • User can specify '-' at the end of the annotation key to remove an annotation
  • Adds unit and e2e tests
  • Updates docs accordingly

/lint

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 30, 2019
docs/cmd/kn_plugin.md Outdated Show resolved Hide resolved
}

// UpdatMaxScale updates max scale annotation
func UpdateMaxScale(template *servingv1alpha1.RevisionTemplateSpec, max int) error {
return UpdateAnnotation(template, autoscaling.MaxScaleAnnotationKey, strconv.Itoa(max))
return UpdateRevisionTemplateAnnotation(template, autoscaling.MaxScaleAnnotationKey, strconv.Itoa(max))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated the name to be explicit

// UpdateAnnotation updates (or adds) an annotation to the given service
func UpdateAnnotation(template *servingv1alpha1.RevisionTemplateSpec, annotation string, value string) error {
// UpdateRevisionTemplateAnnotation updates an annotation for the given Revision Template.
// Also validates the autoscaling annotation values
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added note about validation

autoscaling.TargetAnnotationKey)
}

return UpdateAnnotation(template, autoscaling.TargetAnnotationKey, strconv.Itoa(target))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed the pending TODO

@navidshaikh navidshaikh changed the title (feat/annotations): Adds annotation flag for service create and update feat(annotations): Adds annotation flag for service create and update Sep 30, 2019
@navidshaikh
Copy link
Collaborator Author

This is ready for review.

Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

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

Few small items...

docs/cmd/kn_plugin.md Outdated Show resolved Hide resolved
docs/cmd/kn_service_create.md Show resolved Hide resolved
pkg/kn/commands/service/configuration_edit_flags.go Outdated Show resolved Hide resolved
@navidshaikh
Copy link
Collaborator Author

/test pull-knative-client-go-coverage

@navidshaikh
Copy link
Collaborator Author

Added mock tests for service update with annotations, the negative go coverage delta should change now.

@rhuss rhuss self-assigned this Oct 1, 2019
```

### Options

```
-a, --annotation stringArray Service annotation to set. name=value; you may provide this flag any number of times to set multiple annotations. To unset, specify the annotation name followed by a "-" (e.g., name-).
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I would pick having the short -a opt. I feel like those shoudl be used sparingly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wasn't sure on using -a too and was hoping for some feedback :+1
Its better to be explicit for annotations. Removing -a.
Thanks!

  - Adds specified annotations to service object meta and revision template meta
  - Adds --annotation / -a flag to service create and update options
  - User can specify '-' at the end of the annotation key to remove an annotation
  - Adds unit and e2e tests
  - Updates docs and changelog accordingly
@knative-metrics-robot
Copy link

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

File Old Coverage New Coverage Delta
pkg/kn/commands/service/configuration_edit_flags.go 83.7% 83.9% 0.2
pkg/serving/config_changes.go 81.0% 82.4% 1.4

Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

Thanks !

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 4, 2019
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: navidshaikh, rhuss

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

@knative-prow-robot knative-prow-robot merged commit 2f7fa6a into knative:master Oct 4, 2019
@navidshaikh navidshaikh deleted the pr/annotations branch October 4, 2019 13:44
maximilien pushed a commit to maximilien/client that referenced this pull request Oct 8, 2019
…knative#422)

* feat(annotations): Adds annotation flag for service create and update

  - Adds specified annotations to service object meta and revision template meta
  - Adds --annotation / -a flag to service create and update options
  - User can specify '-' at the end of the annotation key to remove an annotation
  - Adds unit and e2e tests
  - Updates docs and changelog accordingly

* Adds example for service create with annotation

* Adds mock unit tests for service update with annotations

* Removes the short hand -a for annotation flag
navidshaikh added a commit to navidshaikh/client that referenced this pull request Aug 19, 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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding annotation
7 participants