Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CLI
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CloageStack
CLI
Commits
ea3ea0f6
Commit
ea3ea0f6
authored
2 years ago
by
mohammad
Browse files
Options
Downloads
Patches
Plain Diff
refactor agent process and clean functionality
parent
dc733c21
Branches
Branches containing commit
Tags
v0.2.8
Tags containing commit
No related merge requests found
Pipeline
#89
passed
2 years ago
Stage: build
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
models/command_tools.py
+16
-13
16 additions, 13 deletions
models/command_tools.py
with
16 additions
and
13 deletions
models/command_tools.py
+
16
−
13
View file @
ea3ea0f6
...
...
@@ -80,19 +80,19 @@ class Commands(RunCommand):
def
flux_install
(
self
,
name
):
self
.
run
([
'
flux
'
,
'
install
'
,
'
--components=source-controller,kustomize-controller,helm-controller
'
,
'
--namespace=flux-system
'
])
return
True
def
cluster_info
(
self
,
name
):
self
.
run
([
'
kubectl
'
,
'
cluster-info
'
])
return
True
def
kubectl_apply
(
self
,
name
):
# we should change these commands
ps
=
run
([
'
echo
'
,
self
.
data
],
check
=
True
,
capture_output
=
True
)
processNames
=
run
([
'
kubectl
'
,
'
apply
'
,
'
-f
'
,
'
-
'
],
input
=
ps
.
stdout
,
capture_output
=
True
)
logger
.
info
(
processNames
.
stdout
.
decode
(
'
utf-8
'
).
strip
())
return
ps
.
returncode
def
install_k3s_server
(
self
,
name
):
ps_mkdir
=
self
.
run
(
...
...
@@ -164,18 +164,19 @@ class Commands(RunCommand):
token
=
f
.
readline
().
strip
()
with
open
(
"
/etc/rancher/rke2/rke2.yaml
"
,
"
r
"
)
as
stream
:
try
:
kubeconfig
=
yaml
.
safe_load
(
stream
)
kube
_
config
=
yaml
.
safe_load
(
stream
)
except
yaml
.
YAMLError
as
exc
:
kubeconfig
=
None
kube
_
config
=
None
return
{
'
kubeconfig
'
:
'
test
'
,
'
token
'
:
'
test
'
'
kubeconfig
'
:
kube_config
,
'
token
'
:
token
}
def
install_rke2_worker
(
self
,
name
):
# please check these commands too
ps_mkdir
=
self
.
run
(
[
'
mkdir
'
,
'
-p
'
,
'
/var/lib/rancher/k3s/agent/images/
'
])
with
cd
(
"
/var/lib/rancher/k3s/agent/images/
"
):
...
...
@@ -191,10 +192,12 @@ class Commands(RunCommand):
ps_chmod_install_sh
=
self
.
run
([
'
chmod
'
,
'
+x
'
,
'
./install.sh
'
])
ps_cp_k3s
=
self
.
run
([
'
cp
'
,
'
./k3s
'
,
'
/usr/local/bin/k3s
'
])
ps_run_sh
=
self
.
run
(
[
'''
export INSTALL_K3S_SKIP_DOWNLOAD=true
&& export K3S_URL=https://myserver:6443
&& export K3S_TOKEN=mynodetoken
&& ./install.sh
'''
],
shell
=
True
)
[(
"
export INSTALL_K3S_SKIP_DOWNLOAD=true
"
f
"
&& export rke2_URL=
{
self
.
cluster
[
'
access_url
'
]
}
"
f
"
&& export rke2_TOKEN=
{
self
.
cluster
[
'
token
'
]
}
"
"
&& ./install.sh
"
)],
shell
=
True
)
hash_commands
=
{
'
flux-install
'
:
'
flux_install
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment