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

e2e-k8s.sh: support alpha features #3023

Merged
merged 1 commit into from
Apr 14, 2023

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Dec 14, 2022

FEATURE_GATES and RUNTIME_CONFIG can be set to populate the corresponding kind config and thus modify the cluster.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 14, 2022
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 14, 2022
@pohly
Copy link
Contributor Author

pohly commented Dec 14, 2022

Let's test the modified script first in kubernetes/test-infra#28248 before merging this PR here.

@aojea
Copy link
Contributor

aojea commented Dec 14, 2022

/assign @BenTheElder
too much bash for me 😄

@BenTheElder
Copy link
Member

Discussed more with aojea. I think we should support this. We won't make the go commands drop in replacements for this script and will migrate some core workflows to something else later while leaving this alone.

@@ -24,7 +24,12 @@ set -o errexit -o nounset -o xtrace
# FOCUS: ginkgo focus regex
# GA_ONLY: true - limit to GA APIs/features as much as possible
# false - (default) APIs and features left at defaults
#
# FEATURE_GATES:
Copy link
Member

Choose a reason for hiding this comment

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

I think maybe we should just require a valid yaml map string in the env and not try to do any bash parsing. Same for runtime_config

like FEATURE_GATES='{foo: true}'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, will change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I keep forgetting that YAML supports JSON and thus everything in a single string with no line breaks 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's one small (and perfectly acceptable) loss of functionality when removing the parsing:

For the sake of simplicity, not attempt is made to merge the settings from
GA_ONLY with these new env variables. If GA_ONLY=true is set, the new env
variables are ignored.

Revised commit pushed.

/hold

I still need to test it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tested:

That all works as expected now.

/hold cancel

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pohly pohly force-pushed the e2e-feature-gates branch from 9bde011 to f5ece48 Compare January 10, 2023 11:23
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 10, 2023
@aojea
Copy link
Contributor

aojea commented Jan 10, 2023

+1

@pohly pohly force-pushed the e2e-feature-gates branch from f5ece48 to b585ec9 Compare January 10, 2023 13:33
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 10, 2023
@pohly pohly changed the title WIP: e2e-k8s.sh: support alpha features e2e-k8s.sh: support alpha features Jan 10, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 10, 2023
@pohly
Copy link
Contributor Author

pohly commented Jan 26, 2023

/retest

# JSON or YAML map injected into featureGates config
feature_gates="${FEATURE_GATES:-{\}}"
# --runtime-config argument value passed to the API server, again as a map
runtime_config="${RUNTIME_CONFIG:-{\}}"

Copy link
Contributor

Choose a reason for hiding this comment

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

should GA_ONLY and FEATURE_GATES/RUNTIME_CONFIG be mutually exclusive?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A prior version of this PR allowed both to be set and used shell code to parse and merge all settings. This was deemed too complex and now the options are mutually exclusive: setting GA_ONLY overrides FEATURE_GATES/RUNTIME_CONFIG.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FWIW, I think that's sufficient: someone who has a need to set features individually can also add the "api/alpha":"false", "api/beta":"false" there. The special case for "certificates.k8s.io/v1beta1":"true" seems irrelevant now.

Copy link
Contributor

Choose a reason for hiding this comment

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

in the GA_ONLY=true case below, can we detect and error if $feature_gates or $runtime_config are anything other than {}, rather than silently ignoring the envvar-set values

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

@pohly
Copy link
Contributor Author

pohly commented Apr 12, 2023

@BenTheElder, @liggitt: have your questions regarding this PR been addressed? Please take another look.

@serathius
Copy link
Contributor

/retest

@pohly pohly force-pushed the e2e-feature-gates branch from b585ec9 to 8cfc170 Compare April 14, 2023 12:25
@pohly
Copy link
Contributor Author

pohly commented Apr 14, 2023

I force-pushed without any changes to trigger a retest.

@liggitt
Copy link
Contributor

liggitt commented Apr 14, 2023

one comment to explicitly make GA_ONLY=true and FEATURE_GATES/RUNTIME_CONFIG use mutually exclusive, then lgtm

@liggitt
Copy link
Contributor

liggitt commented Apr 14, 2023

you'll need to rebase as well, the GA_ONLY=true path got cleaned up a couple months ago

@pohly pohly force-pushed the e2e-feature-gates branch from 8cfc170 to 65e4dff Compare April 14, 2023 12:32
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 14, 2023
@pohly pohly force-pushed the e2e-feature-gates branch from 65e4dff to c4639bf Compare April 14, 2023 12:35
@pohly
Copy link
Contributor Author

pohly commented Apr 14, 2023

... and rebased.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 14, 2023
# FEATURE_GATES:
# JSON or YAML encoding of a string/bool map: {"FeatureGateA": true, "FeatureGateB": false}
# Enables or disables feature gates in the entire cluster.
# Ignored when GA_ONLY=true.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Ignored when GA_ONLY=true.
# Cannot be used when GA_ONLY=true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

# RUNTIME_CONFIG:
# JSON or YAML encoding of a string/string (!) map: {"apia.example.com/v1alpha1": "true", "apib.example.com/v1beta1": "false"}
# Enables API groups in the apiserver via --runtime-config.
# Ignored when GA_ONLY=true.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Ignored when GA_ONLY=true.
# Cannot be used when GA_ONLY=true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

FEATURE_GATES and RUNTIME_CONFIG can be set to populate the corresponding kind
config and thus modify the cluster.

For the sake of simplicity, not attempt is made to merge the settings from
GA_ONLY with these new env variables. If GA_ONLY=true is set, the new env
variables are ignored.
@pohly pohly force-pushed the e2e-feature-gates branch from c4639bf to 5551b32 Compare April 14, 2023 12:41
@liggitt
Copy link
Contributor

liggitt commented Apr 14, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 14, 2023

case "${GA_ONLY:-false}" in
false)
feature_gates="{}"
runtime_config="{}"
:
Copy link
Contributor

Choose a reason for hiding this comment

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

puff, you make me learn things I wish I didn't know they existed 😄 https://stackoverflow.com/a/3224910

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh no, you incentivised me to click it, now I also wish to forget this.

@aojea
Copy link
Contributor

aojea commented Apr 14, 2023

/approve
/hold

Jordan for final approval (unhold)

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 14, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea, pohly

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 14, 2023
@aojea
Copy link
Contributor

aojea commented Apr 14, 2023

oh, he already did
/hold cancel

Thanks patrick

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 14, 2023
@k8s-ci-robot k8s-ci-robot merged commit c861819 into kubernetes-sigs:main Apr 14, 2023
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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants