diff --git a/Makefile b/Makefile index e73bc165a..1b06432be 100644 --- a/Makefile +++ b/Makefile @@ -126,7 +126,7 @@ allclean: clean clean-cache test: test-gopkgs -verify: verify-godeps verify-fmt +verify: verify-godeps verify-fmt verify-generate # # build targets @@ -372,6 +372,17 @@ verify-fmt: exit 1; \ fi +verify-generate: generate + $(Q) git diff --quiet; ec="$$?"; \ + if [ "$$ec" != "0" ]; then \ + echo "ERROR: generated artifacts are not up-to-date."; \ + echo "ERROR:"; \ + git --no-pager diff | sed 's/^/ERROR: /g'; \ + echo "ERROR:"; \ + echo "ERROR: please run 'make generate' and commit these changes."; \ + exit "$$ec"; \ + fi + # # targets for installing dependencies # diff --git a/config/crd/bases/config.nri_balloonspolicies.yaml b/config/crd/bases/config.nri_balloonspolicies.yaml index 178c7d280..61cb9f473 100644 --- a/config/crd/bases/config.nri_balloonspolicies.yaml +++ b/config/crd/bases/config.nri_balloonspolicies.yaml @@ -106,6 +106,12 @@ spec: items: type: string type: array + preferCloseToDevices: + description: 'PreferCloseToDevices: prefer creating new balloons + of this type close to listed devices.' + items: + type: string + type: array preferNewBalloons: description: 'PreferNewBalloons: prefer creating new balloons over adding containers to existing balloons. The default is @@ -297,7 +303,6 @@ spec: description: Reserved (CPU) resources for kube-system namespace. type: object required: - - idleCPUClass - reservedResources type: object status: diff --git a/deployment/helm/balloons/crds/config.nri_balloonspolicies.yaml b/deployment/helm/balloons/crds/config.nri_balloonspolicies.yaml index 07121dd55..61cb9f473 100644 --- a/deployment/helm/balloons/crds/config.nri_balloonspolicies.yaml +++ b/deployment/helm/balloons/crds/config.nri_balloonspolicies.yaml @@ -107,7 +107,8 @@ spec: type: string type: array preferCloseToDevices: - description: prefer creating new balloons of this type close to listed devices. + description: 'PreferCloseToDevices: prefer creating new balloons + of this type close to listed devices.' items: type: string type: array @@ -302,7 +303,6 @@ spec: description: Reserved (CPU) resources for kube-system namespace. type: object required: - - idleCPUClass - reservedResources type: object status: diff --git a/pkg/apis/config/v1alpha1/resmgr/policy/balloons/config.go b/pkg/apis/config/v1alpha1/resmgr/policy/balloons/config.go index 3b1c4f7e7..42af407ca 100644 --- a/pkg/apis/config/v1alpha1/resmgr/policy/balloons/config.go +++ b/pkg/apis/config/v1alpha1/resmgr/policy/balloons/config.go @@ -46,7 +46,7 @@ type Config struct { PinMemory *bool `json:"pinMemory,omitempty"` // IdleCpuClass controls how unusded CPUs outside any a // balloons are (re)configured. - IdleCpuClass string `json:"idleCPUClass",omitempty"` + IdleCpuClass string `json:"idleCPUClass,omitempty"` // ReservedPoolNamespaces is a list of namespace globs that // will be allocated to reserved CPUs. ReservedPoolNamespaces []string `json:"reservedPoolNamespaces,omitempty"` @@ -185,10 +185,12 @@ type BalloonDef struct { ShareIdleCpusInSame CPUTopologyLevel `json:"shareIdleCPUsInSame,omitempty"` // PreferCloseToDevices: prefer creating new balloons of this // type close to listed devices. - PreferCloseToDevices []string `json:"preferCloseToDevices",omitempty` + PreferCloseToDevices []string `json:"preferCloseToDevices,omitempty"` // PreferFarFromDevices: prefer creating new balloons of this // type far from listed devices. - PreferFarFromDevices []string `json:"preferFarFromDevices",omitempty` + // TODO: PreferFarFromDevices is considered too untested for usage. Hence, + // for the time being we prevent its usage through CRDs. + PreferFarFromDevices []string `json:"-"` } // String stringifies a BalloonDef diff --git a/pkg/apis/config/v1alpha1/resmgr/policy/balloons/zz_generated.deepcopy.go b/pkg/apis/config/v1alpha1/resmgr/policy/balloons/zz_generated.deepcopy.go index c443ed6e3..be332eaae 100644 --- a/pkg/apis/config/v1alpha1/resmgr/policy/balloons/zz_generated.deepcopy.go +++ b/pkg/apis/config/v1alpha1/resmgr/policy/balloons/zz_generated.deepcopy.go @@ -41,6 +41,16 @@ func (in *BalloonDef) DeepCopyInto(out *BalloonDef) { *out = new(bool) **out = **in } + if in.PreferCloseToDevices != nil { + in, out := &in.PreferCloseToDevices, &out.PreferCloseToDevices + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PreferFarFromDevices != nil { + in, out := &in.PreferFarFromDevices, &out.PreferFarFromDevices + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BalloonDef.