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

ingressFor #963

Closed
antwacky opened this issue Nov 30, 2023 · 3 comments
Closed

ingressFor #963

antwacky opened this issue Nov 30, 2023 · 3 comments

Comments

@antwacky
Copy link

serviceFor is cool, is there no ingressFor to create an ingress for a service?

Otherwise I end up with a big boilerplate block for an ingress.

@Duologic
Copy link
Member

The function exists here, you could write a small library yourself, sounds like people mind find it useful.

@antwacky
Copy link
Author

Thanks, I've found how to do it minimally.

    ingress:
      ingress.new('app')
      + ingress.metadata.withAnnotationsMixin({})
      + ingress.spec.withTls({
        hosts: [fqdn],
        secretName: fqdn,
      })
      + ingress.spec.withRules(
        rule.withHost(fqdn)
        + rule.http.withPaths([
          path.withPath('/')
          + path.withPathType('Prefix')
          + path.backend.service.withName(self.service.metadata.name)
          + path.backend.service.port.withNumber(port),
        ])
      ),

On another note, I'm happy to open a new issue if required.

I have a lib for an app which I'm using in my environment main like so:

local app = import "app.libsonnet";

{

  app1: app.new(
    name="app1",
    image="test",
  ),

}

How do I override, for example, metatdata.name using a patch. I though something like this would work:

{

  app1: app.new(
    name="app1",
    image="test",
  ) + {
    metadata: {
      name: "test"
    }
  },

}

@antwacky
Copy link
Author

I found it, it should be like this:

{

  app1: app.new(
    name="app1",
    image="test",
  ) + {
    deployment+: {
      metadata+: {
        name: "test"
      }
    }
  },

}

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

No branches or pull requests

2 participants