Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discussing] Workaround to deploy on kubernetes with plugins #1087

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 38 additions & 23 deletions k8s/shadowsocks-rust.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
---
kind: Namespace
apiVersion: v1
metadata:
name: shadowsocks-rust
labels:
app.kubernetes.io/name: shadowsocks-rust
---
# Source: shadowsocks-rust/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: shadowsocks-rust
namespace: shadowsocks-rust
labels:
helm.sh/chart: shadowsocks-rust-0.1.0
app.kubernetes.io/name: shadowsocks-rust
Expand All @@ -16,6 +24,7 @@ kind: ConfigMap
apiVersion: v1
metadata:
name: shadowsocks-rust
namespace: shadowsocks-rust
labels:
helm.sh/chart: shadowsocks-rust-0.1.0
app.kubernetes.io/name: shadowsocks-rust
Expand All @@ -34,7 +43,9 @@ data:
"password": "mypassword",
"server": "::",
"server_port": 8388,
"service_port": 80
"service_port": 80,
"plugin": "v2ray-plugin",
"plugin_opts": "server;host=mydomain",
zonyitoo marked this conversation as resolved.
Show resolved Hide resolved
}
]
}
Expand All @@ -44,6 +55,7 @@ apiVersion: v1
kind: Service
metadata:
name: shadowsocks-rust
namespace: shadowsocks-rust
labels:
helm.sh/chart: shadowsocks-rust-0.1.0
app.kubernetes.io/name: shadowsocks-rust
Expand All @@ -66,6 +78,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: shadowsocks-rust
namespace: shadowsocks-rust
labels:
helm.sh/chart: shadowsocks-rust-0.1.0
app.kubernetes.io/name: shadowsocks-rust
Expand Down Expand Up @@ -93,6 +106,28 @@ spec:
name: shadowsocks-rust
- name: plugins
emptyDir: {}
initContainers:
- name: plugin-downloader
image: busybox
command: ['sh', '-c']
args:
- |
cd /download;
TAG=$(wget -qO- https://api.github.com/repos/shadowsocks/v2ray-plugin/releases/latest | grep tag_name | cut -d '"' -f4);
wget https://github.com/shadowsocks/v2ray-plugin/releases/download/$TAG/v2ray-plugin-linux-amd64-$TAG.tar.gz;
tar -xf *.gz;
rm *.gz;
mv v2ray* /download/v2ray-plugin;
chmod +x /download/v2ray-plugin;
TAG=$(wget -qO- https://api.github.com/repos/teddysun/xray-plugin/releases/latest | grep tag_name | cut -d '"' -f4);
wget https://github.com/teddysun/xray-plugin/releases/download/$TAG/xray-plugin-linux-amd64-$TAG.tar.gz;
tar -xf *.gz;
rm *.gz;
mv xray* /download/xray-plugin;
chmod +x /download/xray-plugin;
volumeMounts:
- name: plugins
mountPath: /download
zonyitoo marked this conversation as resolved.
Show resolved Hide resolved
containers:
- name: shadowsocks-rust
securityContext:
Expand All @@ -104,7 +139,7 @@ spec:
mountPath: /etc/shadowsocks-rust
readOnly: true
- name: plugins
mountPath: /usr/local/bin
mountPath: /usr/local/sbin
ports:
- name: ss-8388
containerPort: 8388
Expand All @@ -126,24 +161,4 @@ spec:
requests:
cpu: 20m
memory: 32Mi
---
# Source: shadowsocks-rust/templates/tests/test-connection.yaml
apiVersion: v1
kind: Pod
metadata:
name: "shadowsocks-rust-test-connection"
labels:
helm.sh/chart: shadowsocks-rust-0.1.0
app.kubernetes.io/name: shadowsocks-rust
app.kubernetes.io/instance: shadowsocks-rust
app.kubernetes.io/version: "1.x.x"
app.kubernetes.io/managed-by: Helm
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['shadowsocks-rust:']
restartPolicy: Never
...