Skip to content

Commit 37bdcaa

Browse files
jayasheelankumarl-technicore
authored andcommitted
CCM upgrade to version 1.22
1 parent e10de4b commit 37bdcaa

File tree

2,950 files changed

+260840
-113830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,950 files changed

+260840
-113830
lines changed

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,17 @@ version:
182182
.PHONY: build-local
183183
build-local: build
184184

185+
.PHONY: test-local
186+
test-local: build-dirs
187+
@docker run --rm \
188+
--privileged \
189+
-w $(DOCKER_REPO_ROOT) \
190+
-v $(PWD):$(DOCKER_REPO_ROOT) \
191+
-e COMPONENT="$(COMPONENT)" \
192+
-e GOPATH=/go/ \
193+
odo-docker-signed-local.artifactory.oci.oraclecorp.com/odx-oke/oke/k8-manager-base:go1.16.1-1.0.9 \
194+
make coverage image
195+
185196
.PHONY: run-ccm-e2e-tests-local
186197
run-ccm-e2e-tests-local:
187198
./hack/run_e2e_test.sh

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.19
1+
1.22

cmd/oci-cloud-controller-manager/main.go

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ package main
1717
import (
1818
goflag "flag"
1919
"fmt"
20+
"k8s.io/apimachinery/pkg/util/wait"
21+
cloudprovider "k8s.io/cloud-provider"
22+
"k8s.io/cloud-provider/app/config"
23+
"k8s.io/cloud-provider/options"
2024
"math/rand"
2125
"os"
2226
"time"
@@ -25,11 +29,12 @@ import (
2529
"github.com/oracle/oci-cloud-controller-manager/pkg/logging"
2630
"github.com/spf13/pflag"
2731
"go.uber.org/zap"
32+
"k8s.io/cloud-provider/app"
2833
cliflag "k8s.io/component-base/cli/flag"
2934
"k8s.io/component-base/logs"
3035
_ "k8s.io/component-base/metrics/prometheus/restclient" // for client metric registration
3136
_ "k8s.io/component-base/metrics/prometheus/version" // for version metric registration
32-
"k8s.io/kubernetes/cmd/cloud-controller-manager/app"
37+
"k8s.io/klog/v2"
3338
)
3439

3540
var version string
@@ -42,7 +47,13 @@ func main() {
4247
defer logger.Sync()
4348
zap.ReplaceGlobals(logger)
4449

45-
command := app.NewCloudControllerManagerCommand()
50+
s, err := options.NewCloudControllerManagerOptions()
51+
if err != nil {
52+
logger.With(zap.Error(err)).Fatal("unable to initialize command options")
53+
}
54+
55+
fss := cliflag.NamedFlagSets{}
56+
command := app.NewCloudControllerManagerCommand(s, cloudInitializer, app.DefaultInitFuncConstructors, fss, wait.NeverStop)
4657

4758
// TODO: once we switch everything over to Cobra commands, we can go back to calling
4859
// utilflag.InitFlags() (by removing its pflag.Parse() call). For now, we have to set the
@@ -61,3 +72,25 @@ func main() {
6172
os.Exit(1)
6273
}
6374
}
75+
76+
func cloudInitializer(config *config.CompletedConfig) cloudprovider.Interface {
77+
cloudConfig := config.ComponentConfig.KubeCloudShared.CloudProvider
78+
// initialize cloud provider with the cloud provider name and config file provided
79+
cloud, err := cloudprovider.InitCloudProvider(cloudConfig.Name, cloudConfig.CloudConfigFile)
80+
if err != nil {
81+
klog.Fatalf("Cloud provider could not be initialized: %v", err)
82+
}
83+
if cloud == nil {
84+
klog.Fatalf("Cloud provider is nil")
85+
}
86+
87+
if !cloud.HasClusterID() {
88+
if config.ComponentConfig.KubeCloudShared.AllowUntaggedCloud {
89+
klog.Warning("detected a cluster without a ClusterID. A ClusterID will be required in the future. Please tag your cluster to avoid any future issues")
90+
} else {
91+
klog.Fatalf("no ClusterID found. A ClusterID is required for the cloud provider to function properly. This check can be bypassed by setting the allow-untagged-cloud option")
92+
}
93+
}
94+
95+
return cloud
96+
}

cmd/oci-csi-node-driver/nodedriveroptions/nodecsioptions.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ type NodeCSIOptions struct {
2727
}
2828

2929
type NodeOptions struct {
30-
Name string
31-
Endpoint string
32-
NodeID string
33-
Kubeconfig string
34-
Master string
35-
DriverName string
36-
DriverVersion string
37-
EnableControllerServer bool
30+
Name string
31+
Endpoint string
32+
NodeID string
33+
Kubeconfig string
34+
Master string
35+
DriverName string
36+
DriverVersion string
37+
EnableControllerServer bool
3838
}

go.mod

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
11
module github.com/oracle/oci-cloud-controller-manager
22

3-
go 1.15
3+
go 1.16
44

55
replace (
66
github.com/docker/docker => github.com/docker/engine v0.0.0-20181106193140-f5749085e9cb
77
github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.11.0
8-
google.golang.org/grpc => google.golang.org/grpc v1.26.0
9-
k8s.io/api => k8s.io/api v0.19.12
10-
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.19.12
11-
k8s.io/apimachinery => k8s.io/apimachinery v0.19.12
12-
k8s.io/apiserver => k8s.io/apiserver v0.19.12
13-
k8s.io/cli-runtime => k8s.io/cli-runtime v0.19.12
14-
k8s.io/client-go => k8s.io/client-go v0.19.12
15-
k8s.io/cloud-provider => k8s.io/cloud-provider v0.19.12
16-
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.19.12
17-
k8s.io/code-generator => k8s.io/code-generator v0.19.12
18-
k8s.io/component-base => k8s.io/component-base v0.19.12
19-
k8s.io/cri-api => k8s.io/cri-api v0.19.12
20-
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.19.12
21-
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.19.12
22-
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.19.12
23-
k8s.io/kube-proxy => k8s.io/kube-proxy v0.19.12
24-
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.19.12
25-
k8s.io/kubectl => k8s.io/kubectl v0.19.12
26-
k8s.io/kubelet => k8s.io/kubelet v0.19.12
27-
k8s.io/kubernetes => k8s.io/kubernetes v1.19.12
28-
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.19.12
29-
k8s.io/metrics => k8s.io/metrics v0.19.12
30-
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.19.12
8+
google.golang.org/grpc => google.golang.org/grpc v1.38.0
9+
k8s.io/api => k8s.io/api v0.22.5
10+
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.22.5
11+
k8s.io/apimachinery => k8s.io/apimachinery v0.22.5
12+
k8s.io/apiserver => k8s.io/apiserver v0.22.5
13+
k8s.io/cli-runtime => k8s.io/cli-runtime v0.22.5
14+
k8s.io/client-go => k8s.io/client-go v0.22.5
15+
k8s.io/cloud-provider => k8s.io/cloud-provider v0.22.5
16+
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.22.5
17+
k8s.io/code-generator => k8s.io/code-generator v0.22.5
18+
k8s.io/component-base => k8s.io/component-base v0.22.5
19+
k8s.io/component-helpers => k8s.io/component-helpers v0.22.5
20+
k8s.io/controller-manager => k8s.io/controller-manager v0.22.5
21+
k8s.io/cri-api => k8s.io/cri-api v0.22.5
22+
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.22.5
23+
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.22.5
24+
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.22.5
25+
k8s.io/kube-proxy => k8s.io/kube-proxy v0.22.5
26+
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.22.5
27+
k8s.io/kubectl => k8s.io/kubectl v0.22.5
28+
k8s.io/kubelet => k8s.io/kubelet v0.22.5
29+
k8s.io/kubernetes => k8s.io/kubernetes v1.22.5
30+
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.22.5
31+
k8s.io/metrics => k8s.io/metrics v0.22.5
32+
k8s.io/mount-utils => k8s.io/mount-utils v0.22.5
33+
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.22.5
34+
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.22.5
3135
)
3236

3337
require (
3438
github.com/NYTimes/gziphandler v1.0.1 // indirect
35-
github.com/container-storage-interface/spec v1.2.0
39+
github.com/container-storage-interface/spec v1.5.0
3640
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
3741
github.com/golang/protobuf v1.5.2
3842
github.com/hashicorp/golang-lru v0.5.4 // indirect
@@ -42,24 +46,29 @@ require (
4246
github.com/onsi/gomega v1.10.2
4347
github.com/oracle/oci-go-sdk/v50 v50.1.0
4448
github.com/pkg/errors v0.9.1
45-
github.com/prometheus/client_golang v1.9.0
49+
github.com/prometheus/client_golang v1.11.0
50+
github.com/spf13/cobra v1.1.3
4651
github.com/spf13/pflag v1.0.5
47-
github.com/spf13/viper v1.6.3
52+
github.com/spf13/viper v1.7.0
4853
go.uber.org/multierr v1.6.0 // indirect
49-
go.uber.org/zap v1.16.0
50-
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023
54+
go.uber.org/zap v1.17.0
55+
golang.org/x/net v0.0.0-20211209124913-491a49abca63
5156
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect
5257
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
5358
google.golang.org/grpc v1.38.0
5459
gopkg.in/natefinch/lumberjack.v2 v2.0.0
5560
gopkg.in/yaml.v2 v2.4.0
56-
k8s.io/api v0.19.12
57-
k8s.io/apimachinery v0.19.12
58-
k8s.io/client-go v0.19.12
59-
k8s.io/cloud-provider v0.19.12
60-
k8s.io/component-base v0.19.12
61+
k8s.io/api v0.22.5
62+
k8s.io/apimachinery v0.22.5
63+
k8s.io/apiserver v0.22.5
64+
k8s.io/client-go v0.22.5
65+
k8s.io/cloud-provider v0.22.5
66+
k8s.io/component-base v0.22.5
67+
k8s.io/csi-translation-lib v0.22.5
6168
k8s.io/klog v1.0.0
62-
k8s.io/kubernetes v1.19.12
63-
k8s.io/utils v0.0.0-20210305010621-2afb4311ab10
69+
k8s.io/klog/v2 v2.9.0
70+
k8s.io/kubelet v0.22.5
71+
k8s.io/kubernetes v1.22.5
72+
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a
6473
sigs.k8s.io/sig-storage-lib-external-provisioner/v6 v6.3.0
6574
)

pkg/cloudprovider/providers/oci/load_balancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2525
"k8s.io/apimachinery/pkg/labels"
2626
"k8s.io/apimachinery/pkg/util/sets"
27-
k8sports "k8s.io/kubernetes/pkg/master/ports"
27+
k8sports "k8s.io/kubernetes/pkg/cluster/ports"
2828

2929
providercfg "github.com/oracle/oci-cloud-controller-manager/pkg/cloudprovider/providers/oci/config"
3030
"github.com/oracle/oci-cloud-controller-manager/pkg/metrics"

pkg/cloudprovider/providers/oci/load_balancer_security_lists_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2727
v1listers "k8s.io/client-go/listers/core/v1"
2828
"k8s.io/client-go/tools/cache"
29-
k8sports "k8s.io/kubernetes/pkg/master/ports"
29+
k8sports "k8s.io/kubernetes/pkg/cluster/ports"
3030
)
3131

3232
func TestGetNodeIngressRules(t *testing.T) {

pkg/cloudprovider/providers/oci/util_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,19 @@ func TestDeepEqualLists(t *testing.T) {
9999

100100
func TestRemoveDuplicatesFromList(t *testing.T) {
101101
testCases := map[string]struct {
102-
list []string
102+
list []string
103103
result []string
104-
} {
104+
}{
105105
"List with Duplicates": {
106-
list: []string{"ocid1", "ocid2", "ocid1"},
106+
list: []string{"ocid1", "ocid2", "ocid1"},
107107
result: []string{"ocid1", "ocid2"},
108108
},
109109
"List with irregular order": {
110-
list: []string{"a", "c", "b"},
110+
list: []string{"a", "c", "b"},
111111
result: []string{"a", "b", "c"},
112112
},
113113
"List with duplicates and irregular order": {
114-
list: []string{"a", "a", "c", "b", "d", "c", "d"},
114+
list: []string{"a", "a", "c", "b", "d", "c", "d"},
115115
result: []string{"a", "b", "c", "d"},
116116
},
117117
}

pkg/csi/driver/controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,11 @@ func (d *ControllerDriver) ControllerExpandVolume(ctx context.Context, req *csi.
804804
}, nil
805805
}
806806

807+
// ControllerGetVolume returns ControllerGetVolumeResponse response
808+
func (d *ControllerDriver) ControllerGetVolume(ctx context.Context, req *csi.ControllerGetVolumeRequest) (*csi.ControllerGetVolumeResponse, error) {
809+
return nil, status.Error(codes.Unimplemented, "ControllerGetVolume is not supported yet")
810+
}
811+
807812
func provision(log *zap.SugaredLogger, c client.Interface, volName string, volSize int64, availDomainName, compartmentID,
808813
backupID, kmsKeyID string, vpusPerGB int64, timeout time.Duration, bvTags *config.TagConfig) (core.Volume, error) {
809814

pkg/csi/driver/fss_node.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
)
1919

2020
const (
21-
mountPath = "mount"
22-
FipsEnabled = "1"
21+
mountPath = "mount"
22+
FipsEnabled = "1"
2323
)
2424

2525
// NodeStageVolume mounts the volume to a staging path on the node.
@@ -32,9 +32,9 @@ func (d FSSNodeDriver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVo
3232
return nil, status.Error(codes.InvalidArgument, "Staging path must be provided")
3333
}
3434

35-
mountTargetIP, exportPath := validateVolumeId(req.VolumeId)
35+
mountTargetIP, exportPath := validateVolumeId(req.VolumeId)
3636

37-
if mountTargetIP == "" || exportPath == ""{
37+
if mountTargetIP == "" || exportPath == "" {
3838
return nil, status.Error(codes.InvalidArgument, "Invalid Volume ID provided")
3939
}
4040

@@ -180,7 +180,7 @@ func (d FSSNodeDriver) NodePublishVolume(ctx context.Context, req *csi.NodePubli
180180
readOnly := req.GetReadonly()
181181
// Use mount.IsNotMountPoint because mounter.IsLikelyNotMountPoint can't detect bind mounts
182182
isNotMountPoint, err := mount.IsNotMountPoint(mounter, targetPath)
183-
if err != nil{
183+
if err != nil {
184184
if os.IsNotExist(err) {
185185
logger.With("TargetPath", targetPath).Infof("mount point does not exist")
186186
// k8s v1.20+ will not create the TargetPath directory
@@ -236,7 +236,7 @@ func (d FSSNodeDriver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnp
236236

237237
// Use mount.IsNotMountPoint because mounter.IsLikelyNotMountPoint can't detect bind mounts
238238
isNotMountPoint, err := mount.IsNotMountPoint(mounter, targetPath)
239-
if err != nil{
239+
if err != nil {
240240
if os.IsNotExist(err) {
241241
logger.With("TargetPath", targetPath).Infof("mount point does not exist")
242242
return &csi.NodeUnpublishVolumeResponse{}, nil
@@ -270,9 +270,9 @@ func (d FSSNodeDriver) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnsta
270270
return nil, status.Error(codes.InvalidArgument, "Volume ID must be provided")
271271
}
272272

273-
mountTargetIP, exportPath := validateVolumeId(req.VolumeId)
273+
mountTargetIP, exportPath := validateVolumeId(req.VolumeId)
274274

275-
if mountTargetIP == "" || exportPath == ""{
275+
if mountTargetIP == "" || exportPath == "" {
276276
return nil, status.Error(codes.InvalidArgument, "Invalid Volume ID provided")
277277
}
278278

@@ -399,4 +399,3 @@ func (d FSSNodeDriver) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetV
399399
func (d FSSNodeDriver) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) {
400400
return nil, status.Error(codes.Unimplemented, "NodeExpandVolume is not supported yet")
401401
}
402-

0 commit comments

Comments
 (0)