Files
katenary/helm/ingress.go

53 lines
1023 B
Go
Raw Normal View History

2021-11-30 12:04:28 +01:00
package helm
type Ingress struct {
2021-11-30 12:09:07 +01:00
*K8sBase `yaml:",inline"`
Spec IngressSpec
2021-11-30 12:04:28 +01:00
}
func NewIngress(name string) *Ingress {
i := &Ingress{}
i.K8sBase = NewBase()
i.K8sBase.Metadata.Name = "{{ .Release.Name }}-" + name
i.K8sBase.Kind = "Ingress"
i.ApiVersion = "networking.k8s.io/v1"
2021-12-01 15:17:34 +01:00
i.K8sBase.Metadata.Labels[K+"/component"] = name
2021-11-30 12:04:28 +01:00
return i
}
2021-11-30 15:35:32 +01:00
func (i *Ingress) SetIngressClass(name string) {
class := "{{ .Values." + name + ".ingress.class }}"
i.Metadata.Annotations["kuberntes.io/ingress.class"] = class
i.Spec.IngressClassName = class
}
2021-11-30 12:04:28 +01:00
type IngressSpec struct {
2021-11-30 15:35:32 +01:00
IngressClassName string `yaml:"ingressClassName,omitempty"`
Rules []IngressRule
2021-11-30 12:04:28 +01:00
}
type IngressRule struct {
Host string
Http IngressHttp
}
type IngressHttp struct {
Paths []IngressPath
}
type IngressPath struct {
Path string
2021-11-30 15:35:32 +01:00
PathType string `yaml:"pathType"`
2021-11-30 12:04:28 +01:00
Backend IngressBackend
}
type IngressBackend struct {
Service IngressService
}
type IngressService struct {
Name string
Port map[string]interface{}
}