mirror of
https://github.com/cnrancher/kube-explorer.git
synced 2025-09-02 15:05:14 +00:00
Compare commits
72 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cd955243b6 | ||
|
2b39db9f07 | ||
|
4dc1acb1f2 | ||
|
989d087b99 | ||
|
c214e6ba6a | ||
|
390b11caef | ||
|
e016261c4b | ||
|
c43288964a | ||
|
70e586976d | ||
|
d0ce0e28bf | ||
|
ad0a0c0cb3 | ||
|
651d499086 | ||
|
8e592b1a3c | ||
|
c1f5fda228 | ||
|
10e5323c95 | ||
|
ea49f9d3b4 | ||
|
b0b81ba87d | ||
|
e757347def | ||
|
f4970b85a2 | ||
|
bfae192748 | ||
|
3810cd702f | ||
|
f898c559e0 | ||
|
f0effa7f09 | ||
|
2838ceb34a | ||
|
40a972eeef | ||
|
88c924a816 | ||
|
d24282849f | ||
|
92aaca7407 | ||
|
c278dbb810 | ||
|
5c2ecdfb97 | ||
|
ecf6faba80 | ||
|
a89b9b46bf | ||
|
30c0ceef73 | ||
|
f6536c289e | ||
|
5347d02990 | ||
|
663e8d7682 | ||
|
dd8291f9e3 | ||
|
55e5418bd0 | ||
|
7c3f7b5401 | ||
|
98ae5fe7c9 | ||
|
f91c8df6e2 | ||
|
6344c0767a | ||
|
bbb5db5fb5 | ||
|
a81fc996c9 | ||
|
a0c6f0edb7 | ||
|
e986d891ef | ||
|
0857f01c77 | ||
|
ec1152aba1 | ||
|
5846ee6155 | ||
|
3e9b2fe7f5 | ||
|
c4e05aa13d | ||
|
ae72fa4141 | ||
|
3cfd0e2a32 | ||
|
179d7aa95e | ||
|
c29a7505b2 | ||
|
71ace76cf7 | ||
|
57d6d420b8 | ||
|
b46ddc4c8e | ||
|
b5200596f9 | ||
|
a90dd6cafc | ||
|
b227ab5257 | ||
|
db3c9e207d | ||
|
ac0ab3d84c | ||
|
41cfdac948 | ||
|
4549f4bf30 | ||
|
32a422d532 | ||
|
db9fafa217 | ||
|
e977f787be | ||
|
801ddc8307 | ||
|
9ce49f47d4 | ||
|
e979672125 | ||
|
a0a6974500 |
165
.drone.yml
Normal file
165
.drone.yml
Normal file
@@ -0,0 +1,165 @@
|
||||
type: docker
|
||||
kind: pipeline
|
||||
name: push
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
trigger:
|
||||
event:
|
||||
exclude:
|
||||
- promote
|
||||
include:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
volumes:
|
||||
- name: docker
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
||||
node:
|
||||
instance: agent-amd64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: rancher/dapper:v0.6.0
|
||||
commands:
|
||||
- dapper ci
|
||||
environment:
|
||||
CROSS: "${DRONE_BUILD_EVENT}"
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: docker
|
||||
path: /var/run/docker.sock
|
||||
|
||||
- name: image-scan-head
|
||||
image: aquasec/trivy
|
||||
commands:
|
||||
- trivy image --no-progress --ignore-unfixed --severity HIGH,CRITICAL --scanners vuln --exit-code 1 cnrancher/kube-explorer:${DRONE_COMMIT:0:7}
|
||||
volumes:
|
||||
- name: docker
|
||||
path: /var/run/docker.sock
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
ref:
|
||||
include:
|
||||
- "refs/heads/main"
|
||||
- "refs/heads/v*"
|
||||
|
||||
- name: install-buildx-support
|
||||
image: tonistiigi/binfmt
|
||||
privileged: true
|
||||
entrypoint:
|
||||
- /usr/bin/binfmt
|
||||
command:
|
||||
- --install
|
||||
- all
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
ref:
|
||||
include:
|
||||
- "refs/heads/main"
|
||||
- "refs/heads/v*"
|
||||
|
||||
- name: docker-publish
|
||||
image: thegeeklab/drone-docker-buildx
|
||||
privileged: true
|
||||
settings:
|
||||
platforms: linux/amd64,linux/arm64/v8
|
||||
dockerfile: package/Dockerfile
|
||||
repo: cnrancher/kube-explorer
|
||||
tag: latest
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
volumes:
|
||||
- name: docker
|
||||
path: /var/run/docker.sock
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
ref:
|
||||
include:
|
||||
- "refs/heads/main"
|
||||
- "refs/heads/v*"
|
||||
|
||||
---
|
||||
type: docker
|
||||
kind: pipeline
|
||||
name: tag
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
trigger:
|
||||
event:
|
||||
exclude:
|
||||
- promote
|
||||
include:
|
||||
- tag
|
||||
ref:
|
||||
include:
|
||||
- "refs/tags/*"
|
||||
|
||||
volumes:
|
||||
- name: docker
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
||||
node:
|
||||
instance: agent-amd64
|
||||
|
||||
steps:
|
||||
- name: release
|
||||
image: rancher/dapper:v0.6.0
|
||||
commands:
|
||||
- dapper ci
|
||||
privileged: true
|
||||
environment:
|
||||
CROSS: "${DRONE_BUILD_EVENT}"
|
||||
volumes:
|
||||
- name: docker
|
||||
path: /var/run/docker.sock
|
||||
|
||||
- name: install-buildx-support
|
||||
image: tonistiigi/binfmt
|
||||
privileged: true
|
||||
entrypoint:
|
||||
- /usr/bin/binfmt
|
||||
command:
|
||||
- --install
|
||||
- all
|
||||
|
||||
- name: docker-publish
|
||||
image: thegeeklab/drone-docker-buildx
|
||||
privileged: true
|
||||
settings:
|
||||
platforms: linux/amd64,linux/arm64/v8
|
||||
dockerfile: package/Dockerfile
|
||||
repo: cnrancher/kube-explorer
|
||||
tag: ${DRONE_TAG}
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
volumes:
|
||||
- name: docker
|
||||
path: /var/run/docker.sock
|
||||
|
||||
- name: github_binary_release
|
||||
image: plugins/github-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: github_token
|
||||
checksum:
|
||||
- sha256
|
||||
files:
|
||||
- "bin/*"
|
||||
title: "${DRONE_TAG}"
|
||||
overwrite: true
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -19,3 +19,5 @@
|
||||
/dist
|
||||
/build
|
||||
*.swp
|
||||
|
||||
/.vscode
|
||||
|
@@ -1,30 +1,28 @@
|
||||
FROM golang:1.16
|
||||
|
||||
FROM registry.suse.com/bci/golang:1.21
|
||||
ARG PROXY
|
||||
ARG GOPROXY
|
||||
ARG DAPPER_HOST_ARCH
|
||||
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}
|
||||
ENV https_proxy=${PROXY} \
|
||||
http_proxy=${PROXY}
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y ca-certificates git wget curl xz-utils && \
|
||||
rm -f /bin/sh && ln -s /bin/bash /bin/sh && \
|
||||
curl -sL https://github.com/upx/upx/releases/download/v3.96/upx-3.96-${ARCH}_linux.tar.xz | tar xvJf - --strip-components=1 -C /tmp && \
|
||||
RUN zypper -n install ca-certificates git-core wget curl unzip tar vim less file xz
|
||||
RUN zypper install -y -f docker
|
||||
|
||||
ENV UPX_VERSION 4.2.1
|
||||
RUN curl -sL https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-${ARCH}_linux.tar.xz | tar xvJf - --strip-components=1 -C /tmp && \
|
||||
mv /tmp/upx /usr/bin/
|
||||
|
||||
RUN if [ "${ARCH}" == "amd64" ]; then \
|
||||
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.27.0; \
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.54.2; \
|
||||
fi
|
||||
|
||||
ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \
|
||||
DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm \
|
||||
DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm64 \
|
||||
DOCKER_URL=DOCKER_URL_${ARCH}
|
||||
RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker
|
||||
ENV GIT_COMMIT="dafd3fc3b06454bb1b6a2cea68c561bb57482deb" \
|
||||
GIT_BRANCH="ke/v0.4" \
|
||||
GIT_SOURCE=${GOPATH}/src/github.com/rancher/steve \
|
||||
CATTLE_DASHBOARD_UI_VERSION="v2.8.0-kube-explorer-ui-rc3"
|
||||
|
||||
ENV GIT_COMMIT="327be56d3a6a2b85cf4751148f6834402e8211d5" \
|
||||
GIT_BRANCH="kube-explorer" \
|
||||
GIT_SOURCE="/go/src/github.com/rancher/steve" \
|
||||
CATTLE_DASHBOARD_UI_VERSION=v2.5.8-rc3
|
||||
|
||||
ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS
|
||||
ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS GOPROXY
|
||||
ENV DAPPER_SOURCE /opt/kube-explorer
|
||||
ENV DAPPER_OUTPUT ./bin ./dist
|
||||
ENV DAPPER_DOCKER_SOCKET true
|
||||
|
42
README.md
42
README.md
@@ -1 +1,41 @@
|
||||
# kube-explorer
|
||||
# kube-explorer
|
||||
|
||||
kube-explorer is a portable explorer for Kubernetes without any dependency.
|
||||
|
||||
It integrates the Rancher steve framework and its dashboard, and is recompiled, packaged, compressed, and provides an almost completely stateless Kubernetes resource manager.
|
||||
|
||||
## Usage ✅
|
||||
|
||||
Please download the binary from the [release page](https://github.com/cnrancher/kube-explorer/releases).
|
||||
|
||||
To run an HTTP only server:
|
||||
|
||||
```
|
||||
./kube-explorer --kubeconfig=xxxx --http-listen-port=9898 --https-listen-port=0
|
||||
```
|
||||
|
||||
Then, open the browser to visit http://x.x.x.x:9898 .
|
||||
|
||||

|
||||
|
||||
## Build ✅
|
||||
|
||||
To debug on an AMD64 Linux host:
|
||||
|
||||
```
|
||||
make dev
|
||||
|
||||
# $basedir=/opt/ui/dist/
|
||||
# prepare the file trees like this
|
||||
# $basedir/dashboard/
|
||||
# $basedir/index.html
|
||||
|
||||
# good to go!
|
||||
./kube-explorer --debug --ui-path /opt/ui/dist/ --http-listen-port=9898 --https-listen-port=0
|
||||
```
|
||||
|
||||
To build all cross-platform binaries:
|
||||
|
||||
```
|
||||
CROSS=1 make
|
||||
```
|
||||
|
12
deploy/kubectl/README.md
Normal file
12
deploy/kubectl/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
## Access Control Via Basic Auth
|
||||
|
||||
Deploy the kube-explorer workload:
|
||||
|
||||
```
|
||||
kubectl create -f .
|
||||
```
|
||||
|
||||
Configure for different IngressClass:
|
||||
|
||||
- [Nginx Ingress](./nginx-auth)
|
||||
- [Traefik Ingress](./traefik-v2-auth)
|
@@ -18,7 +18,7 @@ spec:
|
||||
spec:
|
||||
serviceAccountName: kube-explorer
|
||||
containers:
|
||||
- image: niusmallnan/kube-explorer
|
||||
- image: cnrancher/kube-explorer
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: kube-explorer
|
||||
ports:
|
||||
|
@@ -1,4 +1,4 @@
|
||||
## Traefik Auth
|
||||
## Ingress-Nginx Basic Auth
|
||||
|
||||
This can be used in the cluster which uses the nginx-ingress.
|
||||
|
||||
@@ -13,9 +13,9 @@ htpasswd -nb username password | base64
|
||||
To install this mode, just run this script:
|
||||
|
||||
```
|
||||
kubectl apply -f ./secret.yaml
|
||||
export MY_XIP_IO=$(curl -sL ipinfo.io/ip)
|
||||
envsubst < ./ingress.yaml.tpl | kubectl apply -f -
|
||||
kubectl create -f ./secret.yaml
|
||||
export MY_IP=$(curl -sL ipinfo.io/ip)
|
||||
envsubst < ./ingress.yaml.tpl | kubectl create -f -
|
||||
```
|
||||
|
||||
For more infos: https://kubernetes.github.io/ingress-nginx/examples/auth/basic/
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# Note: please replace the host first
|
||||
# To use xip.io: http://xip.io/
|
||||
# To use sslip.io: https://sslip.io/
|
||||
# To get your public IP: curl ipinfo.io/ip
|
||||
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: kube-explorer
|
||||
@@ -10,16 +10,18 @@ metadata:
|
||||
labels:
|
||||
app: kube-explorer
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: "nginx"
|
||||
nginx.ingress.kubernetes.io/auth-type: basic
|
||||
nginx.ingress.kubernetes.io/auth-secret: kube-explorer
|
||||
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - kube-explorer'
|
||||
spec:
|
||||
rules:
|
||||
- host: "${MY_XIP_IO}.xip.io"
|
||||
- host: "${MY_IP}.sslip.io"
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
serviceName: kube-explorer
|
||||
servicePort: 8989
|
||||
service:
|
||||
name: kube-explorer
|
||||
port:
|
||||
number: 8989
|
||||
|
@@ -13,9 +13,9 @@ htpasswd -nb username password | base64
|
||||
To install this mode, just run this script:
|
||||
|
||||
```
|
||||
kubectl apply -f ./secret.yaml
|
||||
export MY_XIP_IO=$(curl -sL ipinfo.io/ip)
|
||||
envsubst < ./ingress.yaml.tpl | kubectl apply -f -
|
||||
kubectl create -f ./secret.yaml
|
||||
export MY_IP=$(curl -sL ipinfo.io/ip)
|
||||
envsubst < ./ingress.yaml.tpl | kubectl create -f -
|
||||
```
|
||||
|
||||
For more infos: https://doc.traefik.io/traefik/v1.7/configuration/backends/kubernetes/
|
@@ -1,5 +1,5 @@
|
||||
# Note: please replace the host first
|
||||
# To use xip.io: http://xip.io/
|
||||
# To use sslip.io: https://sslip.io/
|
||||
# To get your public IP: curl ipinfo.io/ip
|
||||
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
@@ -16,7 +16,7 @@ metadata:
|
||||
ingress.kubernetes.io/auth-remove-header: "true"
|
||||
spec:
|
||||
rules:
|
||||
- host: "${MY_XIP_IO}.xip.io"
|
||||
- host: "${MY_IP}.sslip.io"
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
21
deploy/kubectl/traefik-v2-auth/README.md
Normal file
21
deploy/kubectl/traefik-v2-auth/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
## Traefik Auth
|
||||
|
||||
This can be used in K3s, as K3s use traefik as the default ingress class.
|
||||
|
||||
We use `basic-auth` to control the access of kube-explorer. The auth token is stored in the secret.
|
||||
|
||||
The default user is `niusmallnan`, and password is `dagedddd`. You can replace to another value with `htpasswd` tool.
|
||||
|
||||
```
|
||||
htpasswd -nb username password | base64
|
||||
```
|
||||
|
||||
To install this mode, just run this script:
|
||||
|
||||
```
|
||||
kubectl create -f ./middleware.yaml
|
||||
export MY_IP=$(curl -sL ipinfo.io/ip)
|
||||
envsubst < ./ingress.yaml.tpl | kubectl create -f -
|
||||
```
|
||||
|
||||
For more infos: https://doc.traefik.io/traefik/middlewares/http/basicauth/
|
25
deploy/kubectl/traefik-v2-auth/ingress.yaml.tpl
Normal file
25
deploy/kubectl/traefik-v2-auth/ingress.yaml.tpl
Normal file
@@ -0,0 +1,25 @@
|
||||
# Note: please replace the host first
|
||||
# To use sslip.io.io: https://sslip.io.io/
|
||||
# To get your public IP: curl ipinfo.io/ip
|
||||
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: kube-explorer
|
||||
namespace: kube-system
|
||||
labels:
|
||||
app: kube-explorer
|
||||
annotations:
|
||||
traefik.ingress.kubernetes.io/router.middlewares: kube-system-kube-explorer@kubernetescrd
|
||||
spec:
|
||||
rules:
|
||||
- host: "${MY_IP}.sslip.io"
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: kube-explorer
|
||||
port:
|
||||
number: 8989
|
28
deploy/kubectl/traefik-v2-auth/middleware.yaml
Normal file
28
deploy/kubectl/traefik-v2-auth/middleware.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
# The definitions below require the definitions for the Middleware and IngressRoute kinds.
|
||||
# https://doc.traefik.io/traefik/reference/dynamic-configuration/kubernetes-crd/#definitions
|
||||
apiVersion: traefik.containo.us/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: kube-explorer
|
||||
namespace: kube-system
|
||||
labels:
|
||||
app: kube-explorer
|
||||
spec:
|
||||
basicAuth:
|
||||
secret: kube-explorer
|
||||
removeHeader: true
|
||||
|
||||
---
|
||||
# To create an encoded user:password pair, the following command can be used:
|
||||
# htpasswd -nb user password | base64
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: kube-explorer
|
||||
namespace: kube-system
|
||||
labels:
|
||||
app: kube-explorer
|
||||
data:
|
||||
auth: bml1c21hbGxuYW46JGFwcjEkbDdUZjJOdWskbmNXajYubHYvMGNkcXM0NFoyelVQLgoK
|
||||
type: Opaque
|
BIN
docs/assets/kube-explorer-record.gif
Normal file
BIN
docs/assets/kube-explorer-record.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1006 KiB |
@@ -1,6 +1,7 @@
|
||||
FROM alpine:3.13
|
||||
|
||||
COPY kube-explorer entrypoint.sh /usr/bin/
|
||||
# Hack to make golang do files,dns search order
|
||||
ENV LOCALDOMAIN=""
|
||||
FROM registry.suse.com/bci/bci-minimal:15.5
|
||||
ARG TARGETARCH
|
||||
ARG TARGETOS
|
||||
ENV ARCH=${TARGETARCH:-"amd64"} OS=${TARGETOS:-"linux"}
|
||||
COPY package/entrypoint.sh /usr/bin/
|
||||
COPY bin/kube-explorer-${OS}-${ARCH} /usr/bin/kube-explorer
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
@@ -4,8 +4,8 @@ set -e
|
||||
source $(dirname $0)/version
|
||||
|
||||
OS_ARCH_ARG_LINUX="amd64 arm arm64"
|
||||
OS_ARCH_ARG_DARWIN="amd64 arm64"
|
||||
OS_ARCH_ARG_WINDOWS="amd64"
|
||||
OS_ARCH_ARG_DARWIN="amd64"
|
||||
|
||||
LD_INJECT_VALUES="-X github.com/rancher/steve/pkg/version.Version=$VERSION
|
||||
-X github.com/rancher/steve/pkg/version.GitCommit=$COMMIT"
|
||||
@@ -14,42 +14,66 @@ LD_INJECT_VALUES="-X github.com/rancher/steve/pkg/version.Version=$VERSION
|
||||
|
||||
pushd $GIT_SOURCE
|
||||
|
||||
CGO_ENABLED=0 go build -tags embed \
|
||||
-ldflags \
|
||||
"$LD_INJECT_VALUES $LINKFLAGS" \
|
||||
-o bin/kube-explorer
|
||||
case "$CROSS" in
|
||||
"push")
|
||||
for ARCH in ${OS_ARCH_ARG_LINUX}; do
|
||||
OUTPUT_BIN="bin/kube-explorer-linux-$ARCH"
|
||||
echo "Building binary for linux/$ARCH..."
|
||||
GOARCH=$ARCH GOOS=linux CGO_ENABLED=0 go build -tags embed \
|
||||
-ldflags \
|
||||
"$LD_INJECT_VALUES $LINKFLAGS" \
|
||||
-o ${OUTPUT_BIN}
|
||||
done
|
||||
;;
|
||||
"tag")
|
||||
for ARCH in ${OS_ARCH_ARG_LINUX}; do
|
||||
OUTPUT_BIN="bin/kube-explorer-linux-$ARCH"
|
||||
echo "Building binary for linux/$ARCH..."
|
||||
GOARCH=$ARCH GOOS=linux CGO_ENABLED=0 go build -tags embed \
|
||||
-ldflags \
|
||||
"$LD_INJECT_VALUES $LINKFLAGS" \
|
||||
-o ${OUTPUT_BIN}
|
||||
done
|
||||
|
||||
if [ -n "$CROSS" ]; then
|
||||
for ARCH in ${OS_ARCH_ARG_LINUX}; do
|
||||
OUTPUT_BIN="bin/kube-explorer-linux-$ARCH"
|
||||
echo "Building binary for linux/$ARCH..."
|
||||
GOARCH=$ARCH GOOS=linux CGO_ENABLED=0 go build -tags embed \
|
||||
-ldflags \
|
||||
"$LD_INJECT_VALUES" \
|
||||
-o ${OUTPUT_BIN}
|
||||
done
|
||||
for ARCH in ${OS_ARCH_ARG_DARWIN}; do
|
||||
OUTPUT_BIN="bin/kube-explorer-darwin-$ARCH"
|
||||
echo "Building binary for darwin/$ARCH..."
|
||||
GOARCH=$ARCH GOOS=darwin CGO_ENABLED=0 go build -tags embed \
|
||||
-ldflags \
|
||||
"$LD_INJECT_VALUES" \
|
||||
-o ${OUTPUT_BIN}
|
||||
done
|
||||
|
||||
for ARCH in ${OS_ARCH_ARG_WINDOWS}; do
|
||||
OUTPUT_BIN="bin/kube-explorer-windows-$ARCH.exe"
|
||||
echo "Building binary for windows/$ARCH..."
|
||||
GOARCH=$ARCH GOOS=windows CGO_ENABLED=0 go build -tags embed \
|
||||
-ldflags \
|
||||
"$LD_INJECT_VALUES" \
|
||||
-o ${OUTPUT_BIN}
|
||||
done
|
||||
for ARCH in ${OS_ARCH_ARG_WINDOWS}; do
|
||||
OUTPUT_BIN="bin/kube-explorer-windows-$ARCH.exe"
|
||||
echo "Building binary for windows/$ARCH..."
|
||||
GOARCH=$ARCH GOOS=windows CGO_ENABLED=0 go build -tags embed \
|
||||
-ldflags \
|
||||
"$LD_INJECT_VALUES" \
|
||||
-o ${OUTPUT_BIN}
|
||||
done
|
||||
;;
|
||||
*)
|
||||
# only build one for current platform
|
||||
CGO_ENABLED=0 go build -tags embed \
|
||||
-ldflags \
|
||||
"$LD_INJECT_VALUES $LINKFLAGS" \
|
||||
-o "bin/kube-explorer-$(uname | tr '[:upper:]' '[:lower:]')-${ARCH}"
|
||||
;;
|
||||
esac
|
||||
|
||||
for ARCH in ${OS_ARCH_ARG_DARWIN}; do
|
||||
OUTPUT_BIN="bin/kube-explorer-darwin-$ARCH"
|
||||
echo "Building binary for darwin/$ARCH..."
|
||||
GOARCH=$ARCH GOOS=darwin CGO_ENABLED=0 go build -tags embed \
|
||||
-ldflags \
|
||||
"$LD_INJECT_VALUES" \
|
||||
-o ${OUTPUT_BIN}
|
||||
done
|
||||
fi
|
||||
mkdir -p $DAPPER_SOURCE/bin
|
||||
|
||||
for f in $(ls ./bin/); do
|
||||
upx -o $DAPPER_SOURCE/bin/$f bin/$f
|
||||
if [[ $f != *darwin* ]]; then
|
||||
upx -o $DAPPER_SOURCE/bin/$f bin/$f || true
|
||||
fi
|
||||
if [ -f $DAPPER_SOURCE/bin/$f ]; then
|
||||
echo "UPX done!"
|
||||
else
|
||||
echo "Copy origin file as UPX failed!!!"
|
||||
cp bin/$f $DAPPER_SOURCE/bin/$f
|
||||
fi
|
||||
done
|
||||
|
||||
popd
|
||||
|
@@ -4,15 +4,14 @@ mkdir -p $(dirname $GIT_SOURCE)
|
||||
|
||||
pushd $(dirname $GIT_SOURCE)
|
||||
|
||||
git clone --depth=1 --branch ${GIT_BRANCH} https://github.com/niusmallnan/steve.git
|
||||
git clone --depth=1 --branch ${GIT_BRANCH} https://github.com/orangedeng/ke-steve.git steve
|
||||
cd steve
|
||||
git reset --hard ${GIT_COMMIT}
|
||||
|
||||
mkdir -p pkg/ui/ui/dashboard
|
||||
cd pkg/ui/ui/dashboard
|
||||
curl -sL https://releases.rancher.com/dashboard/${CATTLE_DASHBOARD_UI_VERSION}.tar.gz | tar xvzf - --strip-components=2
|
||||
curl -sL https://pandaria-dashboard-ui.s3.ap-southeast-2.amazonaws.com/release-2.8-cn/kube-explorer-ui/${CATTLE_DASHBOARD_UI_VERSION}.tar.gz | tar xvzf - --strip-components=2
|
||||
cp index.html ../index.html
|
||||
|
||||
popd
|
||||
|
||||
$(dirname $0)/hack_fs $GIT_SOURCE/pkg/ui/ui/
|
||||
|
@@ -1,42 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
#
|
||||
# find . -type f -name "_*"
|
||||
#
|
||||
function hack_files() {
|
||||
for f in $(find $1 -type f -name "_*"); do
|
||||
name=$(basename $f)
|
||||
updir=$(dirname $f)
|
||||
new_path=$updir/${name:1}
|
||||
echo "move $f $new_path"
|
||||
mv $f $new_path
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# find . -type d -name "_*"
|
||||
#
|
||||
function hack_dirs() {
|
||||
for d in $(find $1 -mindepth 1 -maxdepth 1 -type d); do
|
||||
if [[ ! -d $d ]]; then
|
||||
continue
|
||||
fi
|
||||
name=$(basename $d)
|
||||
if [[ ${name:0:1} == "_" ]]; then
|
||||
updir=$(dirname $d)
|
||||
new_path=$updir/${name:1}
|
||||
echo "move $d $new_path"
|
||||
mv $d $new_path
|
||||
hack_dirs $new_path
|
||||
continue
|
||||
fi
|
||||
hack_dirs $d
|
||||
done
|
||||
}
|
||||
|
||||
pushd $1
|
||||
hack_files .
|
||||
hack_dirs .
|
||||
popd
|
@@ -5,8 +5,6 @@ source $(dirname $0)/version
|
||||
|
||||
pushd $DAPPER_SOURCE
|
||||
|
||||
cp bin/kube-explorer package/
|
||||
cd package
|
||||
docker build -f Dockerfile -t niusmallnan/kube-explorer:$VERSION .
|
||||
docker build -f package/Dockerfile -t cnrancher/kube-explorer:$VERSION .
|
||||
|
||||
popd
|
||||
|
17
scripts/tools/publish.sh
Executable file
17
scripts/tools/publish.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "basedir: $1, version: $2"
|
||||
echo "to publish release to github, run push-github.sh"
|
||||
|
||||
echo "#!/bin/bash"> push-github.sh
|
||||
echo "#"
|
||||
echo "# GITHUB_TOKEN=xxx ./push-github.sh"
|
||||
echo "#"
|
||||
echo "pushd $1"
|
||||
#echo "hub release create -t ${COMMIT} -m v${RELEASE_VERSION} v${RELEASE_VERSION}" >> dist/publish.sh
|
||||
echo "for f in \$(ls $1/bin/) ; do" >> push-github.sh
|
||||
echo " hub release edit -m $2 -a $1/bin/\${f} $2" >> push-github.sh
|
||||
echo "done" >> push-github.sh
|
||||
echo "popd"
|
||||
|
||||
chmod +x push-github.sh
|
Reference in New Issue
Block a user