-
Notifications
You must be signed in to change notification settings - Fork 3
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 items to parse functionallity to the mappings #44
Conversation
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.
comments
pkg/port/models.go
Outdated
@@ -193,7 +193,8 @@ type EntityMappings struct { | |||
} | |||
|
|||
type Port struct { | |||
Entity EntityMappings `json:"entity"` | |||
Entity EntityMappings `json:"entity"` | |||
ItemsToParse string `json:"ItemsToParse"` |
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.
ItemsToParse string `json:"ItemsToParse"` | |
ItemsToParse string `json:"itemsToParse"` |
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 think we need to add support for yaml in here
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.
In general or just for the itemsToParse
?
If in general it maybe be better to create separate task for it.
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.
its not that big of a deal
just add yaml:"" and the name should be same as json
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.
Got it, done.
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.
we talked about it
yaml
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.
Done
pkg/k8s/controller.go
Outdated
if err != nil { | ||
return nil, fmt.Errorf("invalid selector query '%s': %v", selector.Query, err) | ||
entities := make([]port.Entity, 0, len(mappings)) | ||
if itemsToParse != "" { |
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 if is redundant
instead always runs the loop and set the single value to an array in case there is no items to parse
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 need the if so I can check wether the items array parsing is needed, but I had fix it to use only one loop as you suggest with the nice idea of insert the single object into array.
Let me know if that what you meant.
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.
Apparently I had a problem with this solution, that because the items were overriding each other so only the last item was mapped to entity in the later for loop.
I revert it back to map the item to an entity in each item so it would not happened.
Another solution will be to clone each item to the edited object before insert it to the objectsToMap array but there is no build in clone method for Go so I figured it is a bit overkill.
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.
we talked about this
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.
Done
…into items-to-parse
d98bc12
to
b217def
Compare
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.
🌊
Description
What - Add items to parse functionallity to the mappings
Why - To ingest inner entities from base resource
Type of change
Please leave one option from the following and delete the rest:
The current mapping:
Will ingest the containers inside a Kubernetes deployment.
Example deployment yaml with two containers:
Will create in Port: