Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schedconf: consume deployer updates #734

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ exclude:
- "vendor/github.com/k8stopologyawareschedwg/deployer/pkg/kubeletconfig/*"
- "vendor/github.com/golang/**"
- "vendor/github.com/google/**"
- "vendor/github.com/go-task/slim-sprig/**"
- "vendor/github.com/openshift/**"
- "vendor/github.com/onsi/gomega**"
- "vendor/github.com/onsi/ginkgo/**"
Expand Down
21 changes: 20 additions & 1 deletion controllers/numaresourcesscheduler_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import (

"github.com/pkg/errors"

k8swgmanifests "github.com/k8stopologyawareschedwg/deployer/pkg/manifests"

nropv1 "github.com/openshift-kni/numaresources-operator/api/numaresourcesoperator/v1"
"github.com/openshift-kni/numaresources-operator/pkg/apply"
"github.com/openshift-kni/numaresources-operator/pkg/hash"
Expand Down Expand Up @@ -194,7 +196,24 @@ func (r *NUMAResourcesSchedulerReconciler) syncNUMASchedulerResources(ctx contex
schedSpec := instance.Spec.Normalize()

cacheResyncPeriod := unpackAPIResyncPeriod(schedSpec.CacheResyncPeriod)
if err := schedupdate.SchedulerConfigWithFilter(r.SchedulerManifests.ConfigMap, schedSpec.SchedulerName, schedupdate.CleanSchedulerConfig, cacheResyncPeriod); err != nil {

resyncPeriod := int64(cacheResyncPeriod.Seconds())
params := k8swgmanifests.ConfigParams{
ProfileName: schedSpec.SchedulerName,
Cache: &k8swgmanifests.ConfigCacheParams{
ResyncPeriodSeconds: &resyncPeriod,
},
}

schedName, ok := schedstate.SchedulerNameFromObject(r.SchedulerManifests.ConfigMap)
if !ok {
err := fmt.Errorf("missing scheduler name in builtin config map")
klog.V(2).ErrorS(err, "cannot find the scheduler profile name")
return nropv1.NUMAResourcesSchedulerStatus{}, err
}
klog.V(4).InfoS("detected scheduler profile", "profileName", schedName)

if err := schedupdate.SchedulerConfig(r.SchedulerManifests.ConfigMap, schedName, &params); err != nil {
return nropv1.NUMAResourcesSchedulerStatus{}, err
}

Expand Down
6 changes: 3 additions & 3 deletions controllers/numaresourcesscheduler_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ var _ = ginkgo.Describe("Test NUMAResourcesScheduler Reconcile", func() {

name, found := sched.SchedulerNameFromObject(cm)
gomega.Expect(found).To(gomega.BeTrue())
gomega.Expect(name).To(gomega.BeEquivalentTo(testSchedulerName))
gomega.Expect(name).To(gomega.BeEquivalentTo(testSchedulerName), "found scheduler %q expected %q", name, testSchedulerName)
})

ginkgo.It("should expose the resync period in status", func() {
Expand Down Expand Up @@ -405,11 +405,11 @@ func pop(m map[string]string, k string) string {
}

func diffYAML(want, got string) (string, error) {
cfgWant, err := depmanifests.DecodeSchedulerConfigFromData([]byte(want))
cfgWant, err := depmanifests.DecodeSchedulerProfilesFromData([]byte(want))
if err != nil {
return "", err
}
cfgGot, err := depmanifests.DecodeSchedulerConfigFromData([]byte(got))
cfgGot, err := depmanifests.DecodeSchedulerProfilesFromData([]byte(got))
if err != nil {
return "", err
}
Expand Down
69 changes: 31 additions & 38 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/go-logr/logr v1.2.4
github.com/google/go-cmp v0.5.9
github.com/jaypipes/ghw v0.9.0
github.com/k8stopologyawareschedwg/deployer v0.12.1-0.20230322120411-111a4d4522b1
github.com/k8stopologyawareschedwg/deployer v0.12.2
github.com/k8stopologyawareschedwg/noderesourcetopology-api v0.1.1
github.com/k8stopologyawareschedwg/podfingerprint v0.2.2
github.com/k8stopologyawareschedwg/resource-topology-exporter v0.14.3
Expand All @@ -26,14 +26,12 @@ require (
k8s.io/apiextensions-apiserver v0.27.2
k8s.io/apimachinery v0.27.2
k8s.io/client-go v0.27.2
k8s.io/code-generator v0.26.7
k8s.io/code-generator v0.26.10
k8s.io/klog/v2 v2.90.1
k8s.io/kubectl v0.25.1
k8s.io/kubelet v0.26.7
k8s.io/kubernetes v1.26.7
k8s.io/kubelet v0.26.10
kubevirt.io/qe-tools v0.1.8
sigs.k8s.io/controller-runtime v0.15.0
sigs.k8s.io/scheduler-plugins v0.24.9
sigs.k8s.io/yaml v1.3.0
)

Expand All @@ -59,12 +57,14 @@ require (
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
Expand All @@ -90,7 +90,7 @@ require (
github.com/vincent-petithory/dataurl v1.0.0 // indirect
go.uber.org/ratelimit v0.2.0 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
Expand All @@ -107,11 +107,9 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
howett.net/plist v1.0.0 // indirect
k8s.io/apiserver v0.26.7 // indirect
k8s.io/component-base v0.27.2 // indirect
k8s.io/gengo v0.0.0-20220902162205-c0856e24416d // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/kube-scheduler v0.26.7 // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
Expand All @@ -120,41 +118,36 @@ require (
replace (
github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2
golang.org/x/text => golang.org/x/text v0.3.8
k8s.io/api => k8s.io/api v0.26.7
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.26.7
k8s.io/apimachinery => k8s.io/apimachinery v0.26.7
k8s.io/apiserver => k8s.io/apiserver v0.26.7
k8s.io/cli-runtime => k8s.io/cli-runtime v0.26.7
k8s.io/client-go => k8s.io/client-go v0.26.7
k8s.io/cloud-provider => k8s.io/cloud-provider v0.26.7
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.26.7
k8s.io/code-generator => k8s.io/code-generator v0.26.7
k8s.io/component-base => k8s.io/component-base v0.26.7
k8s.io/component-helpers => k8s.io/component-helpers v0.26.7
k8s.io/controller-manager => k8s.io/controller-manager v0.26.7
k8s.io/cri-api => k8s.io/cri-api v0.26.7
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.26.7
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.26.7
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.26.7
k8s.io/kube-proxy => k8s.io/kube-proxy v0.26.7
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.26.7
k8s.io/kubectl => k8s.io/kubectl v0.26.7
k8s.io/kubelet => k8s.io/kubelet v0.26.7
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.26.7
k8s.io/metrics => k8s.io/metrics v0.26.7
k8s.io/mount-utils => k8s.io/mount-utils v0.26.7
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.26.7
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.26.7
k8s.io/api => k8s.io/api v0.26.10
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.26.10
k8s.io/apimachinery => k8s.io/apimachinery v0.26.10
k8s.io/apiserver => k8s.io/apiserver v0.26.10
k8s.io/cli-runtime => k8s.io/cli-runtime v0.26.10
k8s.io/client-go => k8s.io/client-go v0.26.10
k8s.io/cloud-provider => k8s.io/cloud-provider v0.26.10
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.26.10
k8s.io/code-generator => k8s.io/code-generator v0.26.10
k8s.io/component-base => k8s.io/component-base v0.26.10
k8s.io/component-helpers => k8s.io/component-helpers v0.26.10
k8s.io/controller-manager => k8s.io/controller-manager v0.26.10
k8s.io/cri-api => k8s.io/cri-api v0.26.10
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.26.10
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.26.10
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.26.10
k8s.io/kube-proxy => k8s.io/kube-proxy v0.26.10
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.26.10
k8s.io/kubectl => k8s.io/kubectl v0.26.10
k8s.io/kubelet => k8s.io/kubelet v0.26.10
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.26.10
k8s.io/metrics => k8s.io/metrics v0.26.10
k8s.io/mount-utils => k8s.io/mount-utils v0.26.10
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.26.10
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.26.10
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.14.6
)

// local pinning
replace (
github.com/containerd/containerd => github.com/containerd/containerd v1.4.11
github.com/onsi/ginkgo/v2 => github.com/onsi/ginkgo/v2 v2.4.0
github.com/onsi/gomega => github.com/onsi/gomega v1.23.0
github.com/openshift/machine-config-operator => github.com/openshift/machine-config-operator v0.0.1-0.20230724174830-7b54f1dcce4e // release-4.13
golang.org/x/net => golang.org/x/net v0.17.0
golang.org/x/sys => golang.org/x/sys v0.13.0
google.golang.org/grpc => google.golang.org/grpc v1.58.3
)
Loading