Files
katenary/helm/ingress.go
Patrice Ferlet 418a0a8029 Use compose-go + improvements (#9)
Use compose-go https://github.com/compose-spec/compose-go  to make Katenary parsing compose file the official way.
Add labels:
- `volume-from` (with `same-pod`) to avoid volume repetition
- `ignore` to ignore a service
- `mapenv` (replaces the `env-to-service`) to map environment to helm variable (as a template string)
- `secret-vars` declares variables as secret values

More:
- Now, environment (as secret vars) are set in values.yaml
- Ingress has got annotations in values.yaml
- Probes (liveness probe) are improved
- fixed code to optimize
- many others fixes about path, bad volume check, refactorisation, tests...
2022-05-08 09:55:25 +02:00

55 lines
1.2 KiB
Go

package helm
// Ingress is the kubernetes ingress object.
type Ingress struct {
*K8sBase `yaml:",inline"`
Spec IngressSpec
}
func NewIngress(name string) *Ingress {
i := &Ingress{}
i.K8sBase = NewBase()
i.K8sBase.Metadata.Name = ReleaseNameTpl + "-" + name
i.K8sBase.Kind = "Ingress"
i.ApiVersion = "networking.k8s.io/v1"
i.K8sBase.Metadata.Labels[K+"/component"] = name
return i
}
func (i *Ingress) SetIngressClass(name string) {
class := "{{ .Values." + name + ".ingress.class }}"
i.Spec.IngressClassName = class
}
type IngressSpec struct {
IngressClassName string `yaml:"ingressClassName,omitempty"`
Rules []IngressRule
}
type IngressRule struct {
Host string
Http IngressHttp
}
type IngressHttp struct {
Paths []IngressPath
}
type IngressPath struct {
Path string
PathType string `yaml:"pathType"`
Backend *IngressBackend
}
type IngressBackend struct {
Service IngressService
ServiceName string `yaml:"serviceName"` // for kubernetes version < 1.18
ServicePort interface{} `yaml:"servicePort"` // for kubernetes version < 1.18
}
type IngressService struct {
Name string `yaml:"name"`
Port map[string]interface{} `yaml:"port"`
}