-
Notifications
You must be signed in to change notification settings - Fork 27
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
MGMT-16144: Operator - Add extension support #65
Conversation
@irinamihai: This pull request references MGMT-16144 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.16.0" version, but no target version was set. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
items: | ||
description: 'EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
NOTE: json tags are required. Any new fields you add must have | ||
json tags for the fields to be serialized.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to chang or remove this ^ description before merging.
"\"version\": .metadata.labels[\"openshiftVersion\"],\n", | ||
"\"hub\": .metadata.annotations[\"global-hub.open-cluster-management.io/managed-by\"],", | ||
"}"), | ||
fmt.Sprintf("--extensions={%s}", extensions), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do this we are forcing the user to put each extension within a dictionary. That limits somehow the flexibility, as there are some jq constructs that don't start with a curly bracket. For example, you can set variables and use them later:
.metadata.labels["name"] as $name |
{
name: $name,
alias: $name
}
If we put that between curly brackets it will result in a syntax error.
I think it is better to make the extensions
field an array of strings, and translate it into multiple --extensions
flag. So the CR could look like this:
extensions:
- |
.metadata.labels["name"] as $name |
{
name: $name,
alias: $name
}
- |
{ foo: "bar" }
- ...
That way we can tell users that the syntax of the value of the extensions
field is just that of jq, without additional restrictions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that makes sense. I interpreted the O-RAN standard that is describing the extensions as key:value pair.
Thank you for the clarification, @jhernand.
Kindly take another look when you get the time and please let me know if this approach better suits the extension scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your interpretation of the specification is correct, but this is about how we are implementing the addition of configurable extensions with jq. It looks good to me now. Thanks @irinamihai!
}) | ||
|
||
var _ = Describe("DoesK8SResourceExist", func() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these tests belong here? The aren't related to extensions. May this be a copy & paste error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I included some extra testcases in this PR. I can add them separately in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is fine, keep them.
6ab06ea
to
f3b726c
Compare
@irinamihai: This pull request references MGMT-16144 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.16.0" version, but no target version was set. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
Description: - Add a new array type Spec field called Extensions - As per O-RAN.WG6.O2IMS-INTERFACE-R003-v04.00, this new field is of key:value format and it has been implemented as an array of strings - in the ORANO2IMS CR definition, the Extensions can be declared as follows: spec: extensions: - "{\"country\": .metadata.labels[\"country\"]}" - "{\"aaaa\": {memory: .status.capacity.memory, k8s_version: .status.version.kubernetes}}" - | .metadata.labels["name"] as $name | { name: $name, alias: $name }
f3b726c
to
538c341
Compare
/lgtm |
Description: