Use compose-go https://github.com/compose-spec/compose-go to make Katenary parsing compose file the official way. Add labels: - `volume-from` (with `same-pod`) to avoid volume repetition - `ignore` to ignore a service - `mapenv` (replaces the `env-to-service`) to map environment to helm variable (as a template string) - `secret-vars` declares variables as secret values More: - Now, environment (as secret vars) are set in values.yaml - Ingress has got annotations in values.yaml - Probes (liveness probe) are improved - fixed code to optimize - many others fixes about path, bad volume check, refactorisation, tests...
40 lines
997 B
Go
40 lines
997 B
Go
package helm
|
|
|
|
// Deployment is a k8s deployment.
|
|
type Deployment struct {
|
|
*K8sBase `yaml:",inline"`
|
|
Spec *DepSpec `yaml:"spec"`
|
|
}
|
|
|
|
func NewDeployment(name string) *Deployment {
|
|
d := &Deployment{K8sBase: NewBase(), Spec: NewDepSpec()}
|
|
d.K8sBase.Metadata.Name = ReleaseNameTpl + "-" + name
|
|
d.K8sBase.ApiVersion = "apps/v1"
|
|
d.K8sBase.Kind = "Deployment"
|
|
d.K8sBase.Metadata.Labels[K+"/component"] = name
|
|
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 {
|
|
InitContainers []*Container `yaml:"initContainers,omitempty"`
|
|
Containers []*Container `yaml:"containers"`
|
|
Volumes []map[string]interface{} `yaml:"volumes,omitempty"`
|
|
}
|
|
|
|
type PodTemplate struct {
|
|
Metadata Metadata `yaml:"metadata"`
|
|
Spec PodSpec `yaml:"spec"`
|
|
}
|