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
a8d96112
Commit
a8d96112
authored
Mar 26, 2020
by
Darren Shepherd
Committed by
Erik Wilson
Apr 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates for k8s v1.18 support
parent
53ed13bf
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
11 deletions
+12
-11
containerd.go
pkg/agent/containerd/containerd.go
+1
-1
setup.go
pkg/agent/flannel/setup.go
+1
-1
network_policy_controller.go
pkg/agent/netpol/network_policy_controller.go
+2
-1
run.go
pkg/agent/run.go
+2
-2
tunnel.go
pkg/agent/tunnel/tunnel.go
+2
-2
controller.go
pkg/servicelb/controller.go
+4
-4
No files found.
pkg/agent/containerd/containerd.go
View file @
a8d96112
...
@@ -80,7 +80,7 @@ func Run(ctx context.Context, cfg *config.Node) error {
...
@@ -80,7 +80,7 @@ func Run(ctx context.Context, cfg *config.Node) error {
continue
continue
}
}
conn
,
err
:=
grpc
.
Dial
(
addr
,
grpc
.
WithInsecure
(),
grpc
.
WithTimeout
(
3
*
time
.
Second
),
grpc
.
WithDialer
(
dialer
),
grpc
.
WithDefaultCallOptions
(
grpc
.
MaxCallRecvMsgSize
(
maxMsgSize
)))
conn
,
err
:=
grpc
.
Dial
(
addr
,
grpc
.
WithInsecure
(),
grpc
.
WithTimeout
(
3
*
time
.
Second
),
grpc
.
With
Context
Dialer
(
dialer
),
grpc
.
WithDefaultCallOptions
(
grpc
.
MaxCallRecvMsgSize
(
maxMsgSize
)))
if
err
!=
nil
{
if
err
!=
nil
{
time
.
Sleep
(
1
*
time
.
Second
)
time
.
Sleep
(
1
*
time
.
Second
)
continue
continue
...
...
pkg/agent/flannel/setup.go
View file @
a8d96112
...
@@ -81,7 +81,7 @@ func Run(ctx context.Context, nodeConfig *config.Node, nodes v1.NodeInterface) e
...
@@ -81,7 +81,7 @@ func Run(ctx context.Context, nodeConfig *config.Node, nodes v1.NodeInterface) e
nodeName
:=
nodeConfig
.
AgentConfig
.
NodeName
nodeName
:=
nodeConfig
.
AgentConfig
.
NodeName
for
{
for
{
node
,
err
:=
nodes
.
Get
(
nodeName
,
metav1
.
GetOptions
{})
node
,
err
:=
nodes
.
Get
(
ctx
,
nodeName
,
metav1
.
GetOptions
{})
if
err
==
nil
&&
node
.
Spec
.
PodCIDR
!=
""
{
if
err
==
nil
&&
node
.
Spec
.
PodCIDR
!=
""
{
break
break
}
}
...
...
pkg/agent/netpol/network_policy_controller.go
View file @
a8d96112
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
package
netpol
package
netpol
import
(
import
(
"context"
"crypto/sha256"
"crypto/sha256"
"encoding/base32"
"encoding/base32"
"errors"
"errors"
...
@@ -1700,7 +1701,7 @@ func NewNetworkPolicyController(
...
@@ -1700,7 +1701,7 @@ func NewNetworkPolicyController(
npc
.
v1NetworkPolicy
=
false
npc
.
v1NetworkPolicy
=
false
}
}
node
,
err
:=
clientset
.
CoreV1
()
.
Nodes
()
.
Get
(
hostnameOverride
,
metav1
.
GetOptions
{})
node
,
err
:=
clientset
.
CoreV1
()
.
Nodes
()
.
Get
(
context
.
TODO
(),
hostnameOverride
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
pkg/agent/run.go
View file @
a8d96112
...
@@ -158,7 +158,7 @@ func validate() error {
...
@@ -158,7 +158,7 @@ func validate() error {
func
configureNode
(
ctx
context
.
Context
,
agentConfig
*
daemonconfig
.
Agent
,
nodes
v1
.
NodeInterface
)
error
{
func
configureNode
(
ctx
context
.
Context
,
agentConfig
*
daemonconfig
.
Agent
,
nodes
v1
.
NodeInterface
)
error
{
for
{
for
{
node
,
err
:=
nodes
.
Get
(
agentConfig
.
NodeName
,
metav1
.
GetOptions
{})
node
,
err
:=
nodes
.
Get
(
ctx
,
agentConfig
.
NodeName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
logrus
.
Infof
(
"Waiting for kubelet to be ready on node %s: %v"
,
agentConfig
.
NodeName
,
err
)
logrus
.
Infof
(
"Waiting for kubelet to be ready on node %s: %v"
,
agentConfig
.
NodeName
,
err
)
time
.
Sleep
(
1
*
time
.
Second
)
time
.
Sleep
(
1
*
time
.
Second
)
...
@@ -182,7 +182,7 @@ func configureNode(ctx context.Context, agentConfig *daemonconfig.Agent, nodes v
...
@@ -182,7 +182,7 @@ func configureNode(ctx context.Context, agentConfig *daemonconfig.Agent, nodes v
updateNode
=
true
updateNode
=
true
}
}
if
updateNode
{
if
updateNode
{
if
_
,
err
:=
nodes
.
Update
(
node
);
err
!=
nil
{
if
_
,
err
:=
nodes
.
Update
(
ctx
,
node
,
metav1
.
UpdateOptions
{}
);
err
!=
nil
{
logrus
.
Infof
(
"Failed to update node %s: %v"
,
agentConfig
.
NodeName
,
err
)
logrus
.
Infof
(
"Failed to update node %s: %v"
,
agentConfig
.
NodeName
,
err
)
select
{
select
{
case
<-
ctx
.
Done
()
:
case
<-
ctx
.
Done
()
:
...
...
pkg/agent/tunnel/tunnel.go
View file @
a8d96112
...
@@ -73,7 +73,7 @@ func Setup(ctx context.Context, config *config.Node, onChange func([]string)) er
...
@@ -73,7 +73,7 @@ func Setup(ctx context.Context, config *config.Node, onChange func([]string)) er
addresses
:=
[]
string
{
config
.
ServerAddress
}
addresses
:=
[]
string
{
config
.
ServerAddress
}
endpoint
,
_
:=
client
.
CoreV1
()
.
Endpoints
(
"default"
)
.
Get
(
"kubernetes"
,
metav1
.
GetOptions
{})
endpoint
,
_
:=
client
.
CoreV1
()
.
Endpoints
(
"default"
)
.
Get
(
ctx
,
"kubernetes"
,
metav1
.
GetOptions
{})
if
endpoint
!=
nil
{
if
endpoint
!=
nil
{
addresses
=
getAddresses
(
endpoint
)
addresses
=
getAddresses
(
endpoint
)
if
onChange
!=
nil
{
if
onChange
!=
nil
{
...
@@ -94,7 +94,7 @@ func Setup(ctx context.Context, config *config.Node, onChange func([]string)) er
...
@@ -94,7 +94,7 @@ func Setup(ctx context.Context, config *config.Node, onChange func([]string)) er
connect
:
connect
:
for
{
for
{
time
.
Sleep
(
5
*
time
.
Second
)
time
.
Sleep
(
5
*
time
.
Second
)
watch
,
err
:=
client
.
CoreV1
()
.
Endpoints
(
"default"
)
.
Watch
(
metav1
.
ListOptions
{
watch
,
err
:=
client
.
CoreV1
()
.
Endpoints
(
"default"
)
.
Watch
(
ctx
,
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Set
{
"metadata.name"
:
"kubernetes"
}
.
String
(),
FieldSelector
:
fields
.
Set
{
"metadata.name"
:
"kubernetes"
}
.
String
(),
ResourceVersion
:
"0"
,
ResourceVersion
:
"0"
,
})
})
...
...
pkg/servicelb/controller.go
View file @
a8d96112
...
@@ -187,7 +187,7 @@ func (h *handler) updateService(svc *core.Service) (runtime.Object, error) {
...
@@ -187,7 +187,7 @@ func (h *handler) updateService(svc *core.Service) (runtime.Object, error) {
}
}
logrus
.
Debugf
(
"Setting service loadbalancer %s/%s to IPs %v"
,
svc
.
Namespace
,
svc
.
Name
,
expectedIPs
)
logrus
.
Debugf
(
"Setting service loadbalancer %s/%s to IPs %v"
,
svc
.
Namespace
,
svc
.
Name
,
expectedIPs
)
return
h
.
services
.
Services
(
svc
.
Namespace
)
.
UpdateStatus
(
svc
)
return
h
.
services
.
Services
(
svc
.
Namespace
)
.
UpdateStatus
(
context
.
TODO
(),
svc
,
meta
.
UpdateOptions
{}
)
}
}
func
serviceIPs
(
svc
*
core
.
Service
)
[]
string
{
func
serviceIPs
(
svc
*
core
.
Service
)
[]
string
{
...
@@ -391,7 +391,7 @@ func (h *handler) newDaemonSet(svc *core.Service) (*apps.DaemonSet, error) {
...
@@ -391,7 +391,7 @@ func (h *handler) newDaemonSet(svc *core.Service) (*apps.DaemonSet, error) {
}
}
func
(
h
*
handler
)
updateDaemonSets
()
error
{
func
(
h
*
handler
)
updateDaemonSets
()
error
{
daemonsets
,
err
:=
h
.
daemonsets
.
DaemonSets
(
""
)
.
List
(
meta
.
ListOptions
{
daemonsets
,
err
:=
h
.
daemonsets
.
DaemonSets
(
""
)
.
List
(
context
.
TODO
(),
meta
.
ListOptions
{
LabelSelector
:
nodeSelectorLabel
+
"=false"
,
LabelSelector
:
nodeSelectorLabel
+
"=false"
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -403,7 +403,7 @@ func (h *handler) updateDaemonSets() error {
...
@@ -403,7 +403,7 @@ func (h *handler) updateDaemonSets() error {
daemonsetNodeLabel
:
"true"
,
daemonsetNodeLabel
:
"true"
,
}
}
ds
.
Labels
[
nodeSelectorLabel
]
=
"true"
ds
.
Labels
[
nodeSelectorLabel
]
=
"true"
if
_
,
err
:=
h
.
daemonsets
.
DaemonSets
(
ds
.
Namespace
)
.
Update
(
&
ds
);
err
!=
nil
{
if
_
,
err
:=
h
.
daemonsets
.
DaemonSets
(
ds
.
Namespace
)
.
Update
(
context
.
TODO
(),
&
ds
,
meta
.
UpdateOptions
{}
);
err
!=
nil
{
return
err
return
err
}
}
...
@@ -420,5 +420,5 @@ func (h *handler) deleteOldDeployments(svc *core.Service) error {
...
@@ -420,5 +420,5 @@ func (h *handler) deleteOldDeployments(svc *core.Service) error {
}
}
return
err
return
err
}
}
return
h
.
deployments
.
Deployments
(
svc
.
Namespace
)
.
Delete
(
name
,
&
meta
.
DeleteOptions
{})
return
h
.
deployments
.
Deployments
(
svc
.
Namespace
)
.
Delete
(
context
.
TODO
(),
name
,
meta
.
DeleteOptions
{})
}
}
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