Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/MZC-CSC/cm-mayfly into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
dev4unet committed Sep 4, 2024
2 parents cef08c5 + c476a88 commit b0153ba
Show file tree
Hide file tree
Showing 146 changed files with 6,962 additions and 276 deletions.
Binary file modified bin/mayfly
Binary file not shown.
12 changes: 12 additions & 0 deletions conf/k8s/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.PHONY: format
format:
@helm template --debug ./cloud-migrator

.PHONY: dependency
dependency:
@cd ./cloud-migrator && helm dependency update
@cd ./cloud-migrator/charts/cb-spider && helm dependency update
@cd ./cloud-migrator/charts/cb-tumblebug && helm dependency update
@cd ./cloud-migrator/charts/cm-beetle && helm dependency update
@cd ./cloud-migrator/charts/cm-honeybee && helm dependency update
@cd ./cloud-migrator/charts/cm-cicada && helm dependency update
23 changes: 23 additions & 0 deletions conf/k8s/cloud-migrator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
18 changes: 18 additions & 0 deletions conf/k8s/cloud-migrator/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dependencies:
- name: cb-spider
repository: ""
version: 0.9.2
- name: cb-tumblebug
repository: ""
version: 0.9.7
- name: cm-beetle
repository: ""
version: 0.2.0
- name: cm-honeybee
repository: ""
version: 0.2.1
- name: cm-cicada
repository: ""
version: 0.2.0
digest: sha256:c4a2fe6e5ce78aa075218c6999c1486cdc364d90f9db4bcbb9dd3b4a72e63376
generated: "2024-09-03T17:26:16.092724332+09:00"
22 changes: 22 additions & 0 deletions conf/k8s/cloud-migrator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v2
name: cloud-migrator
description: A Helm chart for Cloud-Migrator platform
type: application
version: 0.3.0
appVersion: "0.3.0"
dependencies:
- name: cb-spider
version: 0.9.2
condition: cb-spider.enabled
- name: cb-tumblebug
version: 0.9.7
condition: cb-tumblebug.enabled
- name: cm-beetle
version: 0.2.0
condition: cm-beetle.enabled
- name: cm-honeybee
version: 0.2.1
condition: cm-honeybee.enabled
- name: cm-cicada
version: 0.2.0
condition: cm-cicada.enabled
23 changes: 23 additions & 0 deletions conf/k8s/cloud-migrator/charts/cb-spider/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions conf/k8s/cloud-migrator/charts/cb-spider/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: cb-spider
description: A Helm chart for cb-spider
type: application
version: 0.9.2
appVersion: "0.9.2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#### Config for Call-Log Lib. ####

calllog:
## true | false
loopcheck: false # This temp method for development is busy wait. cf) calllogger.go:levelSetupLoop().

## info | error // The error is like switching off the call-log.
loglevel: info # If loopcheck is true, You can set this online.

## true | false // Now false is reserved for the future.
logfile: true

