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

fix: ApiVersion check fix #193

Merged
merged 1 commit into from
Oct 14, 2022
Merged
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
9 changes: 5 additions & 4 deletions pkg/sync/kubernetes/kubernetes_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package kubernetes
import (
"context"
"errors"
"fmt"
"os"
"time"

Expand Down Expand Up @@ -145,7 +146,7 @@ func createFuncHandler(obj interface{}, object client.ObjectKey, c chan<- sync.I
if err != nil {
return err
}
if ffObj.APIVersion != v1alpha1.GroupVersion.Version {
if ffObj.APIVersion != fmt.Sprintf("%s/%s", v1alpha1.GroupVersion.Group, v1alpha1.GroupVersion.Version) {
return errors.New("invalid api version")
}
if ffObj.Name == object.Name {
Expand All @@ -165,7 +166,7 @@ func updateFuncHandler(oldObj interface{}, newObj interface{}, object client.Obj
if err != nil {
return err
}
if ffOldObj.APIVersion != v1alpha1.GroupVersion.Version {
if ffOldObj.APIVersion != fmt.Sprintf("%s/%s", v1alpha1.GroupVersion.Group, v1alpha1.GroupVersion.Version) {
return errors.New("invalid api version")
}
var ffNewObj v1alpha1.FeatureFlagConfiguration
Expand All @@ -174,7 +175,7 @@ func updateFuncHandler(oldObj interface{}, newObj interface{}, object client.Obj
if err != nil {
return err
}
if ffNewObj.APIVersion != v1alpha1.GroupVersion.Version {
if ffNewObj.APIVersion != fmt.Sprintf("%s/%s", v1alpha1.GroupVersion.Group, v1alpha1.GroupVersion.Version) {
return errors.New("invalid api version")
}
if object.Name == ffNewObj.Name && ffOldObj.ResourceVersion != ffNewObj.ResourceVersion {
Expand All @@ -195,7 +196,7 @@ func deleteFuncHandler(obj interface{}, object client.ObjectKey, c chan<- sync.I
if err != nil {
return err
}
if ffObj.APIVersion != v1alpha1.GroupVersion.Version {
if ffObj.APIVersion != fmt.Sprintf("%s/%s", v1alpha1.GroupVersion.Group, v1alpha1.GroupVersion.Version) {
return errors.New("invalid api version")
}
if ffObj.Name == object.Name {
Expand Down