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 reusable feature-state component #2342

Merged
merged 8 commits into from
Jul 9, 2024

Conversation

ivange94
Copy link
Contributor

@ivange94 ivange94 commented Jun 3, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds a feature-state component similar to what we have on the kubernetes website for marking the minimum version of kubernetes supported.

Which issue(s) this PR fixes:

Fixes #2325

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. labels Jun 3, 2024
Copy link

linux-foundation-easycla bot commented Jun 3, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jun 3, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @ivange94!

It looks like this is your first PR to kubernetes-sigs/kueue 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kueue has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @ivange94. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /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.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 3, 2024
Copy link

netlify bot commented Jun 3, 2024

Deploy Preview for kubernetes-sigs-kueue ready!

Name Link
🔨 Latest commit 36a7448
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/668c9198f516f50008b2cbaf
😎 Deploy Preview https://deploy-preview-2342--kubernetes-sigs-kueue.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

We might have some features that require a specific k8s version, so maybe this can be a parameter.

something like:

{{ $project := .Get "project" | default "Kueue"}}


{{ $valid_states := "alpha, beta, deprecated, stable" }}
{{ $state := .Get "state" }}
{{ $for_k8s_version := .Get "for_k8s_version" | default (.Page.Param "version")}}
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
{{ $for_k8s_version := .Get "for_k8s_version" | default (.Page.Param "version")}}
{{ $for_k8s_version := .Get "for_kueue_version" | default (.Page.Param "version")}}

{{ errorf "%q is not a valid feature-state, use one of %q" $state $valid_states }}
{{ else }}
<div class="feature-state-notice feature-{{ $state }}">
<span class="feature-state-name">FEATURE STATE</span> <code>Kubernetes {{ $for_k8s_version }} [{{ $state }}]</code>
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
<span class="feature-state-name">FEATURE STATE</span> <code>Kubernetes {{ $for_k8s_version }} [{{ $state }}]</code>
<span class="feature-state-name">FEATURE STATE</span> <code>Kueue {{ $for_kueue_version }} [{{ $state }}]</code>

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jun 4, 2024
@ivange94
Copy link
Contributor Author

ivange94 commented Jun 4, 2024

Thank you for the review @alculquicondor.

I'm not clear about this comment

We might have some features that require a specific k8s version, so maybe this can be a parameter.

something like:

{{ $project := .Get "project" | default "Kueue"}}

Do we want a parameter for a specific version for k8s and another for kueue?

@ivange94 ivange94 changed the title [WIP] Add reusable feature-state component Add reusable feature-state component Jun 4, 2024
@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 Jun 4, 2024
@alculquicondor
Copy link
Contributor

I want to add blocks for features that require a specific Kueue version, and blocks for features that require specific Kubernetes versions.

We can use the same template for both, just parameterize the name of the project.

@alculquicondor
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 4, 2024
@alculquicondor
Copy link
Contributor

Hi @ivange94, are you still working on this?

@ivange94
Copy link
Contributor Author

@alculquicondor I think I misunderstood your comments on this. I thought my changes satisfied this comment

We can use the same template for both, just parameterize the name of the project.

Plus when I saw that you added the ok-to-test tag, this further made me think these changes were ok. What else is left to do here?

@alculquicondor
Copy link
Contributor

Oh I didn't realize that you added code, even though you said you didn't understand the suggestion.

Can you make use of the template in a few places? For example, in https://kueue.sigs.k8s.io/docs/concepts/preemption/#fair-sharing

{{ $valid_states := "alpha, beta, deprecated, stable" }}
{{ $project := .Get "project" | default "Kueue" }}
{{ $state := .Get "state" }}
{{ $for_kueue_version := .Get "for_kueue_version" | default (.Page.Param "version")}}
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
{{ $for_kueue_version := .Get "for_kueue_version" | default (.Page.Param "version")}}
{{ $for_version := .Get "for_version" | default (.Page.Param "version")}}

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 30, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 30, 2024
@ivange94
Copy link
Contributor Author

/retest

@ivange94
Copy link
Contributor Author

@alculquicondor I've incorporated your suggestions and also added some usages for the new template.

@@ -349,8 +349,8 @@ To limit the amount of resources that a ClusterQueue can lend in the cohort,
you can set the `.spec.resourcesGroup[*].flavors[*].resource[*].lendingLimit`
[quantity](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/) field.

{{< feature-state state="stable" for_version="v0.6.0+" >}}
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
{{< feature-state state="stable" for_version="v0.6.0+" >}}
{{< feature-state state="alpha" for_version="v0.6" >}}

This matches how Kubernetes documents features https://kubernetes.io/docs/reference/access-authn-authz/validating-admission-policy/

For the current state of features, you can check https://kueue.sigs.k8s.io/docs/installation/#change-the-feature-gates-configuration or

var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{

{{% alert title="Note" color="primary" %}}
Available in Kueue v0.6.0 and newer
{{% /alert %}}
{{< feature-state state="stable" for_version="v0.6.0+" >}}
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
{{< feature-state state="stable" for_version="v0.6.0+" >}}
{{< feature-state state="stable" for_version="v0.6" >}}

Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly for the rest of the files.

{{ errorf "%q is not a valid feature-state, use one of %q" $state $valid_states }}
{{ else }}
<div class="feature-state-notice feature-{{ $state }}">
<span class="feature-state-name">FEATURE STATE</span> <code>{{ $project }} {{ $for_version }} [{{ $state }}]</code>
Copy link

Choose a reason for hiding this comment

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

Try this:

Suggested change
<span class="feature-state-name">FEATURE STATE</span> <code>{{ $project }} {{ $for_version }} [{{ $state }}]</code>
<span class="feature-state-name">Feature state</span>: {{ $state }} since {{ $project }} {{ $for_version }}

It's not exactly what's on the K8s main website, but I think it's close enough. We can use text-transform in the CSS if we want “FEATURE STATE” in all caps (I don't think it helps, TBH).

@ivange94
Copy link
Contributor Author

ivange94 commented Jul 8, 2024

@alculquicondor @sftim
Screenshot 2024-07-08 at 3 52 35 AM

@@ -349,8 +349,8 @@ To limit the amount of resources that a ClusterQueue can lend in the cohort,
you can set the `.spec.resourcesGroup[*].flavors[*].resource[*].lendingLimit`
[quantity](https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/) field.

{{< feature-state state="alpha" for_version="v0.6.0" >}}
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
{{< feature-state state="alpha" for_version="v0.6.0" >}}
{{< feature-state state="alpha" for_version="v0.6" >}}

Let's only use minor versions

@@ -59,7 +59,8 @@ kubectl apply --server-side -f https://github.com/kubernetes-sigs/kueue/releases

### Add metrics scraping for prometheus-operator

> _Available in Kueue v0.2.1 and later_
{{< feature-state state="stable" for_version="v0.2.1" >}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove this note, since v0.2 is very old now. I wouldn't expect anyone to be running a version of Kueue older than v0.4

@ivange94
Copy link
Contributor Author

ivange94 commented Jul 9, 2024

@alculquicondor I addressed all comments.

Copy link
Contributor

@alculquicondor alculquicondor 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
Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 9, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 687168ada5da01af43c9d63c1a982cbf9f2762ea

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, ivange94

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 Jul 9, 2024
@alculquicondor
Copy link
Contributor

/cherry-pick website

@k8s-infra-cherrypick-robot

@alculquicondor: once the present PR merges, I will cherry-pick it on top of website in a new PR and assign it to you.

In response to this:

/cherry-pick website

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.

@k8s-ci-robot k8s-ci-robot merged commit 9523012 into kubernetes-sigs:main Jul 9, 2024
7 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v0.8 milestone Jul 9, 2024
@k8s-infra-cherrypick-robot

@alculquicondor: new pull request created: #2564

In response to this:

/cherry-pick website

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. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. 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.

Add a hugo template to highlight minimum supported version
5 participants