Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…o issue_11186
  • Loading branch information
useryuyu committed Nov 20, 2024
2 parents fc2b6ca + c4af3cb commit ee247ed
Show file tree
Hide file tree
Showing 144 changed files with 4,373 additions and 1,660 deletions.
30 changes: 0 additions & 30 deletions helm-charts/core/ci/Chart.lock

This file was deleted.

50 changes: 25 additions & 25 deletions helm-charts/core/ci/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@ home: "https://github.com/Tencent/bk-ci"

dependencies:
- name: common
version: 1.10.0
repository: https://charts.bitnami.com/bitnami
version: 2.19.1
- condition: mysql.enabled
name: mysql
repository: https://charts.bitnami.com/bitnami
version: 10.3.0
- condition: redis.enabled
name: redis
repository: https://charts.bitnami.com/bitnami
version: 16.13.2
- condition: elasticsearch.enabled
name: elasticsearch
repository: https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
- name: mysql
version: 8.8.3
repository: https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
condition: mysql.enabled
- name: redis
version: 15.3.3
repository: https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
condition: redis.enabled
- name: elasticsearch
version: 17.5.4
- condition: rabbitmq.enabled
name: rabbitmq
repository: https://charts.bitnami.com/bitnami
version: 10.3.9
- condition: influxdb.enabled
name: influxdb
repository: https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
condition: elasticsearch.enabled
- name: rabbitmq
version: 8.20.1
repository: https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
condition: rabbitmq.enabled
- name: influxdb
version: 5.3.1
- condition: nginx-ingress-controller.enabled
name: nginx-ingress-controller
repository: https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
condition: influxdb.enabled
- name: nginx-ingress-controller
version: 7.6.21
- condition: mongodb.enabled
name: mongodb
repository: https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
condition: nginx-ingress-controller.enabled
- name: mongodb
version: 10.30.6
repository: https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
condition: mongodb.enabled
- name: kubernetes-manager
- condition: kubernetes-manager.enabled
name: kubernetes-manager
repository: file://./local_chart/kubernetes-management
version: 0.0.45
repository: "file://./local_chart/kubernetes-management"
condition: kubernetes-manager.enabled
2 changes: 1 addition & 1 deletion helm-charts/core/ci/base/default_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ bkCiIamCallbackUser: bk_iam
bkCiAppCode: bk_ci
bkCiNotifyWeworkSendChannel: weworkAgent
bkCiInfluxdbDb: agentMetrix
bkCiDocsUrl: https://bk.tencent.com
bkCiDocsUrl: https://bk.tencent.com/docs
bkCiArtifactoryRealm: local
bkRepoHost: repo.demo.com
bkRepoFqdn: repo.demo.com
Expand Down
17 changes: 11 additions & 6 deletions helm-charts/core/ci/base/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ init:
iam: true
turbo: false
bkrepo: true
defaultImage: true
defaultImage:
enabled: true
image:
registry: registry-1.docker.io/bkci
repository: ci
tag: latest
plugin:
enabled: false
atoms:
Expand Down Expand Up @@ -111,7 +116,7 @@ multiCluster:
# 内部数据源配置
mysql:
image:
tag: 5.7.26
tag: 8.0.37-debian-12-r2
enabled: true
auth:
# 修改此选项必须删除mysql的pvc , 否则会创建mysql失败
Expand Down Expand Up @@ -174,15 +179,15 @@ elasticsearch:
rabbitmq:
enabled: true
image:
registry: docker.io/bkci
repository: rabbitmq-with-delay
tag: 0.0.1
repository: bitnami/rabbitmq
tag: 3.10.8-debian-11-r4
persistence:
size: 10Gi
auth:
username: admin
password: blueking
erlangCookie: blueking # 修改此选项必须删除rabbitmq的pvc , 否则会创建rabbitmq失败
communityPlugins: "https://bkopen-1252002024.file.myqcloud.com/ce7/files/rabbitmq_delayed_message_exchange-3.10.2.ez"
extraPlugins: "rabbitmq_delayed_message_exchange"
extraConfiguration: |-
# ipv6 , 需要开启这些选项
Expand Down Expand Up @@ -293,7 +298,7 @@ kubernetes-manager:
enabled: true
nameOverride: kubernetes-manager-mysql
image:
tag: 5.7.26
tag: 8.0.37-debian-12-r2
auth:
# 修改此选项必须删除mysql的pvc , 否则会创建mysql失败
rootPassword: blueking
Expand Down
3 changes: 3 additions & 0 deletions helm-charts/core/ci/build_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,6 @@
default_value = '80'
value = str(default_value_dict.get(camelize, default_value))
value_file.write(' '+camelize+': '+value+'\n')

