@@ -13,7 +13,7 @@ import (
13
13
// keyFunc is used to get the key of a resource, usually, which is the ID of the resource
14
14
func keyFunc (obj interface {}) (string , error ) {
15
15
switch v := obj .(type ) {
16
- case model.SegmentPort :
16
+ case model.VpcSubnetPort :
17
17
return * v .Id , nil
18
18
case types.UID :
19
19
return string (v ), nil
@@ -36,7 +36,7 @@ func filterTag(tags []model.Tag, tagScope string) []string {
36
36
// index is used to filter out resources which are related to the CR
37
37
func subnetPortIndexByCRUID (obj interface {}) ([]string , error ) {
38
38
switch o := obj .(type ) {
39
- case model.SegmentPort :
39
+ case model.VpcSubnetPort :
40
40
return filterTag (o .Tags , common .TagScopeSubnetPortCRUID ), nil
41
41
default :
42
42
return nil , errors .New ("subnetPortIndexByCRUID doesn't support unknown type" )
@@ -45,7 +45,7 @@ func subnetPortIndexByCRUID(obj interface{}) ([]string, error) {
45
45
46
46
func subnetPortIndexByPodUID (obj interface {}) ([]string , error ) {
47
47
switch o := obj .(type ) {
48
- case model.SegmentPort :
48
+ case model.VpcSubnetPort :
49
49
return filterTag (o .Tags , common .TagScopePodUID ), nil
50
50
default :
51
51
return nil , errors .New ("subnetPortIndexByCRUID doesn't support unknown type" )
@@ -54,7 +54,7 @@ func subnetPortIndexByPodUID(obj interface{}) ([]string, error) {
54
54
55
55
func subnetPortIndexBySubnetID (obj interface {}) ([]string , error ) {
56
56
switch o := obj .(type ) {
57
- case model.SegmentPort :
57
+ case model.VpcSubnetPort :
58
58
vpcInfo , err := common .ParseVPCResourcePath (* o .Path )
59
59
if err != nil {
60
60
return nil , err
@@ -75,7 +75,7 @@ func (vs *SubnetPortStore) Apply(i interface{}) error {
75
75
if i == nil {
76
76
return nil
77
77
}
78
- subnetPort := i .(* model.SegmentPort )
78
+ subnetPort := i .(* model.VpcSubnetPort )
79
79
if subnetPort .MarkedForDelete != nil && * subnetPort .MarkedForDelete {
80
80
err := vs .Delete (* subnetPort )
81
81
log .V (1 ).Info ("delete SubnetPort from store" , "subnetport" , subnetPort )
@@ -92,34 +92,34 @@ func (vs *SubnetPortStore) Apply(i interface{}) error {
92
92
return nil
93
93
}
94
94
95
- func (subnetPortStore * SubnetPortStore ) GetByKey (key string ) * model.SegmentPort {
96
- var subnetPort model.SegmentPort
95
+ func (subnetPortStore * SubnetPortStore ) GetByKey (key string ) * model.VpcSubnetPort {
96
+ var subnetPort model.VpcSubnetPort
97
97
obj := subnetPortStore .ResourceStore .GetByKey (key )
98
98
if obj != nil {
99
- subnetPort = obj .(model.SegmentPort )
99
+ subnetPort = obj .(model.VpcSubnetPort )
100
100
}
101
101
return & subnetPort
102
102
}
103
103
104
- func (subnetPortStore * SubnetPortStore ) GetByIndex (key string , value string ) []model.SegmentPort {
105
- segmentPorts := make ([]model.SegmentPort , 0 )
104
+ func (subnetPortStore * SubnetPortStore ) GetByIndex (key string , value string ) []model.VpcSubnetPort {
105
+ subnetPorts := make ([]model.VpcSubnetPort , 0 )
106
106
objs := subnetPortStore .ResourceStore .GetByIndex (key , value )
107
107
for _ , subnetPort := range objs {
108
- segmentPorts = append (segmentPorts , subnetPort .(model.SegmentPort ))
108
+ subnetPorts = append (subnetPorts , subnetPort .(model.VpcSubnetPort ))
109
109
}
110
- return segmentPorts
110
+ return subnetPorts
111
111
}
112
112
113
- func (vs * SubnetPortStore ) GetSubnetPortsByNamespace (ns string ) []model.SegmentPort {
114
- var ret []model.SegmentPort
113
+ func (vs * SubnetPortStore ) GetSubnetPortsByNamespace (ns string ) []model.VpcSubnetPort {
114
+ var ret []model.VpcSubnetPort
115
115
subnetPorts := vs .List ()
116
116
if len (subnetPorts ) == 0 {
117
117
log .V (1 ).Info ("No subnet port found in SubnetPort store" )
118
118
return ret
119
119
}
120
120
121
121
for _ , subnetPort := range subnetPorts {
122
- msubnetport := subnetPort .(model.SegmentPort )
122
+ msubnetport := subnetPort .(model.VpcSubnetPort )
123
123
tags := msubnetport .Tags
124
124
for _ , tag := range tags {
125
125
// TODO: consider to create index for common.TagScopeNamespace like common.TagScopeSubnetPortCRUID, and leverage functions like getByIndex to perform searches.
0 commit comments