Skip to content

Commit db6505e

Browse files
GouthamMLYashwantGohokar
authored andcommitted
Add unit test to for merging common tags tags at the time of creation of LB & storage resources
Merge common free-form & defined tags to LB, NLB & FSS during provision Squashed commit: fix not using generics to remove Go >=1.18 dependency
1 parent f72b283 commit db6505e

File tree

7 files changed

+1119
-19
lines changed

7 files changed

+1119
-19
lines changed

pkg/cloudprovider/providers/oci/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"github.com/oracle/oci-go-sdk/v65/common"
2323
"github.com/oracle/oci-go-sdk/v65/common/auth"
2424
"github.com/pkg/errors"
25-
2625
"go.uber.org/zap"
2726
"gopkg.in/yaml.v2"
2827
)
@@ -127,6 +126,7 @@ type InitialTags struct {
127126
LoadBalancer *TagConfig `yaml:"loadBalancer"`
128127
BlockVolume *TagConfig `yaml:"blockVolume"`
129128
FSS *TagConfig `yaml:"fss"`
129+
Common *TagConfig `yaml:"common"`
130130
}
131131

132132
// Config holds the OCI cloud-provider config passed to Kubernetes components
@@ -151,7 +151,7 @@ type Config struct {
151151
// cluster resides.
152152
VCNID string `yaml:"vcn"`
153153

154-
//Metadata service to help fill in certain fields
154+
// Metadata service to help fill in certain fields
155155
metadataSvc metadata.Interface
156156
}
157157

pkg/cloudprovider/providers/oci/load_balancer_spec.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package oci
1717
import (
1818
"encoding/json"
1919
"fmt"
20+
"github.com/oracle/oci-cloud-controller-manager/pkg/util"
2021
"net"
2122
"net/http"
2223
"strconv"
@@ -377,6 +378,10 @@ func NewLBSpec(logger *zap.SugaredLogger, svc *v1.Service, nodes []*v1.Node, sub
377378
if err != nil {
378379
return nil, err
379380
}
381+
// merge lbtags with common tags if present
382+
if util.IsCommonTagPresent(initialLBTags) {
383+
lbTags = util.MergeTagConfig(lbTags, initialLBTags.Common)
384+
}
380385

381386
ruleManagementMode, managedNsg, err := getRuleManagementMode(svc)
382387
if err != nil {
@@ -1286,6 +1291,7 @@ func getLoadBalancerTags(svc *v1.Service, initialTags *config.InitialTags) (*con
12861291
if initialTags == nil || initialTags.LoadBalancer == nil {
12871292
return &config.TagConfig{}, nil
12881293
}
1294+
12891295
// return initial tags
12901296
return initialTags.LoadBalancer, nil
12911297
}

0 commit comments

Comments
 (0)