@@ -33,7 +33,6 @@ import (
3333 "github.com/crunchydata/postgres-operator/tlsutil"
3434 log "github.com/sirupsen/logrus"
3535 v1 "k8s.io/api/core/v1"
36- "k8s.io/apimachinery/pkg/api/resource"
3736 "k8s.io/client-go/kubernetes"
3837 "k8s.io/client-go/rest"
3938)
@@ -84,11 +83,6 @@ type CredentialDetail struct {
8483
8584var Pgo config.PgoConfig
8685
87- type containerResourcesTemplateFields struct {
88- RequestsMemory , RequestsCPU string
89- LimitsMemory , LimitsCPU string
90- }
91-
9286func Initialize () {
9387
9488 PgoNamespace = os .Getenv ("PGO_OPERATOR_NAMESPACE" )
@@ -185,12 +179,6 @@ func initConfig() {
185179 log .Error ("Storage Settings are not defined correctly, can't continue" )
186180 os .Exit (2 )
187181 }
188-
189- if ! validContainerResourcesSettings () {
190- log .Error ("Container Resources settings are not defined correctly, can't continue" )
191- os .Exit (2 )
192- }
193-
194182}
195183
196184func BasicAuthCheck (username , password string ) bool {
@@ -347,17 +335,6 @@ func Authn(perm string, w http.ResponseWriter, r *http.Request) (string, error)
347335
348336}
349337
350- func validContainerResourcesSettings () bool {
351- log .Infof ("ContainerResources has %d definitions" , len (Pgo .ContainerResources ))
352-
353- //validate any Container Resources in pgo.yaml for correct formats
354- if ! IsValidContainerResourceValues () {
355- return false
356- }
357-
358- return true
359- }
360-
361338func validStorageSettings () bool {
362339 log .Infof ("Storage has %d definitions" , len (Pgo .Storage ))
363340
@@ -387,11 +364,6 @@ func validStorageSettings() bool {
387364
388365}
389366
390- func IsValidContainerResource (name string ) bool {
391- _ , ok := Pgo .ContainerResources [name ]
392- return ok
393- }
394-
395367func IsValidStorageName (name string ) bool {
396368 _ , ok := Pgo .Storage [name ]
397369 return ok
@@ -408,37 +380,6 @@ func ValidateNodeLabel(nodeLabel string) error {
408380 return nil
409381}
410382
411- func IsValidContainerResourceValues () bool {
412-
413- var err error
414-
415- for k , v := range Pgo .ContainerResources {
416- log .Infof ("Container Resources %s [%v]" , k , v )
417- resources , _ := Pgo .GetContainerResource (k )
418- _ , err = resource .ParseQuantity (resources .RequestsMemory )
419- if err != nil {
420- log .Errorf ("%s.RequestsMemory value invalid format" , k )
421- return false
422- }
423- _ , err = resource .ParseQuantity (resources .RequestsCPU )
424- if err != nil {
425- log .Errorf ("%s.RequestsCPU value invalid format" , k )
426- return false
427- }
428- _ , err = resource .ParseQuantity (resources .LimitsMemory )
429- if err != nil {
430- log .Errorf ("%s.LimitsMemory value invalid format" , k )
431- return false
432- }
433- _ , err = resource .ParseQuantity (resources .LimitsCPU )
434- if err != nil {
435- log .Errorf ("%s.LimitsCPU value invalid format" , k )
436- return false
437- }
438- }
439- return true
440- }
441-
442383func validateWithKube () {
443384 log .Debug ("validateWithKube called" )
444385
0 commit comments