rancher / fleet

Deploy workloads from Git to large fleets of Kubernetes clusters
https://fleet.rancher.io/
Apache License 2.0
1.5k stars 224 forks source link

Ingress dynamic host name using fleet + kustomize #686

Open jvaibhav123 opened 2 years ago

jvaibhav123 commented 2 years ago

Hi All,

We have workflow where we have to create ingress per cluster/project. Currently we have to create valuesFile or add targetCustomization block for every cluster where we required to create ingress. We are using external charts and would like to use kustomize to patch the objects in case we set ingress_enabled=true. I have not seen any example where kustomize utilize the variables for patching. Is there any way we can patch ingress host dynamically using kustomize using helm variable?

e.g loki chart where we would like create ingress however, with different host based on cluster.

atsai1220 commented 2 years ago

You would probably be interested in the following issue and its related PR:

For now you may have to configure fleet.yaml manually (through automation against your vcs) by following the example in #375:

targetCustomizations:
- name: test1
  helm:
    values:
      ingress:
        tls:
          - hosts:
              - test1.example.com
  clusterSelector:
    matchLabels:
      management.cattle.io/cluster-display-name: test1
- name: test2
  helm:
    values:
      ingress:
        tls:
          - hosts:
              - test2.example.com
  clusterSelector:
    matchLabels:
      management.cattle.io/cluster-display-name: test2
manno commented 1 year ago

Using values: and using variable data in values: is only possible for helm.

If you want to use kustomize, I think https://github.com/rancher/fleet-examples/blob/master/multi-cluster/kustomize/fleet.yaml is the proper way. You would use overlays for that, citing from kustomize.io:

Kustomize introduces a template-free way to customize application configuration that simplifies the use of off-the-shelf applications.