-
Notifications
You must be signed in to change notification settings - Fork 731
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
Mutation: Cannot reference ports in a pod #1355
Comments
@maxsmythe for the first issue, we can consider adding numeric token support to our parser and exposing this to the matching logic. Specifically this is about numeric support in Regarding the second issue seems closely related, I see assumptions around string types in |
The only other thing we use location for is to build the implicit schema. We haven't been using the type of One thing that's interesting is whether we can use integers to identify the field of a resource (e.g. |
Previously, the mutation path parser only supported string types for keyValues selecting items in a list. This PR adds support for integers, such that we can now express paths like this: ``` spec.containers[name: opa].ports[containerPort: 8888].name ``` Integers are assumed to be represented in decimal and are interpreted as positive int64 values. The mutation code was updated accordingly to match based on type. Additionally, string serialization of paths was updated to be more selective on which strings are quoted. Fixes open-policy-agent#1355 Signed-off-by: Oren Shomron <shomron@gmail.com>
I've made it so that non-quoted identifiers can no longer start with a number - let me know what you think! |
Previously, the mutation path parser only supported string types for keyValues selecting items in a list. This PR adds support for integers, such that we can now express paths like this: ``` spec.containers[name: opa].ports[containerPort: 8888].name ``` Integers are assumed to be represented in decimal and are interpreted as positive int64 values. The mutation code was updated accordingly to match based on type. Additionally, string serialization of paths was updated to be more selective on which strings are quoted. Fixes open-policy-agent#1355 Signed-off-by: Oren Shomron <shomron@gmail.com>
I'm liking it! |
Previously, the mutation path parser only supported string types for keyValues selecting items in a list. This PR adds support for integers, such that we can now express paths like this: ``` spec.containers[name: opa].ports[containerPort: 8888].name ``` Integers are assumed to be represented in decimal and are interpreted as positive int64 values. The mutation code was updated accordingly to match based on type. Additionally, string serialization of paths was updated to be more selective on which strings are quoted. Fixes open-policy-agent#1355 Signed-off-by: Oren Shomron <shomron@gmail.com>
Previously, the mutation path parser only supported string types for keyValues selecting items in a list. This PR adds support for integers, such that we can now express paths like this: ``` spec.containers[name: opa].ports[containerPort: 8888].name ``` Integers are assumed to be represented in decimal and are interpreted as positive int64 values. The mutation code was updated accordingly to match based on type. Additionally, string serialization of paths was updated to be more selective on which strings are quoted. Fixes open-policy-agent#1355 Signed-off-by: Oren Shomron <shomron@gmail.com>
* Add integer keyValue support to mutation path parser / mutators. Previously, the mutation path parser only supported string types for keyValues selecting items in a list. This PR adds support for integers, such that we can now express paths like this: ``` spec.containers[name: opa].ports[containerPort: 8888].name ``` Integers are assumed to be represented in decimal and are interpreted as positive int64 values. The mutation code was updated accordingly to match based on type. Additionally, string serialization of paths was updated to be more selective on which strings are quoted. Fixes #1355 * Add additional tests, resolve lint warnings. * Additional test cases for digits in unquoted identifiers * Fixed additional parsing roundtripping cases Signed-off-by: Oren Shomron <shomron@gmail.com>
…-policy-agent#1394) * Add integer keyValue support to mutation path parser / mutators. Previously, the mutation path parser only supported string types for keyValues selecting items in a list. This PR adds support for integers, such that we can now express paths like this: ``` spec.containers[name: opa].ports[containerPort: 8888].name ``` Integers are assumed to be represented in decimal and are interpreted as positive int64 values. The mutation code was updated accordingly to match based on type. Additionally, string serialization of paths was updated to be more selective on which strings are quoted. Fixes open-policy-agent#1355 * Add additional tests, resolve lint warnings. * Additional test cases for digits in unquoted identifiers * Fixed additional parsing roundtripping cases Signed-off-by: Oren Shomron <shomron@gmail.com> Signed-off-by: juliankatz <juliankatz@google.com>
What steps did you take and what happened:
Ports in pods have an integer-type keyfield. Because our location spec assume stings, we cannot match against this, and wind up creating a duplicate port.
Repro steps:
take the following mutator:
and create the following object:
We get the following error:
Which has two issues:
What did you expect to happen:
Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
Environment:
kubectl version
):The text was updated successfully, but these errors were encountered: