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 feature gating to REST Compression #46966

Merged
merged 1 commit into from
Jun 23, 2017

Conversation

ilackarms
Copy link
Contributor

What this PR does / why we need it: Adds feature gating to opt out of REST API compression

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #46963

Special notes for your reviewer: This PR is a fix / addendum to #45666

Release note:

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 5, 2017
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels Jun 5, 2017
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 5, 2017
@k8s-ci-robot
Copy link
Contributor

Hi @ilackarms. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with @k8s-bot ok to test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

I understand the commands that are listed here.

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. I understand the commands that are listed here.

// alpha: v1.7
//
// Enables compression of REST responses (GET and LIST only)
EnableRESTCompression utilfeature.Feature = "EnableRESTCompression"
Copy link
Member

Choose a reason for hiding this comment

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

don't prefix with "Enable", maybe something like APIResponseCompression

@@ -138,6 +144,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
RotateKubeletClientCertificate: {Default: false, PreRelease: utilfeature.Alpha},
PersistentLocalVolumes: {Default: false, PreRelease: utilfeature.Alpha},
LocalStorageCapacityIsolation: {Default: false, PreRelease: utilfeature.Alpha},
EnableRESTCompression: {Default: true, PreRelease: utilfeature.Alpha},
Copy link
Member

Choose a reason for hiding this comment

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

I'd consider it GA, it's enabled by default, it can just be disabled if needed

@liggitt
Copy link
Member

liggitt commented Jun 5, 2017

required if #45666 is going into 1.7

@liggitt liggitt added this to the v1.7 milestone Jun 5, 2017
@liggitt liggitt added release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed release-note-label-needed labels Jun 5, 2017
@smarterclayton
Copy link
Contributor

smarterclayton commented Jun 5, 2017 via email

@ilackarms ilackarms force-pushed the compression-gating branch 2 times, most recently from ab026df to ef49439 Compare June 6, 2017 12:44
@@ -588,7 +590,9 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
handler = restfulGetResource(getter, exporter, reqScope)
}
handler = metrics.InstrumentRouteFunc(action.Verb, resource, subresource, handler)
handler = genericfilters.RestfulWithCompression(handler, a.group.Context)
if utilfeature.DefaultFeatureGate.Enabled(features.APIResponseCompression) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not here. Please plumb as an arg to this method and plumb it back out. You can set the feature flag as a value on the apiserver/pkg/server/config

@deads2k deads2k self-assigned this Jun 6, 2017
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 6, 2017
@ilackarms ilackarms force-pushed the compression-gating branch from ef49439 to 7122dec Compare June 6, 2017 14:59
@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 6, 2017
@ilackarms ilackarms force-pushed the compression-gating branch from 7122dec to b3503b2 Compare June 6, 2017 15:11
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 6, 2017
// alpha: v1.7
//
// Enables compression of REST responses (GET and LIST only)
APIResponseCompression utilfeature.Feature = "APIResponseCompression"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually staging/src/k8s.io/apiserver/pkg/features/kube_features.go. It seems unusual, but the gate is actually generic since your changes were generic.

@@ -160,6 +161,10 @@ type Config struct {
// Predicate which is true for paths of long-running http requests
LongRunningFunc apirequest.LongRunningRequestCheck

// APIResponseCompression indicates whether API Responses should support compression
// if the client requests it via Accept-Encoding
APIResponseCompression bool
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to EnableAPIResponseCompression

@@ -61,6 +61,7 @@ import (
"k8s.io/client-go/informers"
restclient "k8s.io/client-go/rest"
certutil "k8s.io/client-go/util/cert"
featuregates "k8s.io/kubernetes/pkg/features"
Copy link
Contributor

Choose a reason for hiding this comment

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

this should cause you to fail a verify script.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's why you need a generic feature flag.

@ilackarms ilackarms force-pushed the compression-gating branch from 47b2152 to 40a473b Compare June 20, 2017 03:24
@marun
Copy link
Contributor

marun commented Jun 20, 2017

/retest

@marun
Copy link
Contributor

marun commented Jun 21, 2017

@liggitt @deads2k: Please review.

@@ -53,4 +59,5 @@ func init() {
var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureSpec{
StreamingProxyRedirects: {Default: true, PreRelease: utilfeature.Beta},
AdvancedAuditing: {Default: false, PreRelease: utilfeature.Alpha},
APIResponseCompression: {Default: false, PreRelease: utilfeature.GA},
Copy link
Member

Choose a reason for hiding this comment

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

until we're sure we want this defaulting on, and as this is the first release it's included, I'd mark this Alpha...

@liggitt
Copy link
Member

liggitt commented Jun 23, 2017

gated and marked alpha, this LGTM. @deads2k?

this feature is gated; disabled by default
@ilackarms ilackarms force-pushed the compression-gating branch from 40a473b to c305f72 Compare June 23, 2017 15:25
@deads2k
Copy link
Contributor

deads2k commented Jun 23, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 23, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, ilackarms

Associated issue: 46963

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 23, 2017
@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 47883, 47179, 46966, 47982, 47945)

@pacoxu
Copy link
Member

pacoxu commented Jan 22, 2025

Wrong milestone here.
/milestone clear

@k8s-ci-robot k8s-ci-robot removed this from the v1.7 milestone Jan 22, 2025
@pacoxu
Copy link
Member

pacoxu commented Jan 22, 2025

/milestone v1.8

@k8s-ci-robot
Copy link
Contributor

@pacoxu: The provided milestone is not valid for this repository. Milestones in this repository: [next-candidate, v1.26, v1.27, v1.28, v1.29, v1.30, v1.31, v1.32, v1.33, v1.34]

Use /milestone clear to clear the milestone.

In response to this:

/milestone v1.8

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-sigs/prow repository.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add gating to API Compression handler
10 participants