https://garden.io logo
Setting service type manually
m

millions-ability-962

05/12/2023, 11:28 AM
I have a Garden Module of type container that I want to deploy with a service. I want this service to be of kubernetes ServiceType LoadBalancer instead of the default ClusterIP, but I am struggling to find a way to achieve this without specifying kubernetes manifests manually as a kubernetes Module. Is there a way to specify this? In general, it would be great if it was possible to specify arbitrary kubernetes manifest fields in the Garden Module service spec. The services field will generate both deployment, service, and ingress manifests, but perhaps it could be possible to override some defaults for these at need with f.ex
services:
  - name: blabla
    service:
      type: LoadBalancer
    deployment:
      labels:
        app: my-app
    command: /bin/bash
    ports:
      - name: http
...
b

bright-policeman-43626

05/12/2023, 2:28 PM
Hey @millions-ability-962 let me take a look into this and get back to you! Thanks a lot for using Garden
m

millions-ability-962

05/12/2023, 10:10 PM
Thank you!
q

quaint-dress-831

05/22/2023, 8:43 AM
Hi @millions-ability-962, you'll need to use the kubernetes module (or action in the Bonsai release out tomorrow). The container module is powerful but is not intended for flexibility: that's where the kubernetes and helm modules come in
m

millions-ability-962

05/22/2023, 9:50 AM
Thanks! I did do that in the end. It's just that using the kubernetes module introduces a lot of boilerplate that I wanted to avoid and the avoidance of which was a primary motivation for using Garden. It's a shame to have to throw all that leanness away just to be able to specify one simple extra field.
q

quaint-dress-831

05/22/2023, 10:51 AM
I feel you on the boilerplate. It might be worth exploring rebasing our container type on a portable standard at some point that allows these extensions or else extending our container type itself to support
c

calm-family-29323

05/23/2023, 10:53 AM
Also config templates can be used with all aciton/module kinds to greatly reduce boilerplate even with kubernetes or helm types https://github.com/garden-io/garden/blob/main/docs/using-garden/config-templates.md