-
Notifications
You must be signed in to change notification settings - Fork 1
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
poc of kubernetes entity provider #51
base: main
Are you sure you want to change the base?
Conversation
await Promise.all(namespaces.items.map(async namespace => { | ||
await Promise.all(this.opts.objectMappings.map(async objectMapping => { | ||
if (namespace.metadata?.name) { | ||
if (objectMapping.plural === 'pods') { |
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.
For the core api, I am only allow pods to be collected, in the ultimate version we would allow collecting any of the other core api resources.
})) | ||
}) | ||
} catch (e: any) { | ||
logger.info(`handling entity request failed: ${e}`); |
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 probably need better error handling here.
const brokerServer = process.env.BROKER_SERVER || 'http://localhost:7341'; | ||
|
||
RoadieAgent.fromConfig({ | ||
server: brokerServer, |
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.
The settings here will need to be provided from the outside.. and some of the settings should be defaulted in the implementation of fromConfig.
@@ -24,6 +24,9 @@ | |||
"build/types/**/*", | |||
"config/accept.json" | |||
], | |||
"bin": { | |||
"kubernetes-entity-provider": "./bin/kubernetes-entity-provider" |
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 could be maybe better in a format like agent-entity-provider --variant kubernetes
or something
createRoadieAgentEntityProvider({ | ||
name: 'kube', | ||
handler: new KubernetesEntityProvider({ | ||
namespaceFilters: { |
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.
All of these settings should be configurable with sensible defaults.
const namespaces = await this.listNamespaces(); | ||
|
||
await Promise.all(namespaces.items.map(async namespace => { | ||
await Promise.all(this.opts.objectMappings.map(async objectMapping => { |
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.
await for...of probably easier to read here since you are mutating the external var already
const k8sCustomObjectsApi = this.kc.makeApiClient(CustomObjectsApi) | ||
const namespaces = await this.listNamespaces(); | ||
|
||
await Promise.all(namespaces.items.map(async namespace => { |
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 flatMapping should probably achieve the same things here, depending how you decide to modify the loop below
RUN npm install && npm install typescript -g | ||
COPY . . | ||
RUN yarn build | ||
CMD ["node", "./bin/kubernetes-entity-provider"] |
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.
need the ability to configure the entity provider entity mappings and the broker client server url and token.
No description provided.