Skip to content

Commit

Permalink
Merge remote-tracking branch 'github-bk-bcs/master'
Browse files Browse the repository at this point in the history
* github-bk-bcs/master:
  fix: 去除4个系统目录的限制--bug=126632037 (#3328)
  chore: use underline for app_code (#3335)
  fix: 批量删除配置模版文件交互优化--bug=126772465 (#3334)
  feat: 全局配置title/footer/logo/favicon/产品名称可修改 --story=118043756 (#3323)
  feat: add BKSharedResBaseJSURL conf (#3331)
  feat: bscp支持应用配置总数及模版套餐下模版数总数限制--  story=118111438 (#3318)
  fix: 修复新增master kubelet不会开机启动的问题 (#3332)
  fix: 前端判断版本名称重复 (#3327)
  fix: 配置模板添加元数据查看态和编辑态 (#3329)
  fead: feed server新增http/https协议 (#3288)
  fix: 未指定套餐支持绝对路径搜索 (#3330)
  feat: 配置模板新增查看态接口以及脚本管理功能优化 (#3324)
  feat: 检测服务下版本名称是否存在 (#3326)
  fix: 所有配置文件都支持绝对路径搜索以及修复导入历史版本时提示模板不存在 (#3320)
  fix:  配置文件查看态体验问题修复 --bug=126418489  (#3325)
  fix: 配置示例切换服务,模板服务名称不更新问题;2.打包map警告问题 --bug=126563845 (#3322)
  feat: 模板文件yaml 转表单,yaml 语法错误提示行数 (#3291)
  fix: 配置示例bug修复和其他调整 (#3319)
  fix: 脚本管理功能优化--bug=126439235  (#3316)
  docs: 更新规范文档/新增github action规范PR格式 (#3313)
  feat: K8S原生集群增加1.27.15 和1.28.11版本 (#3312)
  fix: 配置文件查看态体验优化--bug=126418489 (#3314)
  fix: 修复配置模版文件没有按照预期效果排序 (#3311)
  • Loading branch information
wenxinlee2015 committed Jul 4, 2024
2 parents 8656256 + 201b02c commit 9e09b59
Show file tree
Hide file tree
Showing 122 changed files with 13,891 additions and 10,272 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: pr-lint
on: [pull_request]
jobs:
PR-format-check:
runs-on: ubuntu-latest
steps:
- name: Check PR naming convention
run: |
title="${{ github.event.pull_request.title }}"
pattern="^(feat|fix|docs|style|refactor|perf|test|chore|revert|build|ci): .*"
if [[ ! $title =~ $pattern ]]; then
echo "PR title does not match naming convention. Example: 'feat: 添加新功能'.\
You can refer to this address for details:\
https://github.com/TencentBlueKing/bk-bcs/blob/master/docs/specification/commit-spec.md"
exit 1
fi
60 changes: 60 additions & 0 deletions bcs-ops/env/offline-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,63 @@ bcs-ops:
- hub.bktencent.com/alpine/helm:3.7.2
- hub.bktencent.com/registry.k8s.io/ingress-nginx/controller:v1.3.1
- hub.bktencent.com/registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.3.0

- version: "1.27.15"
bin-tools:
k8s: "1.27.15"
cni-plugins: "1.3.0"
crictl: "1.24.2"
containerd: "1.6.21"
runc: "1.1.8"
jq: "1.6"
yq: "4.30.6"

images:
- hub.bktencent.com/registry.k8s.io/kube-apiserver:v1.27.15
- hub.bktencent.com/registry.k8s.io/kube-controller-manager:v1.27.15
- hub.bktencent.com/registry.k8s.io/kube-scheduler:v1.27.15
- hub.bktencent.com/registry.k8s.io/kube-proxy:v1.27.15
- hub.bktencent.com/registry.k8s.io/pause:3.9
- hub.bktencent.com/registry.k8s.io/etcd:3.5.12-0
- hub.bktencent.com/registry.k8s.io/coredns:v1.10.1
- hub.bktencent.com/library/hello-world:latest
- hub.bktencent.com/flannel/flannel-cni-plugin:v1.1.2
- hub.bktencent.com/flannel/flannel:v0.22.0
- hub.bktencent.com/k8s.gcr.io/sig-storage/local-volume-provisioner:v2.4.0
- hub.bktencent.com/registry.k8s.io/metrics-server/metrics-server:v0.6.3
- hub.bktencent.com/registry.k8s.io/multus-cni:snapshot
- hub.bktencent.com/registry.k8s.io/kube-vip:v0.5.12
- hub.bktencent.com/blueking/bcs-apiserver-proxy:v1.29.0-alpha.130-tencent
- hub.bktencent.com/alpine/helm:3.7.2
- hub.bktencent.com/registry.k8s.io/ingress-nginx/controller:v1.3.1
- hub.bktencent.com/registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.3.0

- version: "1.28.11"
bin-tools:
k8s: "1.28.11"
cni-plugins: "1.3.0"
crictl: "1.24.2"
containerd: "1.6.21"
runc: "1.1.8"
jq: "1.6"
yq: "4.30.6"

images:
- hub.bktencent.com/registry.k8s.io/kube-apiserver:v1.28.11
- hub.bktencent.com/registry.k8s.io/kube-controller-manager:v1.28.11
- hub.bktencent.com/registry.k8s.io/kube-scheduler:v1.28.11
- hub.bktencent.com/registry.k8s.io/kube-proxy:v1.28.11
- hub.bktencent.com/registry.k8s.io/pause:3.9
- hub.bktencent.com/registry.k8s.io/etcd:3.5.12-0
- hub.bktencent.com/registry.k8s.io/coredns:v1.10.1
- hub.bktencent.com/library/hello-world:latest
- hub.bktencent.com/flannel/flannel-cni-plugin:v1.1.2
- hub.bktencent.com/flannel/flannel:v0.22.0
- hub.bktencent.com/k8s.gcr.io/sig-storage/local-volume-provisioner:v2.4.0
- hub.bktencent.com/registry.k8s.io/metrics-server/metrics-server:v0.6.3
- hub.bktencent.com/registry.k8s.io/multus-cni:snapshot
- hub.bktencent.com/registry.k8s.io/kube-vip:v0.5.12
- hub.bktencent.com/blueking/bcs-apiserver-proxy:v1.29.0-alpha.130-tencent
- hub.bktencent.com/alpine/helm:3.7.2
- hub.bktencent.com/registry.k8s.io/ingress-nginx/controller:v1.3.1
- hub.bktencent.com/registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.3.0
3 changes: 2 additions & 1 deletion bcs-ops/install_master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if [[ -z ${MASTER_JOIN_CMD:-} ]]; then
else
kubeadm init --config="${ROOT_DIR}/kubeadm-config" -v 11 \
|| utils::log "FATAL" "${LAN_IP} failed to join master: ${K8S_CTRL_IP}"
systemctl enable --now kubelet
systemctl enable --now kubelet
fi
install -dv "$HOME/.kube"
install -v -m 600 -o "$(id -u)" -g "$(id -g)" \
Expand Down Expand Up @@ -100,6 +100,7 @@ else
else
kubeadm join --config="${ROOT_DIR}/kubeadm-config" -v 11 \
|| utils::log "FATAL" "${LAN_IP} failed to join master: ${K8S_CTRL_IP}"
systemctl enable --now kubelet
fi
install -dv "$HOME/.kube"
install -v -m 600 -o "$(id -u)" -g "$(id -g)" \
Expand Down
14 changes: 14 additions & 0 deletions bcs-ops/k8s/install_k8s_tools
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ name=Kubernetes
baseurl=${repo_url}
enabled=1
gpgcheck=0
[kubernetes-v1.27]
name=Kubernetes
baseurl=https://mirrors.tencent.com/kubernetes_new/core%3a/stable%3a/v1.27%3a/build/rpm/
enabled=1
gpgcheck=0
[kubernetes-v1.28]
name=Kubernetes
baseurl=https://mirrors.tencent.com/kubernetes_new/core%3a/stable%3a/v1.28%3a/build/rpm/
enabled=1
gpgcheck=0
EOF
yum install -y -q yum-utils
yum-config-manager --add-repo "$ROOT_DIR/kubernetes.repo"
Expand Down Expand Up @@ -218,6 +230,8 @@ main() {
utils::log "INFO" "check kubectl status"
if kubectl version --client --short; then
utils::log "OK" "kubelet install success"
elif kubectl version --client ; then
utils::log "OK" "kubelet install success"
else
utils::log "ERROR" "Did kubectl get installed?"
fi
Expand Down
5 changes: 4 additions & 1 deletion bcs-ops/k8s/render_kubeadm
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,12 @@ main() {
1.2[2-4].*)
kubeadm_tag="v1beta3"
;;
1.2[7-8].*)
kubeadm_tag="v1beta3"
;;
*)
utils::log "FATAL" \
"Only support 1.2[0-4].x, here is :${K8S_VER}"
"Only support 1.2[0-8].x, here is :${K8S_VER}"
;;
esac

Expand Down
2 changes: 1 addition & 1 deletion bcs-ops/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ set +x

## 安装示例

目前仅支持 k8s `1.20.15` (默认), `1.23.17` `1.24.15` 版本。
目前仅支持 k8s `1.20.15` (默认), `1.23.17` , `1.24.15` , `1.27.15`, `1.28.11`版本。

### 集群创建与节点添加

Expand Down
4 changes: 2 additions & 2 deletions bcs-ops/system/config_envfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ EOF
check_env() {
trap "utils::on_ERR;" ERR
# match k8s_ver
if ! [[ $K8S_VER =~ ^1\.2[0-4] ]]; then
if ! [[ $K8S_VER =~ ^1\.2[0-8] ]]; then
utils::log "ERROR" \
"Only support K8S_VER 1.2[0-4].x, here is :${K8S_VER}"
"Only support K8S_VER 1.2[0-8].x, here is :${K8S_VER}"
fi

# match cri and k8s_ver
Expand Down
30 changes: 26 additions & 4 deletions bcs-services/bcs-bscp/cmd/api-server/etc/api_server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,34 @@ repository:
# the password to decrypt the certificate.
password:

# 特性配置
featureFlags:
# 业务展示白名单
BIZ_VIEW:
enabled: false
list:
- "xx"
- "xx"
# 全局默认配置(优先级低于业务级配置),默认为true(展示)
default:
# 业务级配置,默认为空
spec:
"2":
# 业务资源限制
RESOURCE_LIMIT:
# 全局默认配置(优先级低于业务级配置)
default:
# 配置文件大小上限,单位为MB,默认为100MB
maxFileSize:
# 单个app下允许创建的配置数(模版+非模版),默认为2000
appConfigCnt:
# 单个模版套餐下允许创建的模版数,默认为2000
tmplSetTmplCnt:
# 业务级配置,默认为空
spec:
"2":
# 配置文件大小上限,单位为MB
maxFileSize:
# 单个app下允许创建的配置数(模版+非模版)
appConfigCnt:
# 单个模版套餐下允许创建的模版数
tmplSetTmplCnt:

# defines service related settings.
service:
Expand Down
12 changes: 9 additions & 3 deletions bcs-services/bcs-bscp/cmd/api-server/service/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ func FeatureFlagsHandler(w http.ResponseWriter, r *http.Request) {
biz := r.URL.Query().Get("biz")
// set biz_view feature flag
bizViewConf := cc.ApiServer().FeatureFlags.BizView
featureFlags.BizView = bizViewConf.Default
if enable, ok := bizViewConf.Spec[biz]; ok {
featureFlags.BizView = enable
featureFlags.BizView = *bizViewConf.Default
if enable, ok := bizViewConf.Spec[biz]; ok && enable != nil {
featureFlags.BizView = *enable
}
// set biz resource limit
resourceLimitConf := cc.ApiServer().FeatureFlags.ResourceLimit
Expand All @@ -94,6 +94,12 @@ func FeatureFlagsHandler(w http.ResponseWriter, r *http.Request) {
if resource.MaxFileSize != 0 {
featureFlags.ResourceLimit.MaxFileSize = resource.MaxFileSize
}
if resource.AppConfigCnt != 0 {
featureFlags.ResourceLimit.AppConfigCnt = resource.AppConfigCnt
}
if resource.TmplSetTmplCnt != 0 {
featureFlags.ResourceLimit.TmplSetTmplCnt = resource.TmplSetTmplCnt
}
// NOCC:golint/todo(忽略)
// nolint TODO:其他资源限制
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (s *Service) CreateAppTemplateBinding(ctx context.Context, req *pbcs.Create
grpcKit := kit.FromGrpcContext(ctx)

// validate input param
templateSetIDs, templateIDs, err := parseBindings(req.Bindings)
templateSetIDs, _, err := parseBindings(req.Bindings)
if err != nil {
logs.Errorf("create app template binding failed, parse bindings err: %v, rid: %s", err, grpcKit.Rid)
return nil, err
Expand All @@ -49,11 +49,6 @@ func (s *Service) CreateAppTemplateBinding(ctx context.Context, req *pbcs.Create
return nil, fmt.Errorf("repeated template set ids: %v, id must be unique", repeatedTmplSetIDs)
}

if len(templateIDs) > 500 {
return nil, fmt.Errorf("the length of template ids is %d, it must be within the range of [1,500]",
len(templateIDs))
}

res := []*meta.ResourceAttribute{
{Basic: meta.Basic{Type: meta.Biz, Action: meta.FindBusinessResource}, BizID: req.BizId},
{Basic: meta.Basic{Type: meta.App, Action: meta.Update, ResourceID: req.AppId}, BizID: req.BizId},
Expand Down Expand Up @@ -122,7 +117,7 @@ func (s *Service) UpdateAppTemplateBinding(ctx context.Context, req *pbcs.Update
grpcKit := kit.FromGrpcContext(ctx)

// validate input param
templateSetIDs, templateIDs, err := parseBindings(req.Bindings)
templateSetIDs, _, err := parseBindings(req.Bindings)
if err != nil {
logs.Errorf("update app template binding failed, parse bindings err: %v, rid: %s", err, grpcKit.Rid)
return nil, err
Expand All @@ -133,11 +128,6 @@ func (s *Service) UpdateAppTemplateBinding(ctx context.Context, req *pbcs.Update
return nil, fmt.Errorf("repeated template set ids: %v, id must be unique", repeatedTmplSetIDs)
}

if len(templateIDs) > 500 {
return nil, fmt.Errorf("the length of template ids is %d, it must be within the range of [1,500]",
len(templateIDs))
}

res := []*meta.ResourceAttribute{
{Basic: meta.Basic{Type: meta.Biz, Action: meta.FindBusinessResource}, BizID: req.BizId},
{Basic: meta.Basic{Type: meta.App, Action: meta.Update, ResourceID: req.AppId}, BizID: req.BizId},
Expand Down Expand Up @@ -296,9 +286,8 @@ func (s *Service) ListAppBoundTmplRevisions(ctx context.Context, req *pbcs.ListA
TemplateSetId: tmplSet.TemplateSetId,
TemplateSetName: tmplSet.TemplateSetName,
}

revisions := tmplSetMap[tmplSet.TemplateSetId]
// 先按照path+name排序好
// 根据path+name排序
sort.SliceStable(revisions, func(i, j int) bool {
iPath := path.Join(revisions[i].Path, revisions[i].Name)
jPath := path.Join(revisions[j].Path, revisions[j].Name)
Expand Down Expand Up @@ -559,10 +548,6 @@ func (s *Service) UpdateAppBoundTmplRevisions(ctx context.Context, req *pbcs.Upd
if len(repeatedTmplRevisionIDs) > 0 {
return nil, fmt.Errorf("repeated template ids: %v, id must be unique", repeatedTmplRevisionIDs)
}
if len(templateIDs) > 500 {
return nil, fmt.Errorf("the length of template ids is %d, it must be within the range of [1,500]",
len(templateIDs))
}

res := []*meta.ResourceAttribute{
{Basic: meta.Basic{Type: meta.Biz, Action: meta.FindBusinessResource}, BizID: req.BizId},
Expand Down
Loading

0 comments on commit 9e09b59

Please sign in to comment.