Make possible to declare cronTabs inside docker-compose file. ⇒ Also, add multiple compose file injection with `-c` arguments ⇒ Also, fixes “ignore depends on” for same pod ⇒ Also fixes * fix [Be able to specify compose.yml files and its override #21](https://github.com/metal3d/katenary/issues/21) * fix [Be able to ignore ports to expose in a katenary.io/ports list #16](https://github.com/metal3d/katenary/issues/16) And more fixes… (later, we will use branches in a better way, that was a hard, long fix process)
56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
package helm
|
|
|
|
import "strconv"
|
|
|
|
// Service is a Kubernetes service.
|
|
type Service struct {
|
|
*K8sBase `yaml:",inline"`
|
|
Spec *ServiceSpec `yaml:"spec"`
|
|
}
|
|
|
|
// NewService creates a new initialized service.
|
|
func NewService(name string) *Service {
|
|
s := &Service{
|
|
K8sBase: NewBase(),
|
|
Spec: NewServiceSpec(),
|
|
}
|
|
s.K8sBase.Metadata.Name = ReleaseNameTpl + "-" + name
|
|
s.K8sBase.Kind = "Service"
|
|
s.K8sBase.ApiVersion = "v1"
|
|
s.K8sBase.Metadata.Labels[K+"/component"] = name
|
|
return s
|
|
}
|
|
|
|
// ServicePort is a port on a service.
|
|
type ServicePort struct {
|
|
Protocol string `yaml:"protocol"`
|
|
Port int `yaml:"port"`
|
|
TargetPort int `yaml:"targetPort"`
|
|
Name string `yaml:"name"`
|
|
}
|
|
|
|
// NewServicePort creates a new initialized service port.
|
|
func NewServicePort(port, target int) *ServicePort {
|
|
return &ServicePort{
|
|
Protocol: "TCP",
|
|
Port: port,
|
|
TargetPort: port,
|
|
Name: "port-" + strconv.Itoa(target),
|
|
}
|
|
}
|
|
|
|
// ServiceSpec is the spec for a service.
|
|
type ServiceSpec struct {
|
|
Selector map[string]string
|
|
Ports []*ServicePort
|
|
Type string `yaml:"type,omitempty"`
|
|
}
|
|
|
|
// NewServiceSpec creates a new initialized service spec.
|
|
func NewServiceSpec() *ServiceSpec {
|
|
return &ServiceSpec{
|
|
Selector: make(map[string]string),
|
|
Ports: make([]*ServicePort, 0),
|
|
}
|
|
}
|