-
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-16359: support configured extensions in resource server #47
MGMT-16359: support configured extensions in resource server #47
Conversation
@danielerez: This pull request references MGMT-16359 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 |
c05bb67
to
9f5dec8
Compare
internal/service/resource_handler.go
Outdated
} | ||
labelsMap := data.GetLabelsMap(labels) | ||
|
||
r.logger.Error(fmt.Sprintf("r.extensions: %v", r.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.
You will probably want to remove this, or replace it with r.logger.Debug(...)
.
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.
Good catch:) Removed.
SetExtensions( | ||
`{ | ||
"operation_system": .label|parse_labels|.os, | ||
"architecture": .label|parse_labels|.arch |
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.
This is really nice @danielerez!
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.
This looks good to me. Thanks @danielerez. The only reason I am not approving it is that you may want to change address the comment about logging before merging. Let me know and I will happily approve.
Similarly to the support add in deployment manager server, this PR is adding a similar functionality to the resource server. The main difference between the implementations is the parsing logic of the objects retrieved from search API. I.e. since each 'label' property is a single string consists of key=value pairs, the lables should be parsed before evaluating the expression with jq. Hence, added a custom jq function for parsing: `parse_labels`. For example: ``` --extensions={ "openshift_version": .label|parse_labels|.openshiftVersion, "cluster_set": .label|parse_labels|.\"cluster.open-cluster-management.io/clusterset\", } ```
9f5dec8
to
1a2ce48
Compare
/lgtm |
Similarly to the support add in deployment manager server, this PR is adding a similar functionality to the resource server. The main difference between the implementations is the parsing logic of the objects retrieved from search API.
I.e. since each 'label' property is a single string consists of key=value pairs, the lables should be parsed before evaluating the expression with jq. Hence, added a custom jq function for parsing:
parse_labels
.For example: