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
853708c8
Unverified
Commit
853708c8
authored
Jun 30, 2019
by
Erik Wilson
Committed by
GitHub
Jun 30, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #591 from erikwilson/add-ctr
Build & enable ctr with k3s server
parents
4d59fc4a
ed72856d
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 @
853708c8
/*
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
import
(
"fmt"
"os"
"github.com/containerd/containerd/cmd/ctr/app"
"github.com/containerd/containerd/pkg/seed"
"github.com/urfave/cli"
)
func
init
()
{
seed
.
WithTimeAndRand
()
}
import
"github.com/rancher/k3s/pkg/ctr"
func
main
()
{
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
)
}
ctr
.
Main
()
}
cmd/k3s/main.go
View file @
853708c8
...
...
@@ -27,8 +27,8 @@ func main() {
cmds
.
NewServerCommand
(
wrap
(
"k3s-server"
,
os
.
Args
)),
cmds
.
NewAgentCommand
(
wrap
(
"k3s-agent"
,
os
.
Args
)),
cmds
.
NewKubectlCommand
(
externalCLIAction
(
"kubectl"
)),
//cmds.NewCtrCommand(externalCLIAction("ctr")),
cmds
.
NewCRICTL
(
externalCLIAction
(
"crictl"
)),
cmds
.
NewCtrCommand
(
externalCLIAction
(
"ctr"
)),
}
err
:=
app
.
Run
(
os
.
Args
)
...
...
cmd/server/main.go
View file @
853708c8
...
...
@@ -9,9 +9,11 @@ import (
"github.com/rancher/k3s/pkg/cli/agent"
"github.com/rancher/k3s/pkg/cli/cmds"
"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/server"
"github.com/rancher/k3s/pkg/containerd"
ctr2
"github.com/rancher/k3s/pkg/ctr"
kubectl2
"github.com/rancher/k3s/pkg/kubectl"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
...
...
@@ -21,6 +23,7 @@ func init() {
reexec
.
Register
(
"containerd"
,
containerd
.
Main
)
reexec
.
Register
(
"kubectl"
,
kubectl2
.
Main
)
reexec
.
Register
(
"crictl"
,
crictl2
.
Main
)
reexec
.
Register
(
"ctr"
,
ctr2
.
Main
)
}
func
main
()
{
...
...
@@ -37,6 +40,7 @@ func main() {
cmds
.
NewAgentCommand
(
agent
.
Run
),
cmds
.
NewKubectlCommand
(
kubectl
.
Run
),
cmds
.
NewCRICTL
(
crictl
.
Run
),
cmds
.
NewCtrCommand
(
ctr
.
Run
),
}
err
:=
app
.
Run
(
os
.
Args
)
...
...
pkg/cli/ctr/ctr.go
0 → 100644
View file @
853708c8
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 @
853708c8
/*
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 @
853708c8
...
...
@@ -23,7 +23,7 @@ if [ -z "$GOARM" ] && [ "arm" = "$(go env GOARCH)" ]; then
GOARM
=
7
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
# CGO_ENABLED=1 go build -tags "$TAGS" -ldflags "$LDFLAGS $STATIC" -o bin/k3s-agent ./cmd/agent/main.go
echo
Building server
...
...
@@ -32,6 +32,7 @@ ln -s containerd ./bin/k3s-agent
ln
-s
containerd ./bin/k3s-server
ln
-s
containerd ./bin/kubectl
ln
-s
containerd ./bin/crictl
ln
-s
containerd ./bin/ctr
echo
Building hyperkube
CGO_ENABLED
=
1 go build
-tags
"
$TAGS
"
-ldflags
"
$LDFLAGS
$STATIC_SQLITE
"
-o
bin/hyperkube ./vendor/k8s.io/kubernetes/cmd/hyperkube/
#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