Skip to content

Commit

Permalink
Merge pull request #7725 from stubenhuang/issue-ipv6-7544
Browse files Browse the repository at this point in the history
feat: 蓝盾网关支持IPV6 #7544
  • Loading branch information
irwinsun authored Sep 27, 2022
2 parents 1a0642a + e08e2c9 commit 6ad53fb
Show file tree
Hide file tree
Showing 13 changed files with 198 additions and 185 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ helm-charts/core/ci/build/values.json
helm-charts/core/ci/values.yaml
helm-charts/core/ci/templates/configmap/tpl/
docker-images/core/ci/ci
docker-images/core/ci/ci-docker
docker-images/core/ci/*.gz

#turbo 忽略文件
Expand Down
2 changes: 2 additions & 0 deletions helm-charts/core/ci/build_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@
'bkCiDocsUrl': 'https://bk.tencent.com/docs/markdown/持续集成平台/产品白皮书',
'bkCiArtifactoryRealm': 'local',
'bkRepoHost': 'repo.demo.com',
'bkRepoFqdn': 'repo.demo.com',
'bkRepoGatewayIp': '127.0.0.1',
'bkCiStreamScmType': 'CODE_GIT',
'bkCiStreamUrl': 'devops.example.com',
'bkCiStreamHost': 'devops.example.com',
'bkCiStreamGitUrl': 'www.github.com',
'bkCiClusterTag': 'devops',
'bkCiRepositoryGithubServer':'repository',
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/core/ci/templates/artifactory/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ spec:
subPathExpr: bkci/jvm/$(POD_NAME)
volumes:
- name: storage
{{- if .Values.persistence.enabled }}
{{- if and .Values.persistence.enabled (eq .Values.config.bkCiArtifactoryRealm "local") }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "bkci.names.fullname" . }}-storage{{- end }}
{{- else }}
Expand Down
240 changes: 120 additions & 120 deletions helm-charts/core/ci/templates/stream/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,120 +1,120 @@
#stream Deployment
{{ if .Values.stream.enabled -}}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "bkci.names.fullname" . }}-stream
labels: {{- include "bkci.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
app.kubernetes.io/component: microservice
app.kubernetes.io/name: stream
spec:
selector:
matchLabels: {{- include "bkci.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: microservice
app.kubernetes.io/name: stream
{{- if not .Values.stream.autoscaling.enabled }}
replicas: {{ .Values.stream.replicas }}
{{- end }}
template:
metadata:
labels: {{- include "bkci.labels.standard" . | nindent 8 }}
{{- if .Values.stream.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.stream.podLabels "context" $) | nindent 8 }}
{{- end }}
app.kubernetes.io/component: microservice
app.kubernetes.io/name: stream
spec:
serviceAccountName: {{ .Values.rbac.serviceAccount }}
{{- if .Values.stream.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.stream.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.stream.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.stream.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.stream.podAffinityPreset "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.stream.podAntiAffinityPreset "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.stream.nodeAffinityPreset.type "key" .Values.stream.nodeAffinityPreset.key "values" .Values.stream.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.stream.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.stream.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.stream.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.stream.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.stream.priorityClassName }}
priorityClassName: {{ .Values.stream.priorityClassName | quote }}
{{- end }}
{{- if .Values.stream.podSecurityContext.enabled }}
securityContext: {{- omit .Values.stream.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: stream
image: {{ include "common.images.image" ( dict "imageRoot" .Values.backendImage "global" $) }}
imagePullPolicy: {{ .Values.backendImage.pullPolicy }}
{{- if .Values.stream.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.stream.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.stream.resources }}
resources: {{- toYaml .Values.stream.resources | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 80
env:
- name: MS_NAME
value: stream
- name: NAMESPACE
value: {{ .Release.Namespace }}
- name: RELEASE_NAME
value: {{ .Release.Name }}
- name: CHART_NAME
value: {{ .Chart.Name }}
- name: MULTI_CLUSTER
value: {{ .Values.multiCluster.enabled | quote }}
- name: DEFAULT_NAMESPACE
value: {{ .Values.multiCluster.defaultNamespace }}
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
workingDir: /data/workspace/stream
{{ if .Values.entrypoint.override }}
command:
- "/bin/bash"
- "-c"
- |
cp /data/workspace/backend.bkci.sh .;
/bin/bash backend.bkci.sh;
{{ end }}
livenessProbe:
httpGet:
path: /management/health/livenessState
port: http
initialDelaySeconds: 90
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 5
successThreshold: 1
readinessProbe:
httpGet:
path: /management/health/readinessState
port: http
initialDelaySeconds: 60
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 5
successThreshold: 1
volumeMounts:
- mountPath: /data/workspace/stream/jvm
name: log-volume
subPathExpr: bkci/jvm/$(POD_NAME)
volumes:
- hostPath:
path: /data
name: log-volume
{{- end -}}
#stream Deployment
{{ if .Values.stream.enabled -}}
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "bkci.names.fullname" . }}-stream
labels: {{- include "bkci.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
app.kubernetes.io/component: microservice
app.kubernetes.io/name: stream
spec:
selector:
matchLabels: {{- include "bkci.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: microservice
app.kubernetes.io/name: stream
{{- if not .Values.stream.autoscaling.enabled }}
replicas: {{ .Values.stream.replicas }}
{{- end }}
template:
metadata:
labels: {{- include "bkci.labels.standard" . | nindent 8 }}
{{- if .Values.stream.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.stream.podLabels "context" $) | nindent 8 }}
{{- end }}
app.kubernetes.io/component: microservice
app.kubernetes.io/name: stream
spec:
serviceAccountName: {{ .Values.rbac.serviceAccount }}
{{- if .Values.stream.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.stream.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.stream.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.stream.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.stream.podAffinityPreset "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.stream.podAntiAffinityPreset "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.stream.nodeAffinityPreset.type "key" .Values.stream.nodeAffinityPreset.key "values" .Values.stream.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.stream.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.stream.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.stream.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.stream.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.stream.priorityClassName }}
priorityClassName: {{ .Values.stream.priorityClassName | quote }}
{{- end }}
{{- if .Values.stream.podSecurityContext.enabled }}
securityContext: {{- omit .Values.stream.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: stream
image: {{ include "common.images.image" ( dict "imageRoot" .Values.backendImage "global" $) }}
imagePullPolicy: {{ .Values.backendImage.pullPolicy }}
{{- if .Values.stream.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.stream.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.stream.resources }}
resources: {{- toYaml .Values.stream.resources | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 80
env:
- name: MS_NAME
value: stream
- name: NAMESPACE
value: {{ .Release.Namespace }}
- name: RELEASE_NAME
value: {{ .Release.Name }}
- name: CHART_NAME
value: {{ .Chart.Name }}
- name: MULTI_CLUSTER
value: {{ .Values.multiCluster.enabled | quote }}
- name: DEFAULT_NAMESPACE
value: {{ .Values.multiCluster.defaultNamespace }}
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
workingDir: /data/workspace/stream
{{ if .Values.entrypoint.override }}
command:
- "/bin/bash"
- "-c"
- |
cp /data/workspace/backend.bkci.sh .;
/bin/bash backend.bkci.sh;
{{ end }}
livenessProbe:
httpGet:
path: /management/health/livenessState
port: http
initialDelaySeconds: 90
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 5
successThreshold: 1
readinessProbe:
httpGet:
path: /management/health/readinessState
port: http
initialDelaySeconds: 60
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 5
successThreshold: 1
volumeMounts:
- mountPath: /data/workspace/stream/jvm
name: log-volume
subPathExpr: bkci/jvm/$(POD_NAME)
volumes:
- hostPath:
path: /data
name: log-volume
{{- end -}}
76 changes: 38 additions & 38 deletions helm-charts/core/ci/templates/stream/hpa.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
# stream hpa
{{ if .Values.stream.enabled -}}
{{ if .Values.stream.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "bkci.names.fullname" . }}-stream
labels: {{- include "bkci.labels.standard" . | nindent 4 }}
app.kubernetes.io/name: stream
app.kubernetes.io/component: microservice
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "bkci.names.fullname" . }}-stream
minReplicas: {{ .Values.stream.autoscaling.minReplicas }}
maxReplicas: {{ .Values.stream.autoscaling.maxReplicas }}
metrics:
{{- if .Values.stream.autoscaling.targetCPU }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.stream.autoscaling.targetCPU }}
{{- end }}
{{- if .Values.stream.autoscaling.targetMemory }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.stream.autoscaling.targetMemory }}
{{- end }}
{{- end }}
{{- end -}}
# stream hpa
{{ if .Values.stream.enabled -}}
{{ if .Values.stream.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "bkci.names.fullname" . }}-stream
labels: {{- include "bkci.labels.standard" . | nindent 4 }}
app.kubernetes.io/name: stream
app.kubernetes.io/component: microservice
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
scaleTargetRef:
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
name: {{ include "bkci.names.fullname" . }}-stream
minReplicas: {{ .Values.stream.autoscaling.minReplicas }}
maxReplicas: {{ .Values.stream.autoscaling.maxReplicas }}
metrics:
{{- if .Values.stream.autoscaling.targetCPU }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.stream.autoscaling.targetCPU }}
{{- end }}
{{- if .Values.stream.autoscaling.targetMemory }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.stream.autoscaling.targetMemory }}
{{- end }}
{{- end }}
{{- end -}}
50 changes: 25 additions & 25 deletions helm-charts/core/ci/templates/stream/service.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{{ if .Values.stream.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "bkci.names.fullname" . }}-stream
labels: {{- include "bkci.labels.standard" . | nindent 4 }}
app.kubernetes.io/name: stream
app.kubernetes.io/component: microservice
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
type: ClusterIP
selector: {{- include "bkci.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: microservice
app.kubernetes.io/name: stream
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP
{{- end -}}
{{ if .Values.stream.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "bkci.names.fullname" . }}-stream
labels: {{- include "bkci.labels.standard" . | nindent 4 }}
app.kubernetes.io/name: stream
app.kubernetes.io/component: microservice
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
spec:
type: ClusterIP
selector: {{- include "bkci.labels.matchLabels" . | nindent 4 }}
app.kubernetes.io/component: microservice
app.kubernetes.io/name: stream
ports:
- name: http
port: 80
targetPort: 80
protocol: TCP
{{- end -}}
Loading

0 comments on commit 6ad53fb

Please sign in to comment.