Skip to content

Commit

Permalink
delete unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rambohe-ch committed Jun 18, 2023
1 parent 16d251d commit 4fa4de4
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions pkg/controller/servicetopology/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ import (
"time"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/tools/cache"

"github.com/openyurtio/openyurt/pkg/yurthub/filter/servicetopology"
)

type Adapter interface {
Expand All @@ -53,36 +50,6 @@ func appendKeys(keys []string, obj interface{}) []string {
return keys
}

func isNodePoolTypeSvc(namespace, name string, svcTopologyTypes map[string]string) bool {
svc := &corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: name,
},
}
key, err := cache.MetaNamespaceKeyFunc(svc)
if err != nil {
runtime.HandleError(err)
return false
}

return isNodePoolTypeTopology(svcTopologyTypes[key])
}

// TODO: if service topology need to support multi types,
// like openyurt.io/topologyKeys: "kubernetes.io/hostname, openyurt.io/nodepool, *".
// For simplicity,as long as the value of service topology annotation contains nodepool type,
// then this topology is recognized as nodepool type
func isNodePoolTypeTopology(topologyType string) bool {
if topologyType == servicetopology.AnnotationServiceTopologyValueNodePool {
return true
}
if topologyType == servicetopology.AnnotationServiceTopologyValueZone {
return true
}
return false
}

func getUpdateTriggerPatch() []byte {
patch := fmt.Sprintf(`{"metadata":{"annotations": {"openyurt.io/update-trigger": "%d"}}}`, time.Now().Unix())
return []byte(patch)
Expand Down

0 comments on commit 4fa4de4

Please sign in to comment.