## Config for File Output ##
logfileinfo:
filename: $CBSPIDER_ROOT/log/calllog/calllogs.log
maxsize: 20 # megabytes
maxbackups: 100
maxage: 365 # days
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
cloud:
common:
enable: "y"
nlb:
enable: "y"
interval: "10"
timeout: "9"
threshold: "3"
k8scluster:
enable: "y"
aws:
enable: "y"
nlb:
enable: "y"
interval: "10"
timeout: "-1"
threshold: "3"
k8scluster:
enable: "n"
azure:
enable: "y"
nlb:
enable: "y"
interval: "10"
timeout: "9"
threshold: "3"
k8scluster:
enable: "n"
gcp:
enable: "y"
nlb:
enable: "y"
interval: "10"
timeout: "9"
threshold: "3"
k8scluster:
enable: "n"
alibaba:
enable: "y"
nlb:
enable: "y"
interval: "10"
timeout: "9"
threshold: "3"
k8scluster:
enable: "y"
tencent:
enable: "y"
nlb:
enable: "y"
interval: "10"
timeout: "9"
threshold: "3"
k8scluster:
enable: "y"
ibm:
enable: "y"
nlb:
enable: "y"
interval: "10"
timeout: "9"
threshold: "3"
k8scluster:
enable: "n"
nhncloud:
enable: "y"
k8scluster:
enable: "y"
openstack:
enable: "y"
nlb:
enable: "n"
interval: "10"
timeout: "9"
threshold: "3"
k8scluster:
enable: "n"
cloudit :
enable: "y"
nlb:
enable: "n"
interval: "10"
timeout: "9"
threshold: "3"
k8scluster:
enable: "n"
nlbsw:
sw: "HAProxy"
version: "latest"
commandNlbPrepare: "wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/nlb/deployNlb.sh; wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/nlb/addTargetNode.sh; wget https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/scripts/nlb/applyConfig.sh; chmod +x ~/deployNlb.sh ~/addTargetNode.sh ~/applyConfig.sh"
commandNlbDeploy: "sudo ~/deployNlb.sh"
commandNlbAddTargetNode: "sudo ~/addTargetNode.sh"
commandNlbApplyConfig: "sudo ~/applyConfig.sh"
nlbMcisCommonSpec: "aws-ap-northeast-2-t2-small"
nlbMcisCommonImage: "ubuntu18.04"
nlbMcisSubGroupSize: "2"
19 changes: 19 additions & 0 deletions conf/k8s/cloud-migrator/charts/cb-spider/files/conf/log_conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#### Config for cb-log Lib. ####

cblog:
## true | false
loopcheck: false # This temp method for development is busy wait. cf) cblogger.go:levelSetupLoop().

## trace | debug | info | warn/warning | error | fatal | panic
## Default logging level: info
loglevel: info # If loopcheck is true, You can set this online.

## true | false
logfile: true

## Config for File Output ##
logfileinfo:
filename: $CBSPIDER_ROOT/log/cblogs.log
maxsize: 10 # megabytes
maxbackups: 50
maxage: 31 # days
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#### Config for CB-Store ####

# server type: NUTSDB | ETCD
# NUTSDB: embedded Key-Value Store on Local Filesystem
storetype: NUTSDB
# storetype: ETCD

nutsdb:
dbpath: "$CBSTORE_ROOT/meta_db/dat"
segmentsize: 1048576 # 1048576 1024*1024 (1MB)
#segmentsize: 10485760 # 10485760 10*1024*1024 (10MB)

etcd:
# etcd server, when ETCD typpe
etcdserverport: "cloud-migrator-etcd:2379"
22 changes: 22 additions & 0 deletions conf/k8s/cloud-migrator/charts/cb-spider/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "cb-spider.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "cb-spider.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "cb-spider.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "cb-spider.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions conf/k8s/cloud-migrator/charts/cb-spider/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cb-spider.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "cb-spider.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cb-spider.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cb-spider.labels" -}}
helm.sh/chart: {{ include "cb-spider.chart" . }}
{{ include "cb-spider.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cb-spider.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cb-spider.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cb-spider.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cb-spider.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
23 changes: 23 additions & 0 deletions conf/k8s/cloud-migrator/charts/cb-spider/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "cb-spider.fullname" . }}
labels:
{{- include "cb-spider.labels" . | nindent 4 }}
data:
calllog_conf.yaml: |-
{{ range .Files.Lines "files/conf/calllog_conf.yaml" }}
{{ . }}
{{ end }}
cloud_conf.yaml: |-
{{ range .Files.Lines "files/conf/cloud_conf.yaml" }}
{{ . }}
{{ end }}
log_conf.yaml: |-
{{ range .Files.Lines "files/conf/log_conf.yaml" }}
{{ . }}
{{ end }}
store_conf.yaml: |-
{{ range .Files.Lines "files/conf/store_conf.yaml" }}
{{ . }}
{{ end }}
Loading

0 comments on commit b0153ba

Please sign in to comment.