diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7b9dc70 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test +.vagrant +releases +tmp +.idea/ +.vscode/ + +# Architecture specific extensions/prefixes +trace.out +*.out +.DS_Store \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 05d3ea8..ef680ba 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,13 +5,73 @@ - + - + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - { - "keyToString": { - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "RunOnceActivity.go.format.on.save.advertiser.fired": "true", - "RunOnceActivity.go.formatter.settings.were.checked": "true", - "RunOnceActivity.go.migrated.go.modules.settings": "true", - "RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true", - "RunOnceActivity.go.watchers.conflict.with.on.save.actions.check.performed": "true", - "WebServerToolWindowFactoryState": "false", - "go.import.settings.migrated": "true", - "go.sdk.automatically.set": "true", - "last_opened_file_path": "/Users/caimingxia/go/github/chaosblade-box-agent" + +}]]> @@ -296,32 +354,32 @@ file://$PROJECT_DIR$/cmd/chaos_agent.go - 85 + 101 file://$PROJECT_DIR$/conn/connect/connect.go - 90 + 106 file://$PROJECT_DIR$/web/handler/chaosblade.go - 44 + 60 file://$PROJECT_DIR$/web/handler/chaosblade.go - 43 + 59 file://$PROJECT_DIR$/web/handler/chaosblade.go - 66 + 82 file://$PROJECT_DIR$/web/handler/uninstallAgent.go - 43 + 44 diff --git a/Makefile b/Makefile index dd5d409..f1ad636 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONE: build clean -export AGENT_VERSION = 1.0.2 -export BLADE_VERSION = 1.5.0 +export AGENT_VERSION = 1.0.3 +export BLADE_VERSION = 1.7.2 BLADE_SRC_ROOT=$(shell pwd) diff --git a/build/helm3/chaos-agent-arm/Chart.yaml b/build/helm3/chaos-agent-arm/Chart.yaml index e03db3c..b2e6470 100644 --- a/build/helm3/chaos-agent-arm/Chart.yaml +++ b/build/helm3/chaos-agent-arm/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 -appVersion: "1.0.2" +appVersion: "1.0.3" description: A SaaS-based service that aims to improve the high availability of your applications. name: chaosblade-box-agent -version: 1.0.2 +version: 1.0.3 home: https://www.alibabacloud.com/products/chaos diff --git a/build/helm3/chaos-agent-arm/values.yaml b/build/helm3/chaos-agent-arm/values.yaml index ab6cf26..f383534 100644 --- a/build/helm3/chaos-agent-arm/values.yaml +++ b/build/helm3/chaos-agent-arm/values.yaml @@ -11,7 +11,7 @@ controller: images: # chaos agent image named chaos-agent chaos: - version: 1.0.2 + version: 1.0.3 repository: chaosbladeio/chaosblade-agent-arm64 # images.chaos.pullPolicy: must be Always|IfNotPresent|Never pullPolicy: Always diff --git a/build/helm3/chaos-agent/Chart.yaml b/build/helm3/chaos-agent/Chart.yaml index e03db3c..b2e6470 100644 --- a/build/helm3/chaos-agent/Chart.yaml +++ b/build/helm3/chaos-agent/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 -appVersion: "1.0.2" +appVersion: "1.0.3" description: A SaaS-based service that aims to improve the high availability of your applications. name: chaosblade-box-agent -version: 1.0.2 +version: 1.0.3 home: https://www.alibabacloud.com/products/chaos diff --git a/build/helm3/chaos-agent/values.yaml b/build/helm3/chaos-agent/values.yaml index 02320e9..4dde677 100644 --- a/build/helm3/chaos-agent/values.yaml +++ b/build/helm3/chaos-agent/values.yaml @@ -11,7 +11,7 @@ controller: images: # chaos agent image named chaos-agent chaos: - version: 1.0.2 + version: 1.0.3 repository: chaosbladeio/chaosblade-agent # images.chaos.pullPolicy: must be Always|IfNotPresent|Never pullPolicy: Always diff --git a/cmd/chaos_agent.go b/cmd/chaos_agent.go index bbc5a1e..bc971cd 100644 --- a/cmd/chaos_agent.go +++ b/cmd/chaos_agent.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package main import ( diff --git a/collector/kubernetes/common.go b/collector/kubernetes/common.go index d42ce79..3b3bdb8 100644 --- a/collector/kubernetes/common.go +++ b/collector/kubernetes/common.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package kubernetes import ( diff --git a/collector/kubernetes/daemonset.go b/collector/kubernetes/daemonset.go index 758dadc..f846101 100644 --- a/collector/kubernetes/daemonset.go +++ b/collector/kubernetes/daemonset.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package kubernetes import ( diff --git a/collector/kubernetes/deployment.go b/collector/kubernetes/deployment.go index 2f445ab..8cec801 100644 --- a/collector/kubernetes/deployment.go +++ b/collector/kubernetes/deployment.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package kubernetes import ( diff --git a/collector/kubernetes/ingress.go b/collector/kubernetes/ingress.go index be121e6..d4bfc8d 100644 --- a/collector/kubernetes/ingress.go +++ b/collector/kubernetes/ingress.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package kubernetes import ( diff --git a/collector/kubernetes/kubernetes.go b/collector/kubernetes/kubernetes.go index d6ed88f..a9f2b3c 100644 --- a/collector/kubernetes/kubernetes.go +++ b/collector/kubernetes/kubernetes.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package kubernetes import ( @@ -339,7 +340,7 @@ func (mw *multiWatch) Stop() { return } -//common function +// common function func getPodRestartCount(pod *v1.Pod) int32 { count := int32(0) for _, c := range pod.Status.ContainerStatuses { diff --git a/collector/kubernetes/namespace.go b/collector/kubernetes/namespace.go index 1948394..2de68cf 100644 --- a/collector/kubernetes/namespace.go +++ b/collector/kubernetes/namespace.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package kubernetes import ( diff --git a/collector/kubernetes/node.go b/collector/kubernetes/node.go index 1ec5cd0..e056834 100644 --- a/collector/kubernetes/node.go +++ b/collector/kubernetes/node.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package kubernetes import ( diff --git a/collector/kubernetes/pod.go b/collector/kubernetes/pod.go index 235e8b4..10086b4 100644 --- a/collector/kubernetes/pod.go +++ b/collector/kubernetes/pod.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package kubernetes import ( diff --git a/collector/kubernetes/replicaset.go b/collector/kubernetes/replicaset.go index 816ed32..2e9858e 100644 --- a/collector/kubernetes/replicaset.go +++ b/collector/kubernetes/replicaset.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package kubernetes import ( diff --git a/collector/kubernetes/service.go b/collector/kubernetes/service.go index fc6b915..b4c4946 100644 --- a/collector/kubernetes/service.go +++ b/collector/kubernetes/service.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package kubernetes import ( diff --git a/collector/kubernetes/types.go b/collector/kubernetes/types.go index 11cd584..aecb918 100644 --- a/collector/kubernetes/types.go +++ b/collector/kubernetes/types.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package kubernetes import ( diff --git a/collector/kubernetes/virtualnode.go b/collector/kubernetes/virtualnode.go index a5de745..4223c1f 100644 --- a/collector/kubernetes/virtualnode.go +++ b/collector/kubernetes/virtualnode.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package kubernetes import ( diff --git a/conn/asyncreport/asyncreport.go b/conn/asyncreport/asyncreport.go index 1aaaf26..58311e6 100644 --- a/conn/asyncreport/asyncreport.go +++ b/conn/asyncreport/asyncreport.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package asyncreport import ( diff --git a/conn/callback/callback.go b/conn/callback/callback.go index f9f8e8d..ee11d07 100644 --- a/conn/callback/callback.go +++ b/conn/callback/callback.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package callback import ( diff --git a/conn/close/closer.go b/conn/close/closer.go index 79c4f18..7bf6d37 100644 --- a/conn/close/closer.go +++ b/conn/close/closer.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package closer import ( diff --git a/conn/conn.go b/conn/conn.go index ce1c695..59b79aa 100644 --- a/conn/conn.go +++ b/conn/conn.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package conn import ( diff --git a/conn/connect/connect.go b/conn/connect/connect.go index 9d40f51..9d4c87a 100644 --- a/conn/connect/connect.go +++ b/conn/connect/connect.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package connect import ( @@ -24,7 +40,7 @@ func NewClientConnectHandler(transportClient *transport.TransportClient) *Client } } -//Connect to remote +// Connect to remote func (cc *ClientConnectHandler) Start() error { request := transport.NewRequest() request.AddParam("ip", options.Opts.Ip) diff --git a/conn/heartbeat/heartbeat.go b/conn/heartbeat/heartbeat.go index e635b1f..e8b293f 100644 --- a/conn/heartbeat/heartbeat.go +++ b/conn/heartbeat/heartbeat.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package heartbeat import ( diff --git a/conn/metric/metric.go b/conn/metric/metric.go index 8ca4d02..361110b 100644 --- a/conn/metric/metric.go +++ b/conn/metric/metric.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package metric import ( diff --git a/metricreport/metric.go b/metricreport/metric.go index c6e6e85..4f49a5e 100644 --- a/metricreport/metric.go +++ b/metricreport/metric.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package metricreport import ( diff --git a/monitor/checker.go b/monitor/checker.go index 153fca9..75a378e 100644 --- a/monitor/checker.go +++ b/monitor/checker.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package monitor import ( diff --git a/monitor/monitor.go b/monitor/monitor.go index 8007fda..dd17119 100644 --- a/monitor/monitor.go +++ b/monitor/monitor.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package monitor import ( diff --git a/pkg/bash/bash.go b/pkg/bash/bash.go index 85b841c..bf64e1b 100644 --- a/pkg/bash/bash.go +++ b/pkg/bash/bash.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package bash import ( @@ -23,7 +39,7 @@ func ExecOsAgentScript(ctx context.Context, script, args string) (string, bool) return fmt.Sprintf("%s %s", result, errMsg), false } -//ExecScript, default maximum timeout is 30s +// ExecScript, default maximum timeout is 30s // string: 返回结果 // string: 错误信息 // bool: 是否成功 diff --git a/pkg/helm3/helm.go b/pkg/helm3/helm.go index fa26c82..f983a87 100644 --- a/pkg/helm3/helm.go +++ b/pkg/helm3/helm.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package helm3 import ( diff --git a/pkg/helm3/registry/resolver.go b/pkg/helm3/registry/resolver.go index 51fcdb0..2c77587 100644 --- a/pkg/helm3/registry/resolver.go +++ b/pkg/helm3/registry/resolver.go @@ -1,26 +1,18 @@ /* -<<<<<<< HEAD -Copyright The Helm Authors. -======= -<<<<<<< HEAD:vendor/k8s.io/api/certificates/v1/doc.go -Copyright 2020 The Kubernetes Authors. -======= -Copyright The Helm Authors. ->>>>>>> origin/1.9.1-Integrate-managed-tools:pkg/registry/resolver.go ->>>>>>> origin/1.9.1-Integrate-managed-tools - -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. -*/ + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ package registry // import "helm.sh/helm/v3/internal/experimental/registry" diff --git a/pkg/http/http.go b/pkg/http/http.go index 3ae99ef..a767329 100644 --- a/pkg/http/http.go +++ b/pkg/http/http.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package http import ( diff --git a/pkg/kubernetes/kubernetes.go b/pkg/kubernetes/kubernetes.go index 09d8e78..098f8d4 100644 --- a/pkg/kubernetes/kubernetes.go +++ b/pkg/kubernetes/kubernetes.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package kubernetes import ( diff --git a/pkg/log/log.go b/pkg/log/log.go index 20f0082..62914b0 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package log import ( diff --git a/pkg/options/bladeoptions.go b/pkg/options/bladeoptions.go index 888c3ef..4befdcc 100644 --- a/pkg/options/bladeoptions.go +++ b/pkg/options/bladeoptions.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package options import ( diff --git a/pkg/options/chaostoolsoptions.go b/pkg/options/chaostoolsoptions.go index f632132..083e993 100644 --- a/pkg/options/chaostoolsoptions.go +++ b/pkg/options/chaostoolsoptions.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package options var PrepareOperation = map[string]bool{ diff --git a/pkg/options/options.go b/pkg/options/options.go index 9690768..5433273 100644 --- a/pkg/options/options.go +++ b/pkg/options/options.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package options import ( @@ -208,7 +224,7 @@ func (o *Options) SetOthersByFlags() { o.Ip = o.GetPrivateIp() o.HostName = o.GetHostName() o.InstanceId = o.GetHostName() - o.Version = "1.0.2" + o.Version = "1.0.3" o.InitApplicationInfo(o.ApplicationInstance, o.ApplicationGroup) var err error diff --git a/pkg/tools/auth.go b/pkg/tools/auth.go index a46a5e5..570bec4 100644 --- a/pkg/tools/auth.go +++ b/pkg/tools/auth.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package tools import ( @@ -28,21 +44,21 @@ var localAccessKey = "" var localSecureKey = "" var mutex = sync.RWMutex{} -//GetAccessKey +// GetAccessKey func GetAccessKey() string { mutex.RLock() defer mutex.RUnlock() return localAccessKey } -//GetSecureKey +// GetSecureKey func GetSecureKey() string { mutex.RLock() defer mutex.RUnlock() return localSecureKey } -//Sign +// Sign func Sign(signData string) string { sum256 := sha256.Sum256([]byte((signData + localSecureKey))) encodeToString := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%x", string(sum256[:])))) diff --git a/pkg/tools/download.go b/pkg/tools/download.go index 9656e21..78486b8 100644 --- a/pkg/tools/download.go +++ b/pkg/tools/download.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package tools import ( diff --git a/pkg/tools/env.go b/pkg/tools/env.go index 67588cc..57c7133 100644 --- a/pkg/tools/env.go +++ b/pkg/tools/env.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package tools import ( @@ -43,7 +59,7 @@ var metricPath string var agentPath string var chaosLogFilePath string -//GetUserHome return user home. +// GetUserHome return user home. func GetUserHome() string { user, err := user.Current() if err == nil { @@ -59,7 +75,7 @@ func CheckEnvironment() { // check pid } -//GetCurrentDirectory return the process path +// GetCurrentDirectory return the process path func GetCurrentDirectory() string { if chaosPath != "" { return chaosPath @@ -72,7 +88,7 @@ func GetCurrentDirectory() string { return dir } -//GetAgentLogFilePath +// GetAgentLogFilePath func GetAgentLogFilePath() string { if chaosLogFilePath != "" { return chaosLogFilePath @@ -81,7 +97,7 @@ func GetAgentLogFilePath() string { return chaosLogFilePath } -//GetMetricDirectory +// GetMetricDirectory func GetMetricDirectory() string { if metricPath != "" { return metricPath @@ -123,7 +139,7 @@ func GetAgentDirectory() string { return agentPath } -//SetchaosPath +// SetchaosPath func SetchaosPath(path string) { chaosPath = path } diff --git a/pkg/tools/file.go b/pkg/tools/file.go index a0bc0f1..2949244 100644 --- a/pkg/tools/file.go +++ b/pkg/tools/file.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package tools import ( @@ -13,13 +29,13 @@ import ( "strings" ) -//IsExist return true if file exists +// IsExist return true if file exists func IsExist(fileName string) bool { _, err := os.Stat(fileName) return err == nil || os.IsExist(err) } -//DeCompressTgz +// DeCompressTgz func DeCompressTgz(tarFile, destPath string) error { file, err := os.Open(tarFile) if err != nil { diff --git a/pkg/tools/limitedlist.go b/pkg/tools/limitedlist.go index f047b72..88aee72 100644 --- a/pkg/tools/limitedlist.go +++ b/pkg/tools/limitedlist.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package tools import ( diff --git a/pkg/tools/panic.go b/pkg/tools/panic.go index 2f2d5fd..5bf3936 100644 --- a/pkg/tools/panic.go +++ b/pkg/tools/panic.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package tools import ( diff --git a/pkg/tools/set.go b/pkg/tools/set.go index 25e916c..c075ce7 100644 --- a/pkg/tools/set.go +++ b/pkg/tools/set.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package tools type Set struct { diff --git a/pkg/tools/signal.go b/pkg/tools/signal.go index 40a8625..b22a7b5 100644 --- a/pkg/tools/signal.go +++ b/pkg/tools/signal.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package tools import ( diff --git a/pkg/tools/uuid.go b/pkg/tools/uuid.go index b35778b..b936cd2 100644 --- a/pkg/tools/uuid.go +++ b/pkg/tools/uuid.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package tools import ( @@ -21,4 +37,4 @@ func GenerateUid() (string, error) { return "", err } return hex.EncodeToString(b), nil -} \ No newline at end of file +} diff --git a/server/chaosblade/chaosblade.go b/server/chaosblade/chaosblade.go index 9e24836..23649e7 100644 --- a/server/chaosblade/chaosblade.go +++ b/server/chaosblade/chaosblade.go @@ -1 +1,17 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package chaosblade diff --git a/transport/interceptor.go b/transport/interceptor.go index 175bf53..a568109 100644 --- a/transport/interceptor.go +++ b/transport/interceptor.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package transport import ( @@ -32,7 +48,7 @@ type requestInterceptorChain struct { doRequestInterceptor } -//Handle interceptor. return nil,true if passed, otherwise return response of fail and false +// Handle interceptor. return nil,true if passed, otherwise return response of fail and false func (interceptor *requestInterceptorChain) Handle(request *Request) (*Response, bool) { if response, ok := interceptor.doHandler(request); !ok { return response, ok @@ -46,7 +62,7 @@ func (interceptor *requestInterceptorChain) Handle(request *Request) (*Response, return nil, true } -//Invoke interceptor. +// Invoke interceptor. func (interceptor *requestInterceptorChain) Invoke(request *Request) (*Response, bool) { if response, ok := interceptor.doInvoker(request); !ok { return response, ok diff --git a/transport/request.go b/transport/request.go index 416c1cc..bb09711 100644 --- a/transport/request.go +++ b/transport/request.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package transport import ( @@ -45,7 +61,7 @@ func NewRequest() *Request { return request } -//AddHeader add metadata to it +// AddHeader add metadata to it func (request *Request) AddHeader(key string, value string) *Request { if key != "" { request.Headers[key] = value @@ -53,7 +69,7 @@ func (request *Request) AddHeader(key string, value string) *Request { return request } -//AddParam add request data to it +// AddParam add request data to it func (request *Request) AddParam(key string, value string) *Request { if key != "" { request.Params[key] = value @@ -148,7 +164,7 @@ type Uri struct { CompressVersion string } -//NewUri: create a new one +// NewUri: create a new one func NewUri(serverName, handlerName string) Uri { return Uri{ ServerName: serverName, diff --git a/transport/response.go b/transport/response.go index 08a4454..e255bf3 100644 --- a/transport/response.go +++ b/transport/response.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package transport import ( diff --git a/transport/transport.go b/transport/transport.go index e11f8a7..c29876d 100644 --- a/transport/transport.go +++ b/transport/transport.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package transport import ( diff --git a/version/version.go b/version/version.go index e182643..479857a 100644 --- a/version/version.go +++ b/version/version.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package version var ( diff --git a/web/api/api.go b/web/api/api.go index 1c02303..9e0ebe4 100644 --- a/web/api/api.go +++ b/web/api/api.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package api import ( diff --git a/web/api/handler.go b/web/api/handler.go index d17625e..2ea8445 100644 --- a/web/api/handler.go +++ b/web/api/handler.go @@ -1,13 +1,28 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package api import ( "context" "encoding/json" - "github.com/sirupsen/logrus" - "github.com/chaosblade-io/chaos-agent/transport" "github.com/chaosblade-io/chaos-agent/web" + "github.com/sirupsen/logrus" ) type ServerRequestHandler struct { diff --git a/web/handler/chaosblade.go b/web/handler/chaosblade.go index 0e12620..fdd9f7b 100644 --- a/web/handler/chaosblade.go +++ b/web/handler/chaosblade.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package handler import ( diff --git a/web/handler/litmuschaos/installlitmus.go b/web/handler/litmuschaos/installlitmus.go index 5b1c4d1..568352d 100644 --- a/web/handler/litmuschaos/installlitmus.go +++ b/web/handler/litmuschaos/installlitmus.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package litmuschaos import ( diff --git a/web/handler/litmuschaos/litmuschaos.go b/web/handler/litmuschaos/litmuschaos.go index 46182ff..41c00d1 100644 --- a/web/handler/litmuschaos/litmuschaos.go +++ b/web/handler/litmuschaos/litmuschaos.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package litmuschaos import ( diff --git a/web/handler/litmuschaos/litmusdefault.go b/web/handler/litmuschaos/litmusdefault.go index 9bdfd9c..dfe7922 100644 --- a/web/handler/litmuschaos/litmusdefault.go +++ b/web/handler/litmuschaos/litmusdefault.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package litmuschaos import ( diff --git a/web/handler/litmuschaos/uninstalllitmus.go b/web/handler/litmuschaos/uninstalllitmus.go index 770d15c..151e8af 100644 --- a/web/handler/litmuschaos/uninstalllitmus.go +++ b/web/handler/litmuschaos/uninstalllitmus.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package litmuschaos import ( diff --git a/web/handler/ping.go b/web/handler/ping.go index 2a5c5b3..81df418 100644 --- a/web/handler/ping.go +++ b/web/handler/ping.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package handler import ( diff --git a/web/handler/uninstallAgent.go b/web/handler/uninstallAgent.go index b7ec7f1..e0d702d 100644 --- a/web/handler/uninstallAgent.go +++ b/web/handler/uninstallAgent.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package handler import ( diff --git a/web/handler/updateApplication.go b/web/handler/updateApplication.go index d4c960a..6918504 100644 --- a/web/handler/updateApplication.go +++ b/web/handler/updateApplication.go @@ -1,3 +1,19 @@ +/* + * Copyright 1999-2020 Alibaba Group Holding Ltd. + * + * 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. + */ + package handler import ( diff --git a/web/server/gateway.go b/web/server/gateway.go index 807c433..cac41f4 100644 --- a/web/server/gateway.go +++ b/web/server/gateway.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package server import ( diff --git a/web/server/http.go b/web/server/http.go index 2f261b5..e0f49df 100644 --- a/web/server/http.go +++ b/web/server/http.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package server import ( diff --git a/web/type.go b/web/type.go index 040b941..2cb3cf1 100644 --- a/web/type.go +++ b/web/type.go @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package web import (