-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6bf109
commit bb5f0a1
Showing
205 changed files
with
28,862 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: CI Create Release | ||
|
||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.23.1' | ||
- name: Get Version | ||
id: branch-names | ||
uses: tj-actions/branch-names@v8 | ||
with: | ||
strip_tag_prefix: v | ||
- name: Build | ||
run: | | ||
chmod +x ./build.sh | ||
./build.sh ${{ steps.branch-names.outputs.tag }} X86 | ||
./build.sh ${{ steps.branch-names.outputs.tag }} ARM | ||
- name: Create Release and Upload Release Asset | ||
uses: softprops/action-gh-release@v2 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
body: TODO New Release. | ||
draft: true | ||
files: | | ||
eSDK_Huawei_Storage_CSM_V${{ steps.branch-names.outputs.tag }}_X86_64.zip | ||
eSDK_Huawei_Storage_CSM_V${{ steps.branch-names.outputs.tag }}_ARM_64.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Created by .ignore support plugin (hsz.mobi) | ||
### Example user template template | ||
### Example user template | ||
|
||
# IntelliJ project files | ||
.idea | ||
*.iml | ||
out | ||
gen | ||
go.sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# eg: docker build --target xxx --platform linux/amd64 --build-arg VER=${VER} -f Dockerfile -t xxx:${VER} . | ||
ARG VER | ||
|
||
FROM busybox:stable-glibc as csm-prometheus-collector | ||
LABEL version="${VER}" | ||
LABEL maintainers="Huawei CSM development team" | ||
LABEL description="Kubernetes CSM(prometheus) for Huawei Storage" | ||
|
||
ARG binary=./csm-prometheus-collector | ||
COPY ${binary} csm-prometheus-collector | ||
ENTRYPOINT ["/csm-prometheus-collector"] | ||
|
||
FROM busybox:stable-glibc as csm-cmi | ||
LABEL version="${VER}" | ||
LABEL maintainers="Huawei CSM development team" | ||
LABEL description="Kubernetes CSM(cmi) for Huawei Storage" | ||
|
||
ARG binary=./csm-cmi | ||
COPY ${binary} csm-cmi | ||
ENTRYPOINT ["/csm-cmi"] | ||
|
||
FROM busybox:stable-glibc as csm-topo-service | ||
LABEL version="${VER}" | ||
LABEL maintainers="Huawei CSM development team" | ||
LABEL description="Kubernetes CSM(topo) for Huawei Storage" | ||
|
||
ARG binary=./csm-topo-service | ||
COPY ${binary} csm-topo-service | ||
ENTRYPOINT ["/csm-topo-service"] | ||
|
||
FROM busybox:stable-glibc as csm-liveness-probe | ||
LABEL version="${VER}" | ||
LABEL maintainers="Huawei CSM development team" | ||
LABEL description="Kubernetes CSM(livenessprobe) for Huawei Storage" | ||
|
||
ARG binary=./csm-liveness-probe | ||
COPY ${binary} csm-liveness-probe | ||
ENTRYPOINT ["/csm-liveness-probe"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# usage: make -f Makefile VER={VER} PLATFORM={PLATFORM} RELEASE_VER=${RELEASE_VER} | ||
|
||
# (required) [x.y.x] | ||
VER=VER | ||
# (required) [X86 ARM] | ||
PLATFORM=PLATFORM | ||
|
||
export GO111MODULE=on | ||
|
||
Build_Version = github.com/huawei/csm/v2/utils/version.buildVersion | ||
Build_Arch = github.com/huawei/csm/v2/utils/version.buildArch | ||
flag = -ldflags '-w -s -bindnow -X "${Build_Version}=${VER}" -X "${Build_Arch}=${PLATFORM}"' -buildmode=pie | ||
|
||
# Platform [X86, ARM] | ||
ifeq (${PLATFORM}, X86) | ||
env = CGO_ENABLED=0 GOOS=linux GOARCH=amd64 | ||
else | ||
env = CGO_ENABLED=0 GOOS=linux GOARCH=arm64 | ||
endif | ||
|
||
all:PREPARE BUILD | ||
|
||
PREPARE: | ||
rm -rf ./${TMP_DIR_PATH} | ||
mkdir -p ./${TMP_DIR_PATH} | ||
|
||
BUILD: | ||
go mod tidy | ||
# usage: [env] go build [-o output] [flags] packages | ||
${env} go build -o ${TMP_DIR_PATH}/csm-prometheus-collector ${flag} -buildmode=pie ./cmd/third-party-monitor-server/prometheus-collector | ||
${env} go build -o ${TMP_DIR_PATH}/csm-cmi ${flag} -buildmode=pie ./cmd/container-monitor-interface/cmi | ||
${env} go build -o ${TMP_DIR_PATH}/csm-topo-service ${flag} -buildmode=pie ./cmd/storage-monitor-server/topo-service | ||
${env} go build -o ${TMP_DIR_PATH}/csm-liveness-probe ${flag} -buildmode=pie ./cmd/livenessprobe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
# csm | ||
Huawei Container Storage Monitor | ||
# CSM for Huawei Storage | ||
|
||
![GitHub](https://img.shields.io/github/license/Huawei/csm) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/huawei/csm)](https://goreportcard.com/report/github.com/huawei/csm) | ||
![GitHub go.mod Go version (subdirectory of monorepo)](https://img.shields.io/github/go-mod/go-version/Huawei/csm) | ||
![GitHub Release Date](https://img.shields.io/github/release-date/Huawei/csm) | ||
![GitHub release (latest by date)](https://img.shields.io/github/downloads/Huawei/csm/latest/total) | ||
|
||
## Description | ||
Container Storage Monitor (CSM) is a tool used for visual display of Huawei storage resources and Kubernetes resources in Kubernetes container scenarios. This tool can notify storage of the relationship between a PV/Pod and a LUN/filesystem so that the relationship can be displayed on the storage for storage administrators to view. It can also upload the performance, capacity, IOPS, and other data of a LUN/file system to a third-party network management system for application administrators to view. In this way, O&M availability in container scenarios can be improved. | ||
|
||
## Documentation | ||
You can click [Release](https://github.com/Huawei/csm/releases) to obtain the released Huawei csm package. | ||
|
||
For details, see the user guide in the docs directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# usage: bash build.sh {VER} {PLATFORM} | ||
|
||
# [x.y.z] | ||
VER=$1 | ||
# [X86 ARM] | ||
PLATFORM=$2 | ||
|
||
set -e | ||
workdir=$(cd $(dirname $0); pwd) | ||
|
||
# tmp dir is used to build binary files and images | ||
export TMP_DIR_PATH="${workdir}/eSDK_CSM_V${VER}_${PLATFORM}_64" | ||
# release dir is used to assemble the release package | ||
release_dir_path="${workdir}/release" | ||
|
||
# init tmp dir and release dir | ||
rm -rf "${TMP_DIR_PATH}" | ||
mkdir -p "${TMP_DIR_PATH}" | ||
rm -rf "${release_dir_path}/image" | ||
mkdir -p "${release_dir_path}/image" | ||
|
||
echo "Start to make with Makefile" | ||
make -f Makefile VER=$1 PLATFORM=$2 | ||
|
||
echo "Platform confirmation" | ||
if [[ "${PLATFORM}" == "ARM" ]];then | ||
PULL_FLAG="--platform=arm64" | ||
BUILD_FLAG="--platform linux/arm64" | ||
elif [[ "${PLATFORM}" == "X86" ]];then | ||
PULL_FLAG="--platform=amd64" | ||
BUILD_FLAG="--platform linux/amd64" | ||
else | ||
echo "Wrong PLATFORM, support [X86, ARM]" | ||
exit | ||
fi | ||
|
||
echo "Start to pull busybox image with architecture" | ||
docker pull ${PULL_FLAG} busybox:stable-glibc | ||
|
||
# build the image | ||
function build_image() { | ||
cp -rf Dockerfile "${TMP_DIR_PATH}"/Dockerfile | ||
|
||
# cd to tmp dir to build image | ||
cd "${TMP_DIR_PATH}" | ||
local images=("csm-prometheus-collector" "csm-topo-service" "csm-cmi" "csm-liveness-probe") | ||
# shellcheck disable=SC2068 | ||
for img in ${images[@]}; do | ||
echo "build the ${img} image" | ||
chmod +x "${img}" | ||
docker build ${BUILD_FLAG} -f Dockerfile -t ${img}:${VER} --target ${img} --build-arg VER=${VER} . | ||
docker save ${img}:${VER} -o ${img}-${VER}.tar | ||
mv ${img}-${VER}.tar ${release_dir_path}/image | ||
done | ||
} | ||
build_image | ||
|
||
# pack the package | ||
echo "pack deploy files" | ||
cp -rf "${workdir}"/helm "${release_dir_path}" | ||
|
||
echo "pack example files" | ||
cp -rf "${workdir}"/example "${release_dir_path}" | ||
|
||
echo "pack manual files" | ||
cp -rf "${workdir}"/manual "${release_dir_path}" | ||
cp -rf "${workdir}"/helm/huawei-csm/crds "${release_dir_path}"/manual/huawei-csm | ||
|
||
# cd to release dir to pack the package | ||
cd "${release_dir_path}" | ||
|
||
# set version in values.yaml and upload-image.sh | ||
sed -i "s/{{version}}/${VER}/g" helm/huawei-csm/values.yaml | ||
sed -i "s/{{version}}/${VER}/g" helm/huawei-csm/upload-image.sh | ||
|
||
# set version in manual templates | ||
sed -i "s/{{version}}/${VER}/g" manual/huawei-csm/templates/csm-prometheus.yaml | ||
sed -i "s/{{version}}/${VER}/g" manual/huawei-csm/templates/csm-storage.yaml | ||
|
||
# parse ${VAR} to Semantic Version style | ||
# Charts https://helm.sh/docs/topics/charts/ | ||
# Semantic Version https://semver.org/lang/zh-CN/` | ||
# example: | ||
# 2.0.0.B070 -> 2.0.0-B070 | ||
# 2.0.0 -> 2.0.0 | ||
chart_version=$(echo ${VER} | sed -e 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\)\./\1-/') | ||
sed -i "s/{{version}}/${chart_version}/g" helm/huawei-csm/Chart.yaml | ||
|
||
# zip the release package and move it to workdir | ||
zip -rq -o eSDK_Huawei_Storage_CSM_V"${VER}"_"${PLATFORM}"_64.zip ./* | ||
mv eSDK_Huawei_Storage_CSM_V"${VER}"_"${PLATFORM}"_64.zip "${workdir}" | ||
|
||
# cd to workdir to remove tmp files | ||
cd "${workdir}" | ||
rm -rf "${TMP_DIR_PATH}" | ||
rm -rf "${release_dir_path}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# eg: docker build --target xxx --platform linux/amd64 --build-arg VER=${VER} -f Dockerfile -t xxx:${VER} . | ||
ARG VER | ||
|
||
FROM busybox:stable-glibc as csm-prometheus-collector | ||
LABEL version="${VER}" | ||
LABEL maintainers="Huawei CSM development team" | ||
LABEL description="Kubernetes CSM(prometheus) for Huawei Storage" | ||
|
||
ARG binary=./csm-prometheus-collector | ||
COPY ${binary} csm-prometheus-collector | ||
ENTRYPOINT ["/csm-prometheus-collector"] | ||
|
||
|
||
# Use distroless as minimal base image to package the manager binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM busybox:stable-glibc as csm-cmi | ||
LABEL version="${VER}" | ||
LABEL maintainers="Huawei CSM development team" | ||
LABEL description="Kubernetes CSM(cmi) for Huawei Storage" | ||
|
||
ARG binary=./csm-cmi | ||
COPY ${binary} csm-cmi | ||
ENTRYPOINT ["/csm-cmi"] | ||
|
||
|
||
FROM busybox:stable-glibc as csm-topo-service | ||
LABEL version="${VER}" | ||
LABEL maintainers="Huawei CSM development team" | ||
LABEL description="Kubernetes CSM(topo) for Huawei Storage" | ||
|
||
ARG binary=./csm-topo-service | ||
COPY ${binary} csm-topo-service | ||
ENTRYPOINT ["/csm-topo-service"] | ||
|
||
FROM busybox:stable-glibc as csm-liveness-probe | ||
LABEL version="${VER}" | ||
LABEL maintainers="Huawei CSM development team" | ||
LABEL description="Kubernetes CSM(livenessprobe) for Huawei Storage" | ||
|
||
ARG binary=./csm-liveness-probe | ||
COPY ${binary} csm-liveness-probe | ||
ENTRYPOINT ["/csm-liveness-probe"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# usage: make -f Makefile VER={VER} PLATFORM={PLATFORM} RELEASE_VER=${RELEASE_VER} | ||
|
||
# (required) [x.y.x] | ||
VER=VER | ||
# (required) [X86 ARM] | ||
PLATFORM=PLATFORM | ||
# (Optional) [2.5.RC1 2.5.RC2 ...] eSDK Version | ||
RELEASE_VER=RELEASE_VER | ||
|
||
export GO111MODULE=on | ||
export GOPATH:=$(GOPATH):$(shell pwd) | ||
|
||
Build_Version = github.com/huawei/csm/v2/utils/version.buildVersion | ||
Build_Arch = github.com/huawei/csm/v2/utils/version.buildArch | ||
flag = -ldflags '-w -s -linkmode "external" -extldflags "-Wl,-z,now" -X "${Build_Version}=${VER}" -X "${Build_Arch}=${PLATFORM}"' -buildmode=pie | ||
|
||
# Platform [X86, ARM] | ||
ifeq (${PLATFORM}, X86) | ||
env = CGO_CFLAGS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2" GOOS=linux GOARCH=amd64 | ||
else | ||
env = CGO_CFLAGS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2" GOOS=linux GOARCH=arm64 | ||
endif | ||
|
||
all:PREPARE BUILD | ||
|
||
PREPARE: | ||
rm -rf ./${PACKAGE_NAME} | ||
mkdir -p ./${PACKAGE_NAME} | ||
|
||
BUILD: | ||
go mod tidy | ||
# usage: [env] go build [-o output] [flags] packages | ||
${env} go build -o ./${PACKAGE_NAME}/csm-prometheus-collector ${flag} -buildmode=pie ../cmd/third-party-monitor-server/prometheus-collector | ||
${env} go build -o ./${PACKAGE_NAME}/csm-cmi ${flag} -buildmode=pie ../cmd/container-monitor-interface/cmi | ||
${env} go build -o ./${PACKAGE_NAME}/csm-topo-service ${flag} -buildmode=pie ../cmd/storage-monitor-server/topo-service | ||
${env} go build -o ./${PACKAGE_NAME}/csm-liveness-probe ${flag} -buildmode=pie ../cmd/livenessprobe |
Oops, something went wrong.