# 更新依赖
os.system("/bin/bash -c ./dependencyBuild.sh")
Binary file removed helm-charts/core/ci/charts/common-1.10.0.tgz
Binary file not shown.
Binary file removed helm-charts/core/ci/charts/elasticsearch-17.5.4.tgz
Binary file not shown.
Binary file removed helm-charts/core/ci/charts/influxdb-5.3.1.tgz
Binary file not shown.
Binary file not shown.
Binary file removed helm-charts/core/ci/charts/mongodb-10.30.6.tgz
Binary file not shown.
Binary file removed helm-charts/core/ci/charts/mysql-8.8.3.tgz
Binary file not shown.
Binary file not shown.
Binary file removed helm-charts/core/ci/charts/rabbitmq-8.20.1.tgz
Binary file not shown.
Binary file removed helm-charts/core/ci/charts/redis-15.3.3.tgz
Binary file not shown.
13 changes: 13 additions & 0 deletions helm-charts/core/ci/dependencyBuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# 先处理kubernetes-manager的chart
echo "update kubernetes-management dependencies"
cd local_chart/kubernetes-management
rm -f Chart.lock
helm dependency build
cd ../..

# 再处理根chart
echo "update root dependencies"
rm -f Chart.lock
helm dependency build

This file was deleted.

16 changes: 8 additions & 8 deletions helm-charts/core/ci/local_chart/kubernetes-management/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ appVersion: 0.0.31
home: https://github.com/Tencent/bk-ci

