Skip to content

Commit fcbe61f

Browse files
authored
Merge pull request #1 from Stevent-fei/add_plugins
add plugins
2 parents fadf3e2 + 209c224 commit fcbe61f

10 files changed

+207
-0
lines changed

.github/workflows/markdown.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Markdown-related Check
2+
3+
on:
4+
pull_request:
5+
branches: "*"
6+
7+
jobs:
8+
markdown-related-check:
9+
name: markdown-related check
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v2
14+
15+
- name: Markdown Link Check
16+
uses: docker://dragonflyoss/linter:v0.2.7
17+
with:
18+
# validate all links in markdown files excluding vendor folder
19+
args: bash -c "code=0;for mdFile in $(find ./ -name '*.md' | grep -v index.md | grep -v vendor | grep -v docs/commandline); do markdown-link-check -q --config .github/workflows/.mlc_config.json $mdFile; if [ $? -ne 0 ]; then code=1; fi;done; echo $code; exit $code"
20+
21+
- name: Markdown Lint
22+
uses: docker://dragonflyoss/linter:v0.2.7
23+
with:
24+
# lint all markdown files excluding vendor folder
25+
args: bash -c "find ./ -name '*.md' | grep -v vendor | grep -v .github | grep -v index.md | grep -v docs/commandline | xargs mdl -r ~MD010,~MD013,~MD022,~MD024,~MD026,~MD029,~MD033,~MD036"
26+
27+

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,39 @@
11
# plugins
2+
3+
## Plugin Spec
4+
5+
PluginSpec defines the desired state of Plugin
6+
7+
```
8+
type PluginSpec struct {
9+
Type string `json:"type,omitempty"`
10+
Data string `json:"data,omitempty"`
11+
Action string `json:"action,omitempty"`
12+
Scope string `json:"scope,omitempty"`
13+
}
14+
```
15+
16+
1. for `PluginSpec.Type`: plugin type,currently only supported "SHELL".
17+
2. for `PluginSpec.Data`: plugin`s real data, sealer will use it to do actual action.
18+
3. for `PluginSpec.Scope`: plugin`s scope, it is usually the role name, support use '|' to specify multiple scopes.
19+
4. for `PluginSpec.Action`: phase of this plugin will run. below is the phase list we currently supported.
20+
21+
plugin will be executed by `PluginSpec.Name` in alphabetical order at the same stage.
22+
23+
The following is a detailed introduction for plugin action.
24+
25+
| action name | action scope | explanation |
26+
| :-----| ----: | :----: |
27+
| pre-init-host | cluster host | will run before init cluster host |
28+
| post-init-host | cluster host | will run after init cluster host |
29+
| pre-clean-host | cluster host | will run before clean cluster host |
30+
| post-clean-host | cluster host | will run after clean cluster host |
31+
| pre-install | master0 | will run before install cluster |
32+
| post-install | master0 | will run after install cluster |
33+
| pre-uninstall | master0 | will run before uninstall cluster |
34+
| post-uninstall | master0 | will run after uninstall cluster |
35+
| pre-scaleup | master0 | will run before scaleup cluster |
36+
| post-scaleup | master0 | will run after scaleup cluster |
37+
| upgrade-host | cluster host | will run before upgrade cluster |
38+
| upgrade | master0 | will run for upgrading cluster |
39+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: sealer.io/v2
2+
kind: Plugin
3+
metadata:
4+
name: disk-init-rollback # Specify this plugin name,will dump in $rootfs/plugin dir.
5+
spec:
6+
type: SHELL
7+
action: post-clean-host
8+
scope: master
9+
data: |
10+
set -e; set -x
11+
bash scripts/disk_init_rollback_v2.sh
12+
---
13+
apiVersion: sealer.io/v2
14+
kind: Plugin
15+
metadata:
16+
name: node_disk-init-rollback # Specify this plugin name,will dump in $rootfs/plugin dir.
17+
spec:
18+
type: SHELL
19+
action: post-clean-host
20+
scope: node
21+
data: |
22+
set -e; set -x
23+
export EtcdDevice=""
24+
bash scripts/disk_init_rollback_v2.sh
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apiVersion: sealer.io/v2
2+
kind: Plugin
3+
metadata:
4+
name: disk-init # Specify this plugin name,will dump in $rootfs/plugin dir.
5+
spec:
6+
type: SHELL
7+
action: pre-init-host
8+
scope: master
9+
data: |
10+
set -e; set -x
11+
bash scripts/install-lvm.sh || exit 1
12+
bash scripts/disk_init_v2.sh
13+
---
14+
apiVersion: sealer.io/v2
15+
kind: Plugin
16+
metadata:
17+
name: node_disk-init # Specify this plugin name,will dump in $rootfs/plugin dir.
18+
spec:
19+
type: SHELL
20+
action: pre-init-host
21+
scope: node
22+
data: |
23+
set -e; set -x
24+
export EtcdDevice=""
25+
bash scripts/install-lvm.sh || exit 1
26+
bash scripts/disk_init_v2.sh
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: sealer.io/v2
2+
kind: Plugin
3+
metadata:
4+
name: post_init_host_master # Specify this plugin name,will dump in $rootfs/plugin dir.
5+
spec:
6+
type: SHELL
7+
action: post-init-host
8+
scope: master
9+
data: |
10+
set -e;set -x
11+
bash scripts/post_init_master.sh
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: sealer.io/v2
2+
kind: Plugin
3+
metadata:
4+
name: post_install # Specify this plugin name,will dump in $rootfs/plugin dir.
5+
spec:
6+
type: SHELL
7+
action: post-install
8+
data: |
9+
set -e;set -x
10+
bash scripts/post_install.sh
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: sealer.io/v2
2+
kind: Plugin
3+
metadata:
4+
name: post_scaleup # Specify this plugin name,will dump in $rootfs/plugin dir.
5+
spec:
6+
type: SHELL
7+
action: post-scaleup
8+
data: |
9+
set -e;set -x
10+
bash scripts/post_scaleup.sh
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: sealer.io/v2
2+
kind: Plugin
3+
metadata:
4+
name: pre_init_host # Specify this plugin name,will dump in $rootfs/plugin dir.
5+
spec:
6+
type: SHELL
7+
action: pre-init-host
8+
scope: node
9+
data: |
10+
set -e;set -x
11+
bash scripts/pre_init_host.sh
12+
---
13+
apiVersion: sealer.aliyun.com/v1alpha1
14+
kind: Plugin
15+
metadata:
16+
name: pre_init_host_master # Specify this plugin name,will dump in $rootfs/plugin dir.
17+
spec:
18+
type: SHELL
19+
action: pre-init-host
20+
scope: master
21+
data: |
22+
set -e;set -x
23+
bash scripts/pre_init_host.sh
24+
25+
mkdir -p /etc/kubernetes/
26+
cp -f statics/kube-scheduler-config.yaml /etc/kubernetes/kube-scheduler-config.yaml
27+
cp -f scripts/push-to-registry.sh /usr/local/bin/push-to-registry.sh
28+
chmod +x /usr/local/bin/push-to-registry.sh
29+
cp -f scripts/etcdctl_v3.sh /usr/local/bin/etcdctl_v3
30+
chmod +x /usr/local/bin/etcdctl_v3
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: sealer.io/v2
2+
kind: Plugin
3+
metadata:
4+
name: preflight # Specify this plugin name,will dump in $rootfs/plugin dir.
5+
spec:
6+
type: SHELL
7+
action: pre-install
8+
data: |
9+
set -e; set -x
10+
if [ "${SkipPreflight}" = "true" ];then
11+
exit 0
12+
fi
13+
chmod +x ./bin/trident
14+
cp -f ./bin/trident /usr/bin/trident
15+
trident preflight run -f /root/.sealer/Clusterfile --sealer --ignore-errors "OS,${IgnoreErrors}"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: sealer.io/v2
2+
kind: Plugin
3+
metadata:
4+
name: upgrade_host # Specify this plugin name,will dump in $rootfs/plugin dir.
5+
spec:
6+
type: SHELL
7+
action: upgrade-host
8+
scope: master|node
9+
data: |
10+
set -e;set -x
11+
cp -f bin/seautil /usr/local/bin/seautil
12+
chmod +x /usr/local/bin/seautil
13+
cp -f bin/trident /usr/bin/trident
14+
chmod +x /usr/bin/trident
15+
cp -f bin/helm /usr/bin/helm
16+
chmod +x /usr/bin/helm

0 commit comments

Comments
 (0)