Compare commits

...

23 Commits

Author SHA1 Message Date
zryfish
466c4b6c72 Merge pull request #281 from wansir/v1.0.1
fix hpa permission
2019-01-22 15:32:57 +08:00
zryfish
dfc90814db Merge pull request #246 from carmanzhang/monitor
fixed monitoring bug
2019-01-22 15:32:37 +08:00
hongming
bdd4e3fc27 fix hpa permission
Signed-off-by: hongming <talonwan@yunify.com>
2019-01-22 15:21:17 +08:00
zryfish
62a799ffca Update Makefile 2019-01-21 21:03:41 +08:00
zryfish
4bedf56ce7 Merge pull request #280 from zryfish/change_travis
change registry address
2019-01-21 20:47:08 +08:00
zryfish
9ed6038058 Merge branch 'master' into change_travis 2019-01-21 20:39:38 +08:00
Jeff
da8ffc9474 change registry address 2019-01-21 20:37:25 +08:00
zryfish
c2adbd2a71 Merge pull request #279 from zryfish/change_travis
change dockerhub address
2019-01-21 20:13:08 +08:00
Jeff
948527290c change dockerhub address 2019-01-21 19:59:30 +08:00
zryfish
feecd35b04 Merge pull request #278 from zryfish/change_travis
change travis.yml
2019-01-21 17:49:54 +08:00
Jeff
f97f8a59f9 change travis.yml 2019-01-21 17:37:33 +08:00
zryfish
c81ff737e2 Merge pull request #277 from zryfish/change_dockerhub_repo
change dockerhub repo
2019-01-21 15:27:19 +08:00
jeff
9c23a68128 change dockerhub repo 2019-01-21 15:25:04 +08:00
zryfish
e5d2b72e19 Merge pull request #274 from leoendless/hotfix/applications
fix: Fix application list api
2019-01-21 10:59:27 +08:00
zryfish
21af31b210 Merge pull request #276 from zryfish/change_dockerhub_repo
change dockerhub repo
2019-01-21 10:58:15 +08:00
jeff
5fc6aa52e7 change dockerhub repo 2019-01-21 10:47:34 +08:00
leoendless
f8f960d73b fix: Fix application list api
show deleting and deleted clusters, hide ceased clusters
2019-01-17 16:24:11 +08:00
zryfish
7e72365d86 Merge pull request #270 from zryfish/stale_bot_conf
add stale bot
2019-01-08 15:32:34 +08:00
jeff
b908e97d42 add stale bot 2019-01-08 15:15:43 +08:00
zryfish
7f4bfd4c03 Merge pull request #266 from zryfish/issus_template
add issue template
2019-01-07 12:39:05 +08:00
jeff
bbec5e008d add issue template 2019-01-07 11:42:00 +08:00
Carman Zhang
edc36d6738 optimize page function 2018-12-24 13:13:10 +08:00
Carman Zhang
2366bbf0d7 Bug Fix: fixed pod_name conflict 2018-12-24 13:11:57 +08:00
10 changed files with 90 additions and 29 deletions

16
.github/.stale.yaml vendored Normal file
View 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
View 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.

View File

@@ -1,31 +1,29 @@
sudo: required
services:
- docker
language: go
git:
depth: false
go:
- 1.10
- tip
go_import_path: kubesphere.io/kubesphere
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
- 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:
- dep ensure -v
- docker --version
- dep ensure -v
script:
- make fmt-check && make build
deploy:
skip_cleanup: true
provider: script
script: bash install/scripts/docker_push
on:

View File

@@ -2,6 +2,9 @@
# Use of this source code is governed by a Apache license
# that can be found in the LICENSE file.
# The binary to build
BIN ?= kubesphere
TRAG.Org:=kubesphere
TRAG.Name:=ks-apiserver
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_FILES:=./cmd ./pkg
REGISTRY ?= kubespheredev/ks-apiserver
define get_diff_files
$(eval DIFF_FILES=$(shell git diff --name-only --diff-filter=ad | grep -E "^(test|cmd|pkg)/.+\.go"))
endef
@@ -92,7 +97,7 @@ build: fmt
$(call get_build_flags)
$(RUN_IN_DOCKER) time go install -ldflags '$(BUILD_FLAG)' $(TRAG.Gopkg)/cmd/...
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
@echo "build done"

View File

@@ -1,4 +1,4 @@
#!/bin/bash
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push kubesphere/ks-apiserver:latest
docker push kubespheredev/ks-apiserver:latest

View File

@@ -378,7 +378,7 @@ func (ctl *ApplicationCtl) ListApplication(runtimeId string, match, fuzzy map[st
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))

View File

@@ -57,7 +57,7 @@ const (
)
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{"*"}}}
type runTime struct {

View File

@@ -51,14 +51,6 @@ const (
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 {
MetricsLevel string `json:"metrics_level"`
Results []FormatedMetric `json:"results"`

View File

@@ -330,7 +330,7 @@ var RulePromQLTmplMap = MetricMap{
"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": `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_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))`,
@@ -405,7 +405,7 @@ var RulePromQLTmplMap = MetricMap{
"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_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_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)`,

View File

@@ -176,7 +176,8 @@ func Page(pageNum string, limitNum string, fmtLevelMetric *FormatedLevelMetric,
}
// matrix type can not be sorted
for _, metricItem := range fmtLevelMetric.Results {
if metricItem.Data.ResultType != ResultTypeVector {
// if metric reterieved field, resultType is ""
if metricItem.Data.ResultType == ResultTypeMatrix {
return fmtLevelMetric
}
}
@@ -233,12 +234,19 @@ func Page(pageNum string, limitNum string, fmtLevelMetric *FormatedLevelMetric,
allPage := int(math.Ceil(float64(maxLength) / float64(limit)))
return &PagedFormatedLevelMetric{
Message: "paged",
TotalPage: allPage,
TotalItem: maxLength,
CurrentPage: page,
Metric: *fmtLevelMetric,
// add page fields
return &struct {
*FormatedLevelMetric
CurrentPage int `json:"page"`
TotalPage int `json:"total_page"`
TotalItem int `json:"total_item"`
Message string `json:"msg"`
}{
FormatedLevelMetric: fmtLevelMetric,
CurrentPage: page,
TotalItem: maxLength,
TotalPage: allPage,
Message: "paged",
}
}