2021-11-30 12:04:28 +01:00
|
|
|
package helm
|
|
|
|
|
2021-11-30 15:45:36 +01:00
|
|
|
// Deployment is a k8s deployment.
|
2021-11-30 12:04:28 +01:00
|
|
|
type Deployment struct {
|
|
|
|
*K8sBase `yaml:",inline"`
|
|
|
|
Spec *DepSpec `yaml:"spec"`
|
|
|
|
}
|
|
|
|
|
2021-12-01 15:17:34 +01:00
|
|
|
func NewDeployment(name string) *Deployment {
|
2021-11-30 12:04:28 +01:00
|
|
|
d := &Deployment{K8sBase: NewBase(), Spec: NewDepSpec()}
|
2022-05-08 09:55:25 +02:00
|
|
|
d.K8sBase.Metadata.Name = ReleaseNameTpl + "-" + name
|
2021-11-30 12:04:28 +01:00
|
|
|
d.K8sBase.ApiVersion = "apps/v1"
|
|
|
|
d.K8sBase.Kind = "Deployment"
|
2021-12-01 15:17:34 +01:00
|
|
|
d.K8sBase.Metadata.Labels[K+"/component"] = name
|
2022-05-24 14:44:31 +02:00
|
|
|
d.K8sBase.Metadata.Labels[K+"/resource"] = "deployment"
|
2021-11-30 12:04:28 +01:00
|
|
|
return d
|
|
|
|
}
|
|
|
|
|
|
|
|
type DepSpec struct {
|
|
|
|
Replicas int `yaml:"replicas"`
|
|
|
|
Selector map[string]interface{} `yaml:"selector"`
|
|
|
|
Template PodTemplate `yaml:"template"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewDepSpec() *DepSpec {
|
|
|
|
return &DepSpec{
|
|
|
|
Replicas: 1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type PodSpec struct {
|
2021-11-30 17:29:42 +01:00
|
|
|
InitContainers []*Container `yaml:"initContainers,omitempty"`
|
|
|
|
Containers []*Container `yaml:"containers"`
|
|
|
|
Volumes []map[string]interface{} `yaml:"volumes,omitempty"`
|
2021-11-30 12:04:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type PodTemplate struct {
|
|
|
|
Metadata Metadata `yaml:"metadata"`
|
|
|
|
Spec PodSpec `yaml:"spec"`
|
|
|
|
}
|