dependencies:
- name: mysql
version: 8.8.3
repository: https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
condition: mysql.enabled
- name: redis
version: 15.3.3
repository: https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami
condition: redis.enabled
- condition: mysql.enabled
name: mysql
repository: https://charts.bitnami.com/bitnami
version: 10.3.0
- condition: redis.enabled
name: redis
repository: https://charts.bitnami.com/bitnami
version: 16.13.2
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
{{- end }}
initContainers:
- name: wait-for-mysql
image: {{ .Values.kubernetesManager.image }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.backendImage "global" .Values.global) }}
imagePullPolicy: {{ .Values.backendImage.pullPolicy }}
command:
- "/bin/sh"
Expand All @@ -52,7 +52,7 @@ spec:
sleep 60s;
containers:
- name: kubernetes-manager
image: {{ .Values.kubernetesManager.image }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.backendImage "global" .Values.global) }}
imagePullPolicy: {{ .Values.backendImage.pullPolicy }}
{{- if .Values.kubernetesManager.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.kubernetesManager.containerSecurityContext "enabled" | toYaml | nindent 12 }}
Expand Down Expand Up @@ -109,7 +109,7 @@ spec:
{{- end}}
{{- if .Values.kubernetesManager.docker.enable }}
- name: kuberentes-manager-docker
image: {{ .Values.kubernetesManager.docker.image }}
image: "{{ .Values.kubernetesManager.docker.image.registry }}/{{ .Values.kubernetesManager.docker.image.repository }}:{{ .Values.kubernetesManager.docker.image.tag }}"
command: ["dockerd", "--host", "tcp://localhost:2375"]
{{- if .Values.kubernetesManager.docker.resources }}
resources: {{- toYaml .Values.kubernetesManager.docker.resources | nindent 12 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
{{- if .Values.mysql.enabled }}
initContainers:
- name: wait-for-mysql
image: {{ .Values.kubernetesManager.image }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.backendImage "global" .Values.global) }}
imagePullPolicy: {{ .Values.backendImage.pullPolicy }}
command:
- "/bin/sh"
Expand All @@ -34,7 +34,7 @@ spec:
{{- end }}
containers:
- name: init-sql
image: {{ .Values.kubernetesManager.image }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.backendImage "global" .Values.global) }}
imagePullPolicy: {{ .Values.backendImage.pullPolicy }}
workingDir: /data/workspace/support-files/sql
{{ $mysqlData := split ":" (include "bkci.mysqlAddr" .) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ data:
deploymentReplicas: 2
# deployment配置
buildlessDeployment:
image: bkci/ci:latest
image: {{ include "common.images.image" ( dict "imageRoot" .Values.kubernetesManager.buildlessDeployment.image "global" .Values.global) }}
replicas: 2
volume:
# 构建机脚本
Expand All @@ -119,7 +119,7 @@ data:
logPath: /data/devops/logs
builderConfigMapPath: /data/devops/config
buildAndPushImage:
image: {{ .Values.kubernetesManager.buildAndPushImage.image }}
image: {{ include "common.images.image" ( dict "imageRoot" .Values.kubernetesManager.buildAndPushImage.image "global" .Values.global) }}
# 拉取kaniko需要的凭据,如果不填视为没有
pullImageRegistry:
server: {{ .Values.kubernetesManager.buildAndPushImage.server }}
Expand Down
27 changes: 22 additions & 5 deletions helm-charts/core/ci/local_chart/kubernetes-management/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ multiCluster:
# 镜像配置
backendImage:
pullPolicy: IfNotPresent
registry: registry-1.docker.io/bkci
repository: bkci-kubernetes-manager
tag: 0.0.32
pullPolicy: IfNotPresent
pullSecrets: []

# 内部数据源配置
mysql:
enabled: true
image:
tag: 5.7.26
tag: 8.0.37-debian-12-r2
auth:
# 修改此选项必须删除mysql的pvc , 否则会创建mysql失败
rootPassword: blueking
Expand Down Expand Up @@ -120,8 +125,6 @@ kubernetesManager:
maxReplicas: 3
targetCPU: 80
targetMemory: 80
# 使用的镜像
image: bkci/bkci-kubernetes-manager:0.0.32
# 决定每次helm部署时的构建机所在的命名空间,同时dockerInitSh也在那里,为空时默认为 {{ .Release.Namespace }}
builderNamespace:
redis:
Expand All @@ -136,12 +139,23 @@ kubernetesManager:
prometheusUrl:
# 构建并推送镜像相关
buildAndPushImage:
image: gcr.io/kaniko-project/executor:v1.9.0
# gcr.io/kaniko-project/executor:v1.9.0
image:
registry: gcr.io
repository: kaniko-project/executor
tag: v1.9.0
# 拉取kaniko需要的凭据,如果不填视为没有
pullImageRegistry:
server:
username:
password:
# 无编译构建机
buildlessDeployment:
# bkci/ci:latest
image:
registry: registry-1.docker.io/bkci
repository: ci
tag: latest
apiserver:
auth:
# 针对蓝盾流水线访问的超级权限token
Expand All @@ -156,7 +170,10 @@ kubernetesManager:
# manager使用docker相关配置,会启用特权模式容器
docker:
enable: false
image: docker:24.0.1-dind
image:
registry: registry-1.docker.io
repository: docker
tag: 24.0.1-dind
resources:
requests:
cpu: 50m
Expand Down
2 changes: 2 additions & 0 deletions helm-charts/core/ci/templates/configmap/stream-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#stream configmap
{{ if .Values.configmap.enabled -}}
{{ if .Values.stream.enabled -}}
kind: ConfigMap
apiVersion: v1
metadata:
Expand All @@ -16,3 +17,4 @@ data:
application.yml: |-
{{- include "bkci.stream.yaml" . | nindent 4 -}}
{{- end -}}
{{- end -}}
4 changes: 2 additions & 2 deletions helm-charts/core/ci/templates/init/init.defaultImages.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 初始化构建镜像
{{ if .Values.init.defaultImage }}
{{ if .Values.init.defaultImage.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
Expand Down Expand Up @@ -37,6 +37,6 @@ spec:
done
echo "{{ include "bkci.names.fullname" . }}-store is available";
curl "http://{{ include "bkci.names.fullname" . }}-store.{{ .Release.Namespace }}.svc.cluster.local/api/op/market/image/init" -X POST
curl "http://{{ include "bkci.names.fullname" . }}-store.{{ .Release.Namespace }}.svc.cluster.local/api/op/market/image/init" -X POST -d '{"imageRepoName":"{{ .Values.init.defaultImage.image.registry }}/{{ .Values.init.defaultImage.image.repository }}" , "imageTag":"{{ .Values.init.defaultImage.image.tag }}"}'
restartPolicy: OnFailure
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import javax.ws.rs.POST
import javax.ws.rs.Path
import javax.ws.rs.PathParam
import javax.ws.rs.Produces
import javax.ws.rs.QueryParam
import javax.ws.rs.core.MediaType

@Tag(name = "SERVICE_ARTIFACTORY_BKREPO", description = "仓库-BkRepo")
Expand All @@ -57,4 +58,19 @@ interface ServiceBkRepoResource {
@PathParam("projectId")
projectId: String
): Result<Boolean>

@Operation(summary = "同步bkrepo项目状态")
@Path("/{projectId}/enableProject")
@POST
fun enableProject(
@Parameter(description = "用户ID", required = true)
@HeaderParam(AUTH_HEADER_USER_ID)
userId: String,
@Parameter(description = "项目ID", required = true)
@PathParam("projectId")
projectId: String,
@Parameter(description = "压缩高度", required = true)
@QueryParam("enabled")
enabled: Boolean
): Result<Boolean>
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies {
api(project(":core:artifactory:model-artifactory"))
api(project(":core:project:api-project"))
api(project(":core:process:api-process"))
api(project(":core:auth:api-auth"))
api("com.tencent.bk.repo:api-generic")
api("com.amazonaws:aws-java-sdk-s3")
api("net.coobird:thumbnailator")
Expand Down
Loading

0 comments on commit ee247ed

Please sign in to comment.