-
Notifications
You must be signed in to change notification settings - Fork 15
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
Get catalog from runner #257
Conversation
25561cc
to
432620a
Compare
a721e42
to
5c8fb5b
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.
Nice! I left a couple of comments but @fabriziosestito can help us better 😄
Then a little reasoning.
This guy exposes an endpoint /api/checks/catalog
which actually calls /api/catalog
on the runner,
Sort of a proxy, but not even, because it does something, namely grouping a flatted catalog received from the Runner, so we could say this is sort of a BFF feature.
runner response
[
{
"id": "156F64",
"name": "1.1.1",
"group": "Corosync",
"provider": "azure",
"description": "...",
"labels": "generic"
},
{
"id": "156F64",
"name": "1.1.1",
"group": "Corosync",
"provider": "aws",
"description": "...",
"labels": "generic"
},
...
]
web response
[
{
"groups": [
{
"checks": [
{
...
}
],
"group": "Corosync"
},
{
"checks": [
{
...
}
],
"group": "Miscellaneous"
}
],
"provider": "aws"
},
{
"groups": [
{
"checks": [
{
...
}
],
"group": "Corosync"
},
{
"checks": [
{
...
}
],
"group": "Miscellaneous"
}
],
"provider": "azure"
}
]
This is perfectly fine.
Yet I'd consider the opportunity to actually just have a proxy for the time being (an ingress or a proxy controller on web).
Why did we chose to do it this way? Mainly to make the grouping on elixir side I believe.
I believe it can go this way.
7b9d113
to
a5d179f
Compare
@fabriziosestito @nelsonkopliku , Besides that, I have updated slightly the catalog controller to allow a |
a5d179f
to
5fe0378
Compare
Yes, mostly the idea is to keep the runner as dump as possible, mostly, because doing list operations in golang is more costly (and much more in ansible...). |
@arbulu89 left some commends about styles / error handling in general. |
@fabriziosestito yet another round of changes hehe |
Implement the backend part of the runner connection to get the catalog.
It includes:
MockRunner
, so we don't need a real runner to create the catalog, and the realRunner
, which interacts with the runner. The implement an adapter, so we can use one or another, and even make the testing easier.RUNNER_URL
flagcatalog.json
to use the new flat listTODO next: