Skip to content

Commit

Permalink
fix: register TransparentMemoryOffloadingIndicators to workload group
Browse files Browse the repository at this point in the history
  • Loading branch information
LuyaoZhong committed Mar 20, 2024
1 parent 0e012b7 commit 2b8429a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/apis/config/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ import (
workloadapi "github.com/kubewharf/katalyst-api/pkg/apis/workload/v1alpha1"
)

func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
workloadapi.SchemeBuilder.Register(addSPDKnownTypes)
}

const (
// GroupName is the group name used in this package
GroupName string = "config.katalyst.kubewharf.io"
Expand Down Expand Up @@ -53,6 +60,12 @@ var (
AddToScheme = SchemeBuilder.AddToScheme
)

func addSPDKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(workloadapi.SchemeGroupVersion,
&TransparentMemoryOffloadingIndicators{})
return nil
}

// Adds the list of known types to the given scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
Expand All @@ -70,9 +83,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&TransparentMemoryOffloadingConfigurationList{},
)

scheme.AddKnownTypes(workloadapi.SchemeGroupVersion,
&TransparentMemoryOffloadingIndicators{})

metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

0 comments on commit 2b8429a

Please sign in to comment.