Files
katenary/helm/storage.go
Patrice Ferlet fe2a655796 Enhancements, see details
- Added a message to explain to the user that it needs to build and push
  images
- The Release Name string is now a constant ins source code, later we will be able to
  change it to (for example) a template call
- SHA256 injected label (from docker-compose file content) is a bit long, SHA1 is shorter
- We now add compose command line and generation date in the Values file
- Code cleanup, refactorisation and enhancements
- More documentation in the source code
2021-12-05 09:05:48 +01:00

31 lines
810 B
Go

package helm
type Storage struct {
*K8sBase `yaml:",inline"`
Spec *PVCSpec
}
func NewPVC(name, storageName string) *Storage {
pvc := &Storage{}
pvc.K8sBase = NewBase()
pvc.K8sBase.Kind = "PersistentVolumeClaim"
pvc.K8sBase.Metadata.Labels[K+"/pvc-name"] = storageName
pvc.K8sBase.ApiVersion = "v1"
pvc.K8sBase.Metadata.Name = RELEASE_NAME + "-" + storageName
pvc.K8sBase.Metadata.Labels[K+"/component"] = name
pvc.Spec = &PVCSpec{
Resouces: map[string]interface{}{
"requests": map[string]string{
"storage": "{{ .Values." + name + ".persistence." + storageName + ".capacity }}",
},
},
AccessModes: []string{"ReadWriteOnce"},
}
return pvc
}
type PVCSpec struct {
Resouces map[string]interface{} `yaml:"resources"`
AccessModes []string `yaml:"accessModes"`
}