Initial version

This commit is contained in:
2021-11-30 12:04:28 +01:00
commit f095f39eaf
9 changed files with 567 additions and 0 deletions

42
helm/service.go Normal file
View File

@@ -0,0 +1,42 @@
package helm
type Service struct {
*K8sBase `yaml:",inline"`
Spec *ServiceSpec `yaml:"spec"`
}
func NewService() *Service {
s := &Service{
K8sBase: NewBase(),
Spec: NewServiceSpec(),
}
s.K8sBase.Kind = "Service"
s.K8sBase.ApiVersion = "v1"
return s
}
type ServicePort struct {
Protocol string `yaml:"protocol"`
Port int `yaml:"port"`
TargetPort int `yaml:"targetPort"`
}
func NewServicePort(port, target int) *ServicePort {
return &ServicePort{
Protocol: "TCP",
Port: port,
TargetPort: port,
}
}
type ServiceSpec struct {
Selector map[string]string
Ports []*ServicePort
}
func NewServiceSpec() *ServiceSpec {
return &ServiceSpec{
Selector: make(map[string]string),
Ports: make([]*ServicePort, 0),
}
}