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
ffcc9c0c
Commit
ffcc9c0c
authored
Mar 20, 2019
by
Erik Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Package static assets
Include static Helm assets in the build process needed for air-gap
parent
5716acab
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
3 deletions
+59
-3
main.go
main.go
+1
-0
server.go
pkg/server/server.go
+6
-1
stage.go
pkg/static/stage.go
+27
-0
download
scripts/download
+9
-2
main.go
types/codegen/main.go
+16
-0
No files found.
main.go
View file @
ffcc9c0c
//go:generate go run types/codegen/cleanup/main.go
//go:generate go run types/codegen/main.go
//go:generate go fmt pkg/deploy/zz_generated_bindata.go
//go:generate go fmt pkg/static/zz_generated_bindata.go
//go:generate go fmt pkg/openapi/zz_generated_bindata.go
package
main
...
...
pkg/server/server.go
View file @
ffcc9c0c
...
...
@@ -19,11 +19,12 @@ import (
"github.com/rancher/k3s/pkg/deploy"
"github.com/rancher/k3s/pkg/helm"
"github.com/rancher/k3s/pkg/servicelb"
"github.com/rancher/k3s/pkg/static"
"github.com/rancher/k3s/pkg/tls"
appsv1
"github.com/rancher/k3s/types/apis/apps/v1"
batchv1
"github.com/rancher/k3s/types/apis/batch/v1"
corev1
"github.com/rancher/k3s/types/apis/core/v1"
"github.com/rancher/k3s/types/apis/k3s.cattle.io/v1"
v1
"github.com/rancher/k3s/types/apis/k3s.cattle.io/v1"
rbacv1
"github.com/rancher/k3s/types/apis/rbac.authorization.k8s.io/v1"
"github.com/rancher/norman"
"github.com/rancher/norman/pkg/clientaccess"
...
...
@@ -119,6 +120,10 @@ func startNorman(ctx context.Context, config *Config) (string, error) {
return
servicelb
.
Register
(
ctx
,
norman
.
GetServer
(
ctx
)
.
K8sClient
,
!
config
.
DisableServiceLB
)
},
func
(
ctx
context
.
Context
)
error
{
dataDir
:=
filepath
.
Join
(
controlConfig
.
DataDir
,
"static"
)
return
static
.
Stage
(
dataDir
)
},
func
(
ctx
context
.
Context
)
error
{
dataDir
:=
filepath
.
Join
(
controlConfig
.
DataDir
,
"manifests"
)
templateVars
:=
map
[
string
]
string
{
"%{CLUSTER_DNS}%"
:
controlConfig
.
ClusterDNS
.
String
()}
if
err
:=
deploy
.
Stage
(
dataDir
,
templateVars
);
err
!=
nil
{
...
...
pkg/static/stage.go
0 → 100644
View file @
ffcc9c0c
package
static
import
(
"io/ioutil"
"os"
"path/filepath"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
func
Stage
(
dataDir
string
)
error
{
for
_
,
name
:=
range
AssetNames
()
{
content
,
err
:=
Asset
(
name
)
if
err
!=
nil
{
return
err
}
p
:=
filepath
.
Join
(
dataDir
,
name
)
logrus
.
Info
(
"Writing static file: "
,
p
)
os
.
MkdirAll
(
filepath
.
Dir
(
p
),
0700
)
if
err
:=
ioutil
.
WriteFile
(
p
,
content
,
0600
);
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"failed to write to %s"
,
name
)
}
}
return
nil
}
scripts/download
View file @
ffcc9c0c
#!/bin/bash
ROOT_VERSION
=
v0.0.1
source
$(
dirname
$0
)
/version.sh
cd
$(
dirname
$0
)
/..
ROOT_VERSION
=
v0.0.1
TRAEFIK_VERSION
=
1.64.0
CHARTS_DIR
=
build/static/charts
mkdir
-p
${
CHARTS_DIR
}
curl
--compressed
-sfL
https://github.com/ibuildthecloud/k3s-root/releases/download/
${
ROOT_VERSION
}
/k3s-root-
${
ARCH
}
.tar |
tar
xf -
ln
-sf
pigz bin/unpigz
TRAEFIK_FILE
=
traefik-
${
TRAEFIK_VERSION
}
.tgz
curl
-sfL
https://kubernetes-charts.storage.googleapis.com/
${
TRAEFIK_FILE
}
-o
${
CHARTS_DIR
}
/
${
TRAEFIK_FILE
}
types/codegen/main.go
View file @
ffcc9c0c
...
...
@@ -51,6 +51,22 @@ func main() {
bc
=
&
bindata
.
Config
{
Input
:
[]
bindata
.
InputConfig
{
{
Path
:
"build/static"
,
Recursive
:
true
,
},
},
Package
:
"static"
,
NoMetadata
:
true
,
Prefix
:
"build/static/"
,
Output
:
"pkg/static/zz_generated_bindata.go"
,
}
if
err
:=
bindata
.
Translate
(
bc
);
err
!=
nil
{
logrus
.
Fatal
(
err
)
}
bc
=
&
bindata
.
Config
{
Input
:
[]
bindata
.
InputConfig
{
{
Path
:
"vendor/k8s.io/kubernetes/openapi.json"
,
},
{
...
...
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