summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfumingwei <[email protected]>2024-11-06 20:44:46 +0800
committerfumingwei <[email protected]>2024-11-07 10:32:45 +0800
commit3537c65b150d287d04491f2dda65d3005ec34175 (patch)
treef76cd2cf5153281a7bff8d65cbee23dc64442c7c
parentdb1eff5d0ea8f39aa01d2f0232a18374303e4472 (diff)
refactor:Save multi image into one tar file.HEADv2.0.11master
-rw-r--r--.gitlab-ci.yml7
-rw-r--r--README.md11
-rw-r--r--cmake/Package.cmake3
-rw-r--r--k8s-resource/tsg-diagnose-client.yaml84
-rw-r--r--k8s-resource/tsg-diagnose.yaml (renamed from k8s-resource/tsg-diagnose-server.yaml)82
-rw-r--r--service/tsg-diagnose.service4
6 files changed, 90 insertions, 101 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 413b5ff..9ba1fa2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,6 +9,7 @@ variables:
CLIENT_IMAGE_TAG: registry.gdnt-cloud.website/tsg/diagnose/client:latest
SERVER_WEB_IMAGE_TAG: registry.gdnt-cloud.website/tsg/diagnose/server-web:latest
SERVER_DNS_IMAGE_TAG: registry.gdnt-cloud.website/tsg/diagnose/server-dns:latest
+ IMAGES_TAG: tsg-diagnose-images.tar
before_script:
- mkdir -p images;rm -rf images/*
- mkdir -p $BUILD_PADDING_PREFIX/$CI_PROJECT_NAMESPACE/
@@ -17,17 +18,15 @@ variables:
- chmod 0755 ./images_build/server_web/certs/tool
- chmod 0755 ./scripts/tsg-diagnose-oneshot
- chmod 0755 ./scripts/tsg-diagnose-periodical
- - chmod 0755 ./scripts/tsg-diagnose.sh
+ - chmod 0755 ./scripts/tsg-diagnose.sh
- chmod 0755 ./etc/certs_import/certs/tool
- chmod 0755 ./ci/travis.sh
- buildah login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- buildah build -t $CLIENT_IMAGE_TAG -f ./images_build/client/Dockerfile ./images_build/client/
- - podman save -o images/tsg_diagnose_client.tar -m $CLIENT_IMAGE_TAG
- buildah build -t $SERVER_WEB_IMAGE_TAG -f ./images_build/server_web/Dockerfile ./images_build/server_web/
- - podman save -o images/tsg_diagnose_server_web.tar -m $SERVER_WEB_IMAGE_TAG
- buildah build -t $SERVER_DNS_IMAGE_TAG -f ./images_build/server_dns/Dockerfile ./images_build/server_dns/
- - podman save -o images/tsg_diagnose_server_dns.tar -m $SERVER_DNS_IMAGE_TAG
+ - podman save -o images/$IMAGES_TAG -m $CLIENT_IMAGE_TAG $SERVER_WEB_IMAGE_TAG $SERVER_DNS_IMAGE_TAG
- cd $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
- ./ci/travis.sh
diff --git a/README.md b/README.md
index ce92619..430a6ac 100644
--- a/README.md
+++ b/README.md
@@ -12,19 +12,14 @@ dnf install tsg-diagnose
### Docker
If you have installed TSG Diagnose with Docker support, you can use the following command to build the TSG Diagnose runtime environment.
```bash
-docker load < /opt/tsg/tsg-diagnose/images/tsg_diagnose_server_web.tar
-docker load < /opt/tsg/tsg-diagnose/images/tsg_diagnose_server_dns.tar
-docker load < /opt/tsg/tsg-diagnose/images/tsg_diagnose_client.tar
+docker load < /opt/tsg/tsg-diagnose/images/tsg-diagnose-images.tar
docker-compose down --remove-orphans; docker-compose up -d --remove-orphans
```
### k3s
If you have installed TSG Diagnose with k3s support, you can use the following command to build the TSG Diagnose runtime environment.
```bash
-k3s ctr image import /opt/tsg/tsg-diagnose/images/tsg_diagnose_server_web.tar
-k3s ctr image import /opt/tsg/tsg-diagnose/images/tsg_diagnose_server_dns.tar
-k3s ctr image import /opt/tsg/tsg-diagnose/images/tsg_diagnose_client.tar
-kubectl apply -f /opt/tsg/tsg-diagnose/k8s-resource/tsg-diagnose-client.yaml
-kubectl apply -f /opt/tsg/tsg-diagnose/k8s-resource/tsg-diagnose-server.yaml
+k3s ctr image import /opt/tsg/tsg-diagnose/images/tsg-diagnose-images.tar
+kubectl apply -f /opt/tsg/tsg-diagnose/k8s-resource/tsg-diagnose.yaml
```
## Usage
There are two commands available to run TSG Diagnose:
diff --git a/cmake/Package.cmake b/cmake/Package.cmake
index 3115768..954c582 100644
--- a/cmake/Package.cmake
+++ b/cmake/Package.cmake
@@ -20,8 +20,7 @@ set(CPACK_RPM_DEBUGINFO_PACKAGE on)
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PostInstall.in)
install(FILES compose/docker-compose.yml DESTINATION ./compose)
-install(FILES k8s-resource/tsg-diagnose-client.yaml DESTINATION ./k8s-resource)
-install(FILES k8s-resource/tsg-diagnose-server.yaml DESTINATION ./k8s-resource)
+install(DIRECTORY k8s-resource/ DESTINATION ./k8s-resource)
install(FILES compose/docker-compose.yml DESTINATION ./compose)
install(FILES images_build/client/dign_client/etc/client.conf DESTINATION ./etc)
install(FILES service/tsg-diagnose.service DESTINATION /usr/lib/systemd/system)
diff --git a/k8s-resource/tsg-diagnose-client.yaml b/k8s-resource/tsg-diagnose-client.yaml
deleted file mode 100644
index b93d156..0000000
--- a/k8s-resource/tsg-diagnose-client.yaml
+++ /dev/null
@@ -1,84 +0,0 @@
----
-apiVersion: "k8s.cni.cncf.io/v1"
-kind: NetworkAttachmentDefinition
-metadata:
- namespace: tsg-os-system
- name: br-dign-client
-spec:
- config: '{
- "cniVersion": "0.3.0",
- "type": "bridge",
- "bridge": "br_dign_c",
- "ipam": {
- "type": "host-local",
- "ranges": [
- [ {
- "subnet": "192.0.2.0/24",
- "rangeStart": "192.0.2.211",
- "rangeEnd": "192.0.2.220",
- "gateway": "192.0.2.1"
- } ]
- ]
- }
- }'
----
-apiVersion: apps/v1
-kind: DaemonSet
-metadata:
- namespace: tsg-os-system
- name: dign-client
- labels:
- app: dign-client
-
-spec:
- selector:
- matchLabels:
- app: dign-client
- template:
- metadata:
- labels:
- app: dign-client
- annotations:
- k8s.v1.cni.cncf.io/networks: br-dign-client
- spec:
- containers:
- - name: dign-client
- image: "registry.gdnt-cloud.website/tsg/diagnose/client:latest"
- imagePullPolicy: Never
- workingDir: /opt/dign_client
- command: ["/bin/sh", "-c", "update-ca-certificates; tail -f /dev/null"]
- securityContext:
- privileged: true
- volumeMounts:
- - name: localtime-node
- mountPath: /etc/localtime
- readOnly: true
- - name: ca-cert-file
- mountPath: /usr/local/share/ca-certificates
- - name: log-path
- mountPath: /opt/dign_client/log
- - name: config-path
- mountPath: /opt/dign_client/etc/client.conf
- subPath: "client.conf"
- - name: share-path
- mountPath: /opt/dign_client/share
-
-
- volumes:
- - name: localtime-node
- hostPath:
- path: /etc/localtime
- - name: ca-cert-file
- hostPath:
- path: /opt/tsg/tsg-diagnose/etc/.certs_import/certs/sets/current/gen/crt
- - name: log-path
- hostPath:
- path: /opt/tsg/tsg-diagnose/log
- - name: config-path
- hostPath:
- path: /opt/tsg/tsg-diagnose/etc
- - name: share-path
- hostPath:
- path: /opt/tsg/clixon/share
----
-
diff --git a/k8s-resource/tsg-diagnose-server.yaml b/k8s-resource/tsg-diagnose.yaml
index df285bd..42dd29d 100644
--- a/k8s-resource/tsg-diagnose-server.yaml
+++ b/k8s-resource/tsg-diagnose.yaml
@@ -3,6 +3,88 @@ apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
namespace: tsg-os-system
+ name: br-dign-client
+spec:
+ config: '{
+ "cniVersion": "0.3.0",
+ "type": "bridge",
+ "bridge": "br_dign_c",
+ "ipam": {
+ "type": "host-local",
+ "ranges": [
+ [ {
+ "subnet": "192.0.2.0/24",
+ "rangeStart": "192.0.2.211",
+ "rangeEnd": "192.0.2.220",
+ "gateway": "192.0.2.1"
+ } ]
+ ]
+ }
+ }'
+---
+apiVersion: apps/v1
+kind: DaemonSet
+metadata:
+ namespace: tsg-os-system
+ name: dign-client
+ labels:
+ app: dign-client
+
+spec:
+ selector:
+ matchLabels:
+ app: dign-client
+ template:
+ metadata:
+ labels:
+ app: dign-client
+ annotations:
+ k8s.v1.cni.cncf.io/networks: br-dign-client
+ spec:
+ containers:
+ - name: dign-client
+ image: "registry.gdnt-cloud.website/tsg/diagnose/client:latest"
+ imagePullPolicy: Never
+ workingDir: /opt/dign_client
+ command: ["/bin/sh", "-c", "update-ca-certificates; tail -f /dev/null"]
+ securityContext:
+ privileged: true
+ volumeMounts:
+ - name: localtime-node
+ mountPath: /etc/localtime
+ readOnly: true
+ - name: ca-cert-file
+ mountPath: /usr/local/share/ca-certificates
+ - name: log-path
+ mountPath: /opt/dign_client/log
+ - name: config-path
+ mountPath: /opt/dign_client/etc/client.conf
+ subPath: "client.conf"
+ - name: share-path
+ mountPath: /opt/dign_client/share
+
+
+ volumes:
+ - name: localtime-node
+ hostPath:
+ path: /etc/localtime
+ - name: ca-cert-file
+ hostPath:
+ path: /opt/tsg/tsg-diagnose/etc/.certs_import/certs/sets/current/gen/crt
+ - name: log-path
+ hostPath:
+ path: /opt/tsg/tsg-diagnose/log
+ - name: config-path
+ hostPath:
+ path: /opt/tsg/tsg-diagnose/etc
+ - name: share-path
+ hostPath:
+ path: /opt/tsg/clixon/share
+---
+apiVersion: "k8s.cni.cncf.io/v1"
+kind: NetworkAttachmentDefinition
+metadata:
+ namespace: tsg-os-system
name: br-dign-server
spec:
config: '{
diff --git a/service/tsg-diagnose.service b/service/tsg-diagnose.service
index 2ecde57..ae5e481 100644
--- a/service/tsg-diagnose.service
+++ b/service/tsg-diagnose.service
@@ -7,9 +7,7 @@ After=docker.service
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/opt/tsg/tsg-diagnose/compose/%i
-ExecStartPre=/bin/sh -c "docker load < /opt/tsg/tsg-diagnose/images/tsg_diagnose_server_web.tar"
-ExecStartPre=/bin/sh -c "docker load < /opt/tsg/tsg-diagnose/images/tsg_diagnose_server_dns.tar"
-ExecStartPre=/bin/sh -c "docker load < /opt/tsg/tsg-diagnose/images/tsg_diagnose_client.tar"
+ExecStartPre=/bin/sh -c "docker load < /opt/tsg/tsg-diagnose/images/tsg-diagnose-images.tar"
ExecStart=/bin/sh -c "docker-compose down --remove-orphans; docker-compose up -d --remove-orphans"
ExecStop=/bin/sh -c "docker-compose down --remove-orphans"