Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
369b81b4
Commit
369b81b4
authored
Jan 26, 2023
by
Brad Davidson
Committed by
Brad Davidson
Jan 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Honor Service ExternalTrafficPolicy
Signed-off-by:
Brad Davidson
<
brad.davidson@rancher.com
>
parent
94d1a875
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
129 additions
and
57 deletions
+129
-57
ccm.yaml
manifests/ccm.yaml
+8
-0
cloudprovider.go
pkg/cloudprovider/cloudprovider.go
+7
-2
servicelb.go
pkg/cloudprovider/servicelb.go
+111
-52
server.go
pkg/daemons/control/server.go
+3
-3
No files found.
manifests/ccm.yaml
View file @
369b81b4
...
@@ -67,6 +67,14 @@ rules:
...
@@ -67,6 +67,14 @@ rules:
-
daemonsets
-
daemonsets
verbs
:
verbs
:
-
"
*"
-
"
*"
-
apiGroups
:
-
"
discovery.k8s.io"
resources
:
-
endpointslices
verbs
:
-
get
-
list
-
watch
---
---
apiVersion
:
rbac.authorization.k8s.io/v1
apiVersion
:
rbac.authorization.k8s.io/v1
kind
:
ClusterRoleBinding
kind
:
ClusterRoleBinding
...
...
pkg/cloudprovider/cloudprovider.go
View file @
369b81b4
...
@@ -12,6 +12,8 @@ import (
...
@@ -12,6 +12,8 @@ import (
appsclient
"github.com/rancher/wrangler/pkg/generated/controllers/apps/v1"
appsclient
"github.com/rancher/wrangler/pkg/generated/controllers/apps/v1"
"github.com/rancher/wrangler/pkg/generated/controllers/core"
"github.com/rancher/wrangler/pkg/generated/controllers/core"
coreclient
"github.com/rancher/wrangler/pkg/generated/controllers/core/v1"
coreclient
"github.com/rancher/wrangler/pkg/generated/controllers/core/v1"
"github.com/rancher/wrangler/pkg/generated/controllers/discovery"
discoveryclient
"github.com/rancher/wrangler/pkg/generated/controllers/discovery/v1"
"github.com/rancher/wrangler/pkg/generic"
"github.com/rancher/wrangler/pkg/generic"
"github.com/rancher/wrangler/pkg/start"
"github.com/rancher/wrangler/pkg/start"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus"
...
@@ -41,6 +43,7 @@ type k3s struct {
...
@@ -41,6 +43,7 @@ type k3s struct {
processor
apply
.
Apply
processor
apply
.
Apply
daemonsetCache
appsclient
.
DaemonSetCache
daemonsetCache
appsclient
.
DaemonSetCache
endpointsCache
discoveryclient
.
EndpointSliceCache
nodeCache
coreclient
.
NodeCache
nodeCache
coreclient
.
NodeCache
podCache
coreclient
.
PodCache
podCache
coreclient
.
PodCache
workqueue
workqueue
.
RateLimitingInterface
workqueue
workqueue
.
RateLimitingInterface
...
@@ -89,6 +92,7 @@ func (k *k3s) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, st
...
@@ -89,6 +92,7 @@ func (k *k3s) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, st
lbCoreFactory
:=
core
.
NewFactoryFromConfigWithOptionsOrDie
(
config
,
&
generic
.
FactoryOptions
{
Namespace
:
k
.
LBNamespace
})
lbCoreFactory
:=
core
.
NewFactoryFromConfigWithOptionsOrDie
(
config
,
&
generic
.
FactoryOptions
{
Namespace
:
k
.
LBNamespace
})
lbAppsFactory
:=
apps
.
NewFactoryFromConfigWithOptionsOrDie
(
config
,
&
generic
.
FactoryOptions
{
Namespace
:
k
.
LBNamespace
})
lbAppsFactory
:=
apps
.
NewFactoryFromConfigWithOptionsOrDie
(
config
,
&
generic
.
FactoryOptions
{
Namespace
:
k
.
LBNamespace
})
lbDiscFactory
:=
discovery
.
NewFactoryFromConfigOrDie
(
config
)
processor
,
err
:=
apply
.
NewForConfig
(
config
)
processor
,
err
:=
apply
.
NewForConfig
(
config
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -96,14 +100,15 @@ func (k *k3s) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, st
...
@@ -96,14 +100,15 @@ func (k *k3s) Initialize(clientBuilder cloudprovider.ControllerClientBuilder, st
}
}
k
.
processor
=
processor
.
WithDynamicLookup
()
.
WithCacheTypes
(
lbAppsFactory
.
Apps
()
.
V1
()
.
DaemonSet
())
k
.
processor
=
processor
.
WithDynamicLookup
()
.
WithCacheTypes
(
lbAppsFactory
.
Apps
()
.
V1
()
.
DaemonSet
())
k
.
daemonsetCache
=
lbAppsFactory
.
Apps
()
.
V1
()
.
DaemonSet
()
.
Cache
()
k
.
daemonsetCache
=
lbAppsFactory
.
Apps
()
.
V1
()
.
DaemonSet
()
.
Cache
()
k
.
endpointsCache
=
lbDiscFactory
.
Discovery
()
.
V1
()
.
EndpointSlice
()
.
Cache
()
k
.
podCache
=
lbCoreFactory
.
Core
()
.
V1
()
.
Pod
()
.
Cache
()
k
.
podCache
=
lbCoreFactory
.
Core
()
.
V1
()
.
Pod
()
.
Cache
()
k
.
workqueue
=
workqueue
.
NewRateLimitingQueue
(
workqueue
.
DefaultControllerRateLimiter
())
k
.
workqueue
=
workqueue
.
NewRateLimitingQueue
(
workqueue
.
DefaultControllerRateLimiter
())
if
err
:=
k
.
Register
(
ctx
,
coreFactory
.
Core
()
.
V1
()
.
Node
(),
lbCoreFactory
.
Core
()
.
V1
()
.
Pod
());
err
!=
nil
{
if
err
:=
k
.
Register
(
ctx
,
coreFactory
.
Core
()
.
V1
()
.
Node
(),
lbCoreFactory
.
Core
()
.
V1
()
.
Pod
()
,
lbDiscFactory
.
Discovery
()
.
V1
()
.
EndpointSlice
()
);
err
!=
nil
{
logrus
.
Fatalf
(
"Failed to register %s handlers: %v"
,
controllerName
,
err
)
logrus
.
Fatalf
(
"Failed to register %s handlers: %v"
,
controllerName
,
err
)
}
}
if
err
:=
start
.
All
(
ctx
,
1
,
coreFactory
,
lbCoreFactory
,
lbAppsFactory
);
err
!=
nil
{
if
err
:=
start
.
All
(
ctx
,
1
,
coreFactory
,
lbCoreFactory
,
lbAppsFactory
,
lbDiscFactory
);
err
!=
nil
{
logrus
.
Fatalf
(
"Failed to start %s controllers: %v"
,
controllerName
,
err
)
logrus
.
Fatalf
(
"Failed to start %s controllers: %v"
,
controllerName
,
err
)
}
}
}
else
{
}
else
{
...
...
pkg/cloudprovider/servicelb.go
View file @
369b81b4
This diff is collapsed.
Click to expand it.
pkg/daemons/control/server.go
View file @
369b81b4
...
@@ -371,9 +371,9 @@ func cloudControllerManager(ctx context.Context, cfg *config.Control) error {
...
@@ -371,9 +371,9 @@ func cloudControllerManager(ctx context.Context, cfg *config.Control) error {
func
checkForCloudControllerPrivileges
(
ctx
context
.
Context
,
runtime
*
config
.
ControlRuntime
,
timeout
time
.
Duration
)
error
{
func
checkForCloudControllerPrivileges
(
ctx
context
.
Context
,
runtime
*
config
.
ControlRuntime
,
timeout
time
.
Duration
)
error
{
return
util
.
WaitForRBACReady
(
ctx
,
runtime
.
KubeConfigAdmin
,
timeout
,
authorizationv1
.
ResourceAttributes
{
return
util
.
WaitForRBACReady
(
ctx
,
runtime
.
KubeConfigAdmin
,
timeout
,
authorizationv1
.
ResourceAttributes
{
Namespace
:
metav1
.
NamespaceSystem
,
Namespace
:
metav1
.
NamespaceSystem
,
Verb
:
"
*
"
,
Verb
:
"
watch
"
,
Resource
:
"
daemonset
s"
,
Resource
:
"
endpointslice
s"
,
Group
:
"
apps
"
,
Group
:
"
discovery.k8s.io
"
,
},
version
.
Program
+
"-cloud-controller-manager"
)
},
version
.
Program
+
"-cloud-controller-manager"
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment