Skip to content

Add possibility to create services in release mode#3070

Merged
knative-prow-robot merged 15 commits intoknative:masterfrom
vagababov:2819-add-latest
Feb 5, 2019
Merged

Add possibility to create services in release mode#3070
knative-prow-robot merged 15 commits intoknative:masterfrom
vagababov:2819-add-latest

Conversation

@vagababov
Copy link
Copy Markdown
Contributor

@vagababov vagababov commented Feb 2, 2019

For #2819
Implement @latestRevision shorthand to be able to create releases directly in the release mode.

I need integration tests, which will be either in this pr or separately.
Doc/spec update will be in separate pr.

/lint
-->

Fixes #

Proposed Changes

  • add a named target @latestRevision
  • when encountered it's routed to configuration, effectively picking the latest revision.

For example:

apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
  name: s-2
  namespace: default
spec:
  release:
    revisions:
    - "@latestRevision"
    configuration:
      revisionTemplate:
        spec:
          container:
            image: gcr.io/dm-vagababov/helloworld:the-one-i-love
            env:
            - name: TARGET
              value: "→test string←"

/cc @dgerd @mattmoor

@knative-prow-robot knative-prow-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 2, 2019
Copy link
Copy Markdown
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.

@vagababov: 0 warnings.

Details

In response to this:

For #2819
Implement @latestRevision shorthand to be able to create releases directly in the release mode.

I need integration tests, which will be either in this pr or separately.
Doc/spec update will be in separate pr.

/lint
-->

Fixes #

Proposed Changes

  • add a named target @latestRevision
  • when encountered it's routed to configuration, effectively picking the latest revision.

For example:

apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
 name: s-2
 namespace: default
spec:
 release:
   revisions:
   - "@latestRevision"
   configuration:
     revisionTemplate:
       spec:
         container:
           image: gcr.io/dm-vagababov/helloworld:the-one-i-love
           env:
           - name: TARGET
             value: "→test string←"

/cc @dgerd @mattmoor

Also /cc @sixolet @cooperneil

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.

@vagababov
Copy link
Copy Markdown
Contributor Author

Also:
/cc @sixolet @cooperneil

@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/v1alpha1/service/resources/route.go 100.0% 92.6% -7.4

@vagababov
Copy link
Copy Markdown
Contributor Author

/test pull-knative-serving-go-coverage

Copy link
Copy Markdown

@dgerd dgerd left a comment

Choose a reason for hiding this comment

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

Looks good so far. Excited to see this get merged.

Don't forget to update https://github.com/knative/serving/blob/master/docs/spec/spec.md#service with the new documentation.

Comment thread pkg/apis/serving/v1alpha1/service_validation.go Outdated
Dan Gerdesmeier and others added 2 commits February 1, 2019 22:14
Co-Authored-By: vagababov <vagababov@users.noreply.github.com>
@duglin
Copy link
Copy Markdown

duglin commented Feb 3, 2019

@vagababov to be clear... after this PR is merged

  • if someone was to update the revisionTemplate in the sample you gave it would roll out a new revision of the Service and all existing Pod would be replace with new ones
  • if someone was to update the "build" definition in that config, it would build a new image and then roll that out to replace all existing Pods

right?

@vagababov
Copy link
Copy Markdown
Contributor Author

Yes, the example I have above would basically behave as runLatest (which kind of makes it obsolete, as happened with the pinned).

@duglin
Copy link
Copy Markdown

duglin commented Feb 3, 2019

Great - thanks

Copy link
Copy Markdown
Contributor

@markusthoemmes markusthoemmes left a comment

Choose a reason for hiding this comment

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

I have the same comment regarding the releaseLatestRevisionKeyword constant. Seems to me as if it should only be defined once in one place vs. twice?

I need integration tests, which will be either in this pr or separately.
Doc/spec update will be in separate pr.

Why make them seperate PRs? I don't see an integration test being super urgent here given the quite good unit-test coverage but the doc change should land with this PR imo.

@vagababov
Copy link
Copy Markdown
Contributor Author

  • I am totally fine with one place for constant, where should it be?
  • I'll update the spec as well (In general I prefer to separate code and documentation, though).

@vagababov
Copy link
Copy Markdown
Contributor Author

spec.md updated. There wasn't a big section for release anyway.

Comment thread pkg/reconciler/v1alpha1/service/resources/route.go Outdated
Comment thread pkg/apis/serving/v1alpha1/service_validation_test.go Outdated
@vagababov
Copy link
Copy Markdown
Contributor Author

Added the comment.

Comment thread pkg/reconciler/v1alpha1/service/resources/route.go
@vagababov vagababov changed the title WIP: add possibility to create services in release mode Add possibility to create services in release mode Feb 4, 2019
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 4, 2019
Comment thread docs/spec/spec.md Outdated
Comment thread docs/spec/spec.md
@vagababov
Copy link
Copy Markdown
Contributor Author

PTAL.

@dgerd
Copy link
Copy Markdown

dgerd commented Feb 4, 2019

/lgtm

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

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

I'd like to verify the data plane is properly configured with @latest, but otherwise this LGTM for now.

I'd also like to see more complex traffic splitting cases with @latest, but I'm ok with that in follow-up.

Comment thread test/crd.go Outdated
)

objects, err := test.CreateRunLatestServiceReady(logger, clients, &names, &test.Options{})
objects, err := test.CreateReleaseServiceWithLatest(logger, clients, &names, &test.Options{})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we check that this serves the expected text?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've added two checks. We can expand them in future, should we want to validate more fields.

Comment thread test/conformance/service_test.go
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 4, 2019
@vagababov
Copy link
Copy Markdown
Contributor Author

/retest

Copy link
Copy Markdown
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mattmoor, vagababov

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

The pull request process is described here

Details 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 5, 2019
@knative-prow-robot knative-prow-robot merged commit 5e9d580 into knative:master Feb 5, 2019
ZhiminXiang pushed a commit to ZhiminXiang/serving-1 that referenced this pull request Feb 7, 2019
* base  addition to the codebase with uts

* add unit test to the validation

* remove debug logging

* raise test coverage

* Update pkg/apis/serving/v1alpha1/service_validation.go

Co-Authored-By: vagababov <vagababov@users.noreply.github.com>

* fix the const name

* update spec.md with the new constant reference

* address comments. create a globally known constant

* fix the test name

* go with @latest for brevity

* update the conformance test

* add conformance test, that validates  release service creation

* added more validation to the service shape
@vagababov vagababov deleted the 2819-add-latest branch February 13, 2019 17:53
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. 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.

7 participants