Skip to content
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

fix: undefined service key during garden status #153

Conversation

Deepakkothandan
Copy link
Contributor

#134 Normally running garden deploy produces the following output

providers:
  local-kubernetes:
    configured: true
    detail:
      namespaceReady: true
      metadataNamespaceReady: true
      systemReady: true
services:
  undefined:
    endpoints:
      - protocol: http
        hostname: hello-function.hello-world.local.app.garden
        port: 32000
        url: 'http://hello-function.hello-world.local.app.garden:32000'
    runningReplicas: 1
    detail:
      resourceVersion: 2323881
      lastMessage: CREATE Ingress garden--hello--hello-world/hello-function
    state: ready
    lastMessage: ''

which prints only the hello-container service. Shouldn't hello-function be also printed out during garden status as it is also deployed to k8s ? With this PR garden deploy prints both the hello-container and hello-function. I am not sure if this is the intended behaviour. please advice. With this PR the output would be

providers:
  local-kubernetes:
    configured: true
    detail:
      namespaceReady: true
      metadataNamespaceReady: true
      systemReady: true
services:
  hello-container:
    endpoints:
      - protocol: http
        hostname: hello-container.hello-world.local.app.garden
        port: 32000
        url: 'http://hello-container.hello-world.local.app.garden:32000'
        paths:
           - /hello
    runningReplicas: 1
    detail:
      resourceVersion: 16815
    state: ready
    lastMessage: ''
    name: hello-container
  hello-function:
    endpoints:
      - protocol: http
        hostname: hello-function.hello-world.local.app.garden
        port: 32000
        url: 'http://hello-function.hello-world.local.app.garden:32000'
    runningReplicas: 1
    detail:
      resourceVersion: 16757
    state: ready
    lastMessage: ''
    name: hello-function

Let me know if any changes are required

services, (service: Service<any>) =>
ctx.getServiceStatus({ serviceName: service.name })
.then( svc => {
svc["name"] = service.name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kinda goes around TypeScript (it ignores the ["name"] assignment, and then you have an unexpected property on the object), which works in this case but we generally try to avoid since it can come up in unexpected ways later.

I would suggest instead to change the output schema to have services as a list (although that would mean changing a bit more code) or to key by name before mapping over the services.

Copy link
Contributor Author

@Deepakkothandan Deepakkothandan Jun 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will rework it, just getting myself familiar with the codebase and ts.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good! Feel free to ping us if you need help with something or have questions, we're all happy to help.

@edvald
Copy link
Collaborator

edvald commented Jun 13, 2018

I ended up fixing this in #118, closing this one

@edvald edvald closed this Jun 13, 2018
@Deepakkothandan
Copy link
Contributor Author

@edvald thank you.. I am caught up with moving and for the next two weeks I wont have internet 😭

@edvald
Copy link
Collaborator

edvald commented Jun 14, 2018

Ach, been there :P Best of luck with the move!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants