Compare commits
23 Commits
master
...
advanced-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
466c4b6c72 | ||
|
|
dfc90814db | ||
|
|
bdd4e3fc27 | ||
|
|
62a799ffca | ||
|
|
4bedf56ce7 | ||
|
|
9ed6038058 | ||
|
|
da8ffc9474 | ||
|
|
c2adbd2a71 | ||
|
|
948527290c | ||
|
|
feecd35b04 | ||
|
|
f97f8a59f9 | ||
|
|
c81ff737e2 | ||
|
|
9c23a68128 | ||
|
|
e5d2b72e19 | ||
|
|
21af31b210 | ||
|
|
5fc6aa52e7 | ||
|
|
f8f960d73b | ||
|
|
7e72365d86 | ||
|
|
b908e97d42 | ||
|
|
7f4bfd4c03 | ||
|
|
bbec5e008d | ||
|
|
edc36d6738 | ||
|
|
2366bbf0d7 |
16
.github/.stale.yaml
vendored
Normal file
16
.github/.stale.yaml
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Number of days of inactivity before an issue becomes stale
|
||||||
|
daysUntilStale: 30
|
||||||
|
# Number of days of inactivity before a stale issue is closed
|
||||||
|
daysUntilClose: 14
|
||||||
|
# Issues with these labels will never be considered stale
|
||||||
|
exemptLabels:
|
||||||
|
- lifecycle/frozen
|
||||||
|
staleLabel: lifecycle/stale
|
||||||
|
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||||
|
markComment: >
|
||||||
|
This issue has been automatically marked as stale because it has not had
|
||||||
|
recent activity. It will be closed if no further activity occurs. Any further update will
|
||||||
|
cause the issue/pull request to no longer be considered stale. Thank you for your contributions.
|
||||||
|
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||||
|
closeComment: >
|
||||||
|
This issue is being automatically closed due to inactivity.
|
||||||
42
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
42
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
**General remarks**
|
||||||
|
|
||||||
|
> Please delete this section including header before submitting
|
||||||
|
> 也可以使用中文
|
||||||
|
>
|
||||||
|
> This form is to report bugs. For general usage questions refer to our Slack channel
|
||||||
|
> [KubeSphere-users](https://join.slack.com/t/kubesphere/shared_invite/enQtNTE3MDIxNzUxNzQ0LTdkNTc3OTdmNzdiODViZjViNTU5ZDY3M2I2MzY4MTI4OGZlOTJmMDg5ZTFiMDAwYzNlZDY5NjA0NzZlNDU5NmY)
|
||||||
|
|
||||||
|
**Describe the bug(描述下问题)**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
For UI issues please also add a screenshot that shows the issue.
|
||||||
|
|
||||||
|
**Versions used(KubeSphere/Kubernetes的版本)**
|
||||||
|
KubeSphere:
|
||||||
|
Kubernetes: (If KubeSphere installer used, you can skip this)
|
||||||
|
|
||||||
|
|
||||||
|
**Environment(环境的硬件配置)**
|
||||||
|
How many nodes and their hardware configuration:
|
||||||
|
|
||||||
|
For example:
|
||||||
|
3 masters: 8cpu/8g
|
||||||
|
3 nodes: 8cpu/16g
|
||||||
|
|
||||||
|
(and other info are welcomed to help us debugging)
|
||||||
|
|
||||||
|
**To Reproduce(复现步骤)**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior(预期行为)**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
14
.travis.yml
14
.travis.yml
@@ -1,31 +1,29 @@
|
|||||||
sudo: required
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
language: go
|
language: go
|
||||||
|
|
||||||
|
git:
|
||||||
|
depth: false
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.10
|
- 1.10
|
||||||
- tip
|
|
||||||
|
|
||||||
go_import_path: kubesphere.io/kubesphere
|
go_import_path: kubesphere.io/kubesphere
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
|
||||||
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
- curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||||
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
|
|
||||||
- sudo apt-get update
|
|
||||||
- sudo apt-get -y install docker-ce
|
|
||||||
- dep ensure -v
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
- dep ensure -v
|
||||||
- docker --version
|
- docker --version
|
||||||
|
- dep ensure -v
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make fmt-check && make build
|
- make fmt-check && make build
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
skip_cleanup: true
|
||||||
provider: script
|
provider: script
|
||||||
script: bash install/scripts/docker_push
|
script: bash install/scripts/docker_push
|
||||||
on:
|
on:
|
||||||
|
|||||||
7
Makefile
7
Makefile
@@ -2,6 +2,9 @@
|
|||||||
# Use of this source code is governed by a Apache license
|
# Use of this source code is governed by a Apache license
|
||||||
# that can be found in the LICENSE file.
|
# that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
# The binary to build
|
||||||
|
BIN ?= kubesphere
|
||||||
|
|
||||||
TRAG.Org:=kubesphere
|
TRAG.Org:=kubesphere
|
||||||
TRAG.Name:=ks-apiserver
|
TRAG.Name:=ks-apiserver
|
||||||
TRAG.Gopkg:=kubesphere.io/kubesphere
|
TRAG.Gopkg:=kubesphere.io/kubesphere
|
||||||
@@ -12,6 +15,8 @@ RUN_IN_DOCKER:=docker run -it --rm -v `pwd`:/go/src/$(TRAG.Gopkg) -v `pwd`/tmp/c
|
|||||||
GO_FMT:=goimports -l -w -e -local=kubesphere -srcdir=/go/src/$(TRAG.Gopkg)
|
GO_FMT:=goimports -l -w -e -local=kubesphere -srcdir=/go/src/$(TRAG.Gopkg)
|
||||||
GO_FILES:=./cmd ./pkg
|
GO_FILES:=./cmd ./pkg
|
||||||
|
|
||||||
|
REGISTRY ?= kubespheredev/ks-apiserver
|
||||||
|
|
||||||
define get_diff_files
|
define get_diff_files
|
||||||
$(eval DIFF_FILES=$(shell git diff --name-only --diff-filter=ad | grep -E "^(test|cmd|pkg)/.+\.go"))
|
$(eval DIFF_FILES=$(shell git diff --name-only --diff-filter=ad | grep -E "^(test|cmd|pkg)/.+\.go"))
|
||||||
endef
|
endef
|
||||||
@@ -92,7 +97,7 @@ build: fmt
|
|||||||
$(call get_build_flags)
|
$(call get_build_flags)
|
||||||
$(RUN_IN_DOCKER) time go install -ldflags '$(BUILD_FLAG)' $(TRAG.Gopkg)/cmd/...
|
$(RUN_IN_DOCKER) time go install -ldflags '$(BUILD_FLAG)' $(TRAG.Gopkg)/cmd/...
|
||||||
mv ./tmp/bin/cmd ./tmp/bin/$(TRAG.Name)
|
mv ./tmp/bin/cmd ./tmp/bin/$(TRAG.Name)
|
||||||
@docker build -t $(TRAG.Org)/$(TRAG.Name) -f ./Dockerfile.dev ./tmp
|
@docker build -t ${REGISTRY} -f - ./tmp < ./Dockerfile.dev
|
||||||
@docker image prune -f 1>/dev/null 2>&1
|
@docker image prune -f 1>/dev/null 2>&1
|
||||||
@echo "build done"
|
@echo "build done"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||||
docker push kubesphere/ks-apiserver:latest
|
docker push kubespheredev/ks-apiserver:latest
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ func (ctl *ApplicationCtl) ListApplication(runtimeId string, match, fuzzy map[st
|
|||||||
ctl.OpenpitrixAddr = strings.TrimSuffix(ctl.OpenpitrixAddr, "/")
|
ctl.OpenpitrixAddr = strings.TrimSuffix(ctl.OpenpitrixAddr, "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultStatus := "status=active&status=stopped&status=pending&status=ceased"
|
defaultStatus := "status=active&status=stopped&status=pending&status=deleting&status=deleted"
|
||||||
|
|
||||||
url := fmt.Sprintf("%s/v1/clusters?limit=%s&offset=%s", ctl.OpenpitrixAddr, strconv.Itoa(limit), strconv.Itoa(offset))
|
url := fmt.Sprintf("%s/v1/clusters?limit=%s&offset=%s", ctl.OpenpitrixAddr, strconv.Itoa(limit), strconv.Itoa(offset))
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var adminRules = []rbac.PolicyRule{{Verbs: []string{"*"}, APIGroups: []string{"*"}, Resources: []string{"*"}}}
|
var adminRules = []rbac.PolicyRule{{Verbs: []string{"*"}, APIGroups: []string{"*"}, Resources: []string{"*"}}}
|
||||||
var editorRules = []rbac.PolicyRule{{Verbs: []string{"*"}, APIGroups: []string{"", "apps", "extensions", "batch", "kubesphere.io", "account.kubesphere.io"}, Resources: []string{"*"}}}
|
var editorRules = []rbac.PolicyRule{{Verbs: []string{"*"}, APIGroups: []string{"", "apps", "extensions", "batch", "kubesphere.io", "account.kubesphere.io", "autoscaling"}, Resources: []string{"*"}}}
|
||||||
var viewerRules = []rbac.PolicyRule{{Verbs: []string{"list", "get", "watch"}, APIGroups: []string{"", "apps", "extensions", "batch", "kubesphere.io", "account.kubesphere.io"}, Resources: []string{"*"}}}
|
var viewerRules = []rbac.PolicyRule{{Verbs: []string{"list", "get", "watch"}, APIGroups: []string{"", "apps", "extensions", "batch", "kubesphere.io", "account.kubesphere.io"}, Resources: []string{"*"}}}
|
||||||
|
|
||||||
type runTime struct {
|
type runTime struct {
|
||||||
|
|||||||
@@ -51,14 +51,6 @@ const (
|
|||||||
ChannelMaxCapacity = 100
|
ChannelMaxCapacity = 100
|
||||||
)
|
)
|
||||||
|
|
||||||
type PagedFormatedLevelMetric struct {
|
|
||||||
CurrentPage int `json:"page"`
|
|
||||||
TotalPage int `json:"total_page"`
|
|
||||||
TotalItem int `json:"total_item"`
|
|
||||||
Message string `json:"msg"`
|
|
||||||
Metric FormatedLevelMetric `json:"metrics"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FormatedLevelMetric struct {
|
type FormatedLevelMetric struct {
|
||||||
MetricsLevel string `json:"metrics_level"`
|
MetricsLevel string `json:"metrics_level"`
|
||||||
Results []FormatedMetric `json:"results"`
|
Results []FormatedMetric `json:"results"`
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ var RulePromQLTmplMap = MetricMap{
|
|||||||
"cluster_namespace_count": `count(kube_namespace_annotations)`,
|
"cluster_namespace_count": `count(kube_namespace_annotations)`,
|
||||||
|
|
||||||
// cluster_pod_count = cluster_pod_running_count + cluster_pod_succeeded_count + cluster_pod_abnormal_count
|
// cluster_pod_count = cluster_pod_running_count + cluster_pod_succeeded_count + cluster_pod_abnormal_count
|
||||||
"cluster_pod_count": `sum((kube_pod_status_scheduled{condition="true"} > 0) * on (pod) group_left(node) (sum by (node, pod) (kube_pod_info)) unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0))`,
|
"cluster_pod_count": `sum((kube_pod_status_scheduled{condition="true"} > 0) * on (namespace, pod) group_left(node) (sum by (node, namespace, pod) (kube_pod_info)) unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0))`,
|
||||||
"cluster_pod_quota": `sum(kube_node_status_capacity_pods unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0))`,
|
"cluster_pod_quota": `sum(kube_node_status_capacity_pods unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0))`,
|
||||||
"cluster_pod_utilisation": `sum(kube_pod_info unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0)) / sum(kube_node_status_capacity_pods unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0))`,
|
"cluster_pod_utilisation": `sum(kube_pod_info unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0)) / sum(kube_node_status_capacity_pods unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0))`,
|
||||||
"cluster_pod_running_count": `count(kube_pod_info unless on (pod) (kube_pod_status_phase{phase=~"Failed|Pending|Unknown|Succeeded"} > 0) unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0))`,
|
"cluster_pod_running_count": `count(kube_pod_info unless on (pod) (kube_pod_status_phase{phase=~"Failed|Pending|Unknown|Succeeded"} > 0) unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0))`,
|
||||||
@@ -405,7 +405,7 @@ var RulePromQLTmplMap = MetricMap{
|
|||||||
"node_disk_inode_usage": `node:disk_inodes_total:$1 - node:disk_inodes_free:$1`,
|
"node_disk_inode_usage": `node:disk_inodes_total:$1 - node:disk_inodes_free:$1`,
|
||||||
"node_disk_inode_utilisation": `(1 - (node:disk_inodes_free:$1 / node:disk_inodes_total:$1))`,
|
"node_disk_inode_utilisation": `(1 - (node:disk_inodes_free:$1 / node:disk_inodes_total:$1))`,
|
||||||
|
|
||||||
"node_pod_count": `sum by (node) ((kube_pod_status_scheduled{condition="true"} > 0) * on (pod) group_left(node) kube_pod_info$1 unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0))`,
|
"node_pod_count": `sum by (node) ((kube_pod_status_scheduled{condition="true"} > 0) * on (namespace, pod) group_left(node) kube_pod_info$1 unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0))`,
|
||||||
"node_pod_quota": `sum(kube_node_status_capacity_pods$1) by (node) unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0)`,
|
"node_pod_quota": `sum(kube_node_status_capacity_pods$1) by (node) unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0)`,
|
||||||
"node_pod_utilisation": `(sum(kube_pod_info$1) by (node) / sum(kube_node_status_capacity_pods$1) by (node)) unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0)`,
|
"node_pod_utilisation": `(sum(kube_pod_info$1) by (node) / sum(kube_node_status_capacity_pods$1) by (node)) unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0)`,
|
||||||
"node_pod_running_count": `count(kube_pod_info$1 unless on (pod) (kube_pod_status_phase{phase=~"Failed|Pending|Unknown|Succeeded"} > 0)) by (node) unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0)`,
|
"node_pod_running_count": `count(kube_pod_info$1 unless on (pod) (kube_pod_status_phase{phase=~"Failed|Pending|Unknown|Succeeded"} > 0)) by (node) unless on (node) (kube_node_status_condition{condition="Ready",status=~"unknown|false"} > 0)`,
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ func Page(pageNum string, limitNum string, fmtLevelMetric *FormatedLevelMetric,
|
|||||||
}
|
}
|
||||||
// matrix type can not be sorted
|
// matrix type can not be sorted
|
||||||
for _, metricItem := range fmtLevelMetric.Results {
|
for _, metricItem := range fmtLevelMetric.Results {
|
||||||
if metricItem.Data.ResultType != ResultTypeVector {
|
// if metric reterieved field, resultType is ""
|
||||||
|
if metricItem.Data.ResultType == ResultTypeMatrix {
|
||||||
return fmtLevelMetric
|
return fmtLevelMetric
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,12 +234,19 @@ func Page(pageNum string, limitNum string, fmtLevelMetric *FormatedLevelMetric,
|
|||||||
|
|
||||||
allPage := int(math.Ceil(float64(maxLength) / float64(limit)))
|
allPage := int(math.Ceil(float64(maxLength) / float64(limit)))
|
||||||
|
|
||||||
return &PagedFormatedLevelMetric{
|
// add page fields
|
||||||
Message: "paged",
|
return &struct {
|
||||||
TotalPage: allPage,
|
*FormatedLevelMetric
|
||||||
TotalItem: maxLength,
|
CurrentPage int `json:"page"`
|
||||||
CurrentPage: page,
|
TotalPage int `json:"total_page"`
|
||||||
Metric: *fmtLevelMetric,
|
TotalItem int `json:"total_item"`
|
||||||
|
Message string `json:"msg"`
|
||||||
|
}{
|
||||||
|
FormatedLevelMetric: fmtLevelMetric,
|
||||||
|
CurrentPage: page,
|
||||||
|
TotalItem: maxLength,
|
||||||
|
TotalPage: allPage,
|
||||||
|
Message: "paged",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user