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

Wildcard for matching against all keys in label rules #662

Closed
wants to merge 1 commit into from

Conversation

marquiz
Copy link
Contributor

@marquiz marquiz commented Nov 19, 2021

Extend the feature rule format with a special wildcard that can be used
in matchExpressions. By using '*' as the field name in an expressoin
makes is possible to run the expression agains all feature names,
instead of the value of one feature.

This can be useful in template rules for creating per-feature labels,
based on feature names (instead of values) and in "normal"
(non-template) rules for checking if (at least) one of certain feature
names are present.

An example of creating an "avx512" label if any AVX512* CPUID feature is
present:

  - name: "avx512-any-feature"
    labels: {avx512: "true"}
    matchFeatures:
      - feature: cpu.cpuid:
        matchExpressions:
          "*": {op: InRegexp, value: ["^AVX512"]}

An example of a template rule creating a dynamic set of labels based on
the existence of kconfig options.

  - name: "kconfig-template-features"
    labelsTemplate: |
      {{range .kernel.config}}kconfig-{{.Name}}={{.Value}}
      {{end}}
    matchFeatures:
      - feature: kernel.config
        matchExpressions:
          "*": {op: In, value: [SWAP, X86, ARM]}

Depends on #550

@marquiz
Copy link
Contributor Author

marquiz commented Nov 19, 2021

/hold

@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 Nov 19, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marquiz

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 19, 2021
@k8s-triage-robot
Copy link

Unknown CLA label state. Rechecking for CLA labels.

Send feedback to sig-contributor-experience at kubernetes/community.

/check-cla

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 19, 2021
@marquiz marquiz added this to the v0.11.0 milestone Dec 2, 2021
Extend the feature rule format with a special wildcard that can be used
in matchExpressions. By using '*' as the field name in an expressoin
makes is possible to run the expression agains all feature names,
instead of the value of one feature.

This can be useful in template rules for creating per-feature labels,
based on feature names (instead of values) and in "normal"
(non-template) rules for checking if (at least) one of certain feature
names are present.

An example of creating an "avx512" label if any AVX512* CPUID feature is
present:

  - name: "avx512-any-feature"
    labels: {avx512: "true"}
    matchFeatures:
      - feature: cpu.cpuid:
        matchExpressions:
          "*": {op: InRegexp, value: ["^AVX512"]}

An example of a template rule creating a dynamic set of labels  based on
the existence of kconfig options.

  - name: "kconfig-template-features"
    labelsTemplate: |
      {{range .kernel.config}}kconfig-{{.Name}}={{.Value}}
      {{end}}
    matchFeatures:
      - feature: kernel.config
        matchExpressions:
          "*": {op: In, value: [SWAP, X86, ARM]}
@marquiz marquiz force-pushed the devel/wildcard-rule branch from 68f69a5 to 7f253e4 Compare December 16, 2021 12:42
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 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 Dec 16, 2021
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 5, 2022
@k8s-ci-robot
Copy link
Contributor

@marquiz: PR needs rebase.

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.

@marquiz
Copy link
Contributor Author

marquiz commented Jan 12, 2022

I don't like this approach myself. Possibly something like this would be more comprehensive:

  - name: "avx512-any-feature"
    labels: {avx512: "true"}
    matchFeatures:
      - feature: cpu.cpuid:
        matchNames: {op: InRegexp, value: ["^AVX512"]}

@k8s-ci-robot
Copy link
Contributor

@marquiz: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-node-feature-discovery-build-image-cross 7f253e4 link true /test pull-node-feature-discovery-build-image-cross

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@marquiz marquiz modified the milestones: v0.11.0, v.0.12.0 Mar 17, 2022
@marquiz
Copy link
Contributor Author

marquiz commented Mar 17, 2022

Moving milestone to v0.12.0

@marquiz
Copy link
Contributor Author

marquiz commented Mar 17, 2022

Supserseded by #788
/close

@k8s-ci-robot
Copy link
Contributor

@marquiz: Closed this PR.

In response to this:

Supserseded by #788
/close

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.

@marquiz marquiz removed this from the v.0.12.0 milestone Jul 8, 2022
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

3 participants