Files
katenary/generator/labelStructs/ingress.go

34 lines
837 B
Go
Raw Normal View History

package labelStructs
import "gopkg.in/yaml.v3"
2024-11-08 15:51:36 +01:00
type TLS struct {
Enabled bool `yaml:"enabled"`
}
type Ingress struct {
Port *int32 `yaml:"port,omitempty"`
Annotations map[string]string `yaml:"annotations,omitempty"`
Hostname string `yaml:"hostname"`
Path string `yaml:"path"`
Class string `yaml:"class"`
Enabled bool `yaml:"enabled"`
2024-11-08 15:51:36 +01:00
TLS TLS `yaml:"tls"`
}
// IngressFrom creates a new Ingress from a compose service.
func IngressFrom(data string) (*Ingress, error) {
mapping := Ingress{
Hostname: "",
Path: "/",
Enabled: false,
Class: "-",
Port: nil,
2024-11-08 15:51:36 +01:00
TLS: TLS{Enabled: true},
}
if err := yaml.Unmarshal([]byte(data), &mapping); err != nil {
return nil, err
}
return &mapping, nil
}