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
ed72856d
Commit
ed72856d
authored
Jun 30, 2019
by
Erik Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build & enable ctr with k3s server
parent
9ccf3cbc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
47 deletions
+71
-47
main.go
cmd/ctr/main.go
+2
-45
main.go
cmd/k3s/main.go
+1
-1
main.go
cmd/server/main.go
+4
-0
ctr.go
pkg/cli/ctr/ctr.go
+11
-0
main.go
pkg/ctr/main.go
+51
-0
build
scripts/build
+2
-1
No files found.
cmd/ctr/main.go
View file @
ed72856d
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
main
package
main
import
(
import
"github.com/rancher/k3s/pkg/ctr"
"fmt"
"os"
"github.com/containerd/containerd/cmd/ctr/app"
"github.com/containerd/containerd/pkg/seed"
"github.com/urfave/cli"
)
func
init
()
{
seed
.
WithTimeAndRand
()
}
func
main
()
{
func
main
()
{
app
:=
app
.
New
()
ctr
.
Main
()
for
i
,
flag
:=
range
app
.
Flags
{
if
sFlag
,
ok
:=
flag
.
(
cli
.
StringFlag
);
ok
{
if
sFlag
.
Name
==
"address, a"
{
sFlag
.
Value
=
"/run/k3s/containerd/containerd.sock"
app
.
Flags
[
i
]
=
sFlag
}
else
if
sFlag
.
Name
==
"namespace, n"
{
sFlag
.
Value
=
"k8s.io"
app
.
Flags
[
i
]
=
sFlag
}
}
}
if
err
:=
app
.
Run
(
os
.
Args
);
err
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"ctr: %s
\n
"
,
err
)
os
.
Exit
(
1
)
}
}
}
cmd/k3s/main.go
View file @
ed72856d
...
@@ -27,8 +27,8 @@ func main() {
...
@@ -27,8 +27,8 @@ func main() {
cmds
.
NewServerCommand
(
wrap
(
"k3s-server"
,
os
.
Args
)),
cmds
.
NewServerCommand
(
wrap
(
"k3s-server"
,
os
.
Args
)),
cmds
.
NewAgentCommand
(
wrap
(
"k3s-agent"
,
os
.
Args
)),
cmds
.
NewAgentCommand
(
wrap
(
"k3s-agent"
,
os
.
Args
)),
cmds
.
NewKubectlCommand
(
externalCLIAction
(
"kubectl"
)),
cmds
.
NewKubectlCommand
(
externalCLIAction
(
"kubectl"
)),
//cmds.NewCtrCommand(externalCLIAction("ctr")),
cmds
.
NewCRICTL
(
externalCLIAction
(
"crictl"
)),
cmds
.
NewCRICTL
(
externalCLIAction
(
"crictl"
)),
cmds
.
NewCtrCommand
(
externalCLIAction
(
"ctr"
)),
}
}
err
:=
app
.
Run
(
os
.
Args
)
err
:=
app
.
Run
(
os
.
Args
)
...
...
cmd/server/main.go
View file @
ed72856d
...
@@ -9,9 +9,11 @@ import (
...
@@ -9,9 +9,11 @@ import (
"github.com/rancher/k3s/pkg/cli/agent"
"github.com/rancher/k3s/pkg/cli/agent"
"github.com/rancher/k3s/pkg/cli/cmds"
"github.com/rancher/k3s/pkg/cli/cmds"
"github.com/rancher/k3s/pkg/cli/crictl"
"github.com/rancher/k3s/pkg/cli/crictl"
"github.com/rancher/k3s/pkg/cli/ctr"
"github.com/rancher/k3s/pkg/cli/kubectl"
"github.com/rancher/k3s/pkg/cli/kubectl"
"github.com/rancher/k3s/pkg/cli/server"
"github.com/rancher/k3s/pkg/cli/server"
"github.com/rancher/k3s/pkg/containerd"
"github.com/rancher/k3s/pkg/containerd"
ctr2
"github.com/rancher/k3s/pkg/ctr"
kubectl2
"github.com/rancher/k3s/pkg/kubectl"
kubectl2
"github.com/rancher/k3s/pkg/kubectl"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/urfave/cli"
...
@@ -21,6 +23,7 @@ func init() {
...
@@ -21,6 +23,7 @@ func init() {
reexec
.
Register
(
"containerd"
,
containerd
.
Main
)
reexec
.
Register
(
"containerd"
,
containerd
.
Main
)
reexec
.
Register
(
"kubectl"
,
kubectl2
.
Main
)
reexec
.
Register
(
"kubectl"
,
kubectl2
.
Main
)
reexec
.
Register
(
"crictl"
,
crictl2
.
Main
)
reexec
.
Register
(
"crictl"
,
crictl2
.
Main
)
reexec
.
Register
(
"ctr"
,
ctr2
.
Main
)
}
}
func
main
()
{
func
main
()
{
...
@@ -37,6 +40,7 @@ func main() {
...
@@ -37,6 +40,7 @@ func main() {
cmds
.
NewAgentCommand
(
agent
.
Run
),
cmds
.
NewAgentCommand
(
agent
.
Run
),
cmds
.
NewKubectlCommand
(
kubectl
.
Run
),
cmds
.
NewKubectlCommand
(
kubectl
.
Run
),
cmds
.
NewCRICTL
(
crictl
.
Run
),
cmds
.
NewCRICTL
(
crictl
.
Run
),
cmds
.
NewCtrCommand
(
ctr
.
Run
),
}
}
err
:=
app
.
Run
(
os
.
Args
)
err
:=
app
.
Run
(
os
.
Args
)
...
...
pkg/cli/ctr/ctr.go
0 → 100644
View file @
ed72856d
package
ctr
import
(
"github.com/rancher/k3s/pkg/ctr"
"github.com/urfave/cli"
)
func
Run
(
ctx
*
cli
.
Context
)
error
{
ctr
.
Main
()
return
nil
}
pkg/ctr/main.go
0 → 100644
View file @
ed72856d
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
ctr
import
(
"fmt"
"os"
"github.com/containerd/containerd/cmd/ctr/app"
"github.com/containerd/containerd/pkg/seed"
"github.com/urfave/cli"
)
func
Main
()
{
main
()
}
func
main
()
{
seed
.
WithTimeAndRand
()
app
:=
app
.
New
()
for
i
,
flag
:=
range
app
.
Flags
{
if
sFlag
,
ok
:=
flag
.
(
cli
.
StringFlag
);
ok
{
if
sFlag
.
Name
==
"address, a"
{
sFlag
.
Value
=
"/run/k3s/containerd/containerd.sock"
app
.
Flags
[
i
]
=
sFlag
}
else
if
sFlag
.
Name
==
"namespace, n"
{
sFlag
.
Value
=
"k8s.io"
app
.
Flags
[
i
]
=
sFlag
}
}
}
if
err
:=
app
.
Run
(
os
.
Args
);
err
!=
nil
{
fmt
.
Fprintf
(
os
.
Stderr
,
"ctr: %s
\n
"
,
err
)
os
.
Exit
(
1
)
}
}
scripts/build
View file @
ed72856d
...
@@ -23,7 +23,7 @@ if [ -z "$GOARM" ] && [ "arm" = "$(go env GOARCH)" ]; then
...
@@ -23,7 +23,7 @@ if [ -z "$GOARM" ] && [ "arm" = "$(go env GOARCH)" ]; then
GOARM
=
7
GOARM
=
7
fi
fi
rm
-f
bin/k3s-agent bin/hyperkube bin/containerd bin/cni ./bin/runc bin/containerd-shim bin/k3s-server bin/kubectl bin/crictl
rm
-f
bin/k3s-agent bin/hyperkube bin/containerd bin/cni ./bin/runc bin/containerd-shim bin/k3s-server bin/kubectl bin/crictl
bin/ctr
# echo Building agent
# echo Building agent
# CGO_ENABLED=1 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o bin/k3s-agent ./cmd/agent/main.go
# CGO_ENABLED=1 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o bin/k3s-agent ./cmd/agent/main.go
echo
Building server
echo
Building server
...
@@ -32,6 +32,7 @@ ln -s containerd ./bin/k3s-agent
...
@@ -32,6 +32,7 @@ ln -s containerd ./bin/k3s-agent
ln
-s
containerd ./bin/k3s-server
ln
-s
containerd ./bin/k3s-server
ln
-s
containerd ./bin/kubectl
ln
-s
containerd ./bin/kubectl
ln
-s
containerd ./bin/crictl
ln
-s
containerd ./bin/crictl
ln
-s
containerd ./bin/ctr
echo
Building hyperkube
echo
Building hyperkube
CGO_ENABLED
=
1 go build
-tags
"
$TAGS
"
-ldflags
"
$LDFLAGS
$STATIC_SQLITE
"
-o
bin/hyperkube ./vendor/k8s.io/kubernetes/cmd/hyperkube/
CGO_ENABLED
=
1 go build
-tags
"
$TAGS
"
-ldflags
"
$LDFLAGS
$STATIC_SQLITE
"
-o
bin/hyperkube ./vendor/k8s.io/kubernetes/cmd/hyperkube/
#echo Building ctr
#echo Building ctr
...
...
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