Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 前后 label 不一致,导致 label 筛选 core 容器时出现 celery 容器 #168

Open
LiaoSirui opened this issue Nov 15, 2024 · 3 comments

Comments

@LiaoSirui
Copy link

{{- if .Values.core.enabled }}
{{- with .Values.core }}
{{- $fullName := include "jumpserver.fullname" $ }}
{{- $containerName := "jms-celery" }}
{{- $registryName := $.Values.global.imageRegistry | default .image.registry }}
{{- $imageOwner :=  $.Values.global.imageOwner | default "jumpserver" }}
{{- $mysqlPort := printf "%s" (include "jumpserver.magnus.mysql.port" $) }}
{{- $mariadbPort := printf "%s" (include "jumpserver.magnus.mariadb.port" $) }}
{{- $redisPort := printf "%s" (include "jumpserver.magnus.redis.port" $) }}
{{- $sqlserverPort := printf "%s" (include "jumpserver.magnus.sqlserver.port" $) }}
{{- $postgresqlPort := printf "%s" (include "jumpserver.magnus.postgresql.port" $) }}
{{- $oraclePorts := printf "%s" (include "jumpserver.magnus.oracle.ports" $) }}
{{- $imageName := $.Values.xpack.enabled | ternary "core-ee" "core-ce" }}
{{- $imageTag := $.Chart.AppVersion }}
{{- $imageWithTag := printf "%s/%s/%s:%s" $registryName $imageOwner $imageName $imageTag | quote }}

apiVersion: apps/v1
kind: Deployment
metadata:
  name: "{{ $fullName }}-{{ $containerName }}"
  labels:
    app.jumpserver.org/name: {{ $containerName }}
spec:
  replicas: {{ .replicaCount }}
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ include "jumpserver.name" $ }}
      app.kubernetes.io/instance: {{ $.Release.Name }}
      {{- toYaml .labels | nindent 6 }}

由于你顶上引用了 core ,导致下面一个是 jms-celery,另一个是 jms-core

@LiaoSirui
Copy link
Author

同样的情况出现在 Init job zhong

https://github.com/jumpserver/helm-charts/blob/v3/charts/jumpserver/templates/pre-install-initdb.yaml#L1-L27

{{- with .Values.core }}
{{- $fullName := include "jumpserver.fullname" $ }}
{{- $containerName := "jms-init-db" }}
{{- $registryName := $.Values.global.imageRegistry | default .image.registry }}
{{- $imageOwner :=  $.Values.global.imageOwner | default "jumpserver" }}
{{- $imageName := $.Values.xpack.enabled | ternary "core-ee" "core-ce" }}
{{- $imageTag := $.Chart.AppVersion }}
{{- $imageWithTag := printf "%s/%s/%s:%s" $registryName $imageOwner $imageName $imageTag | quote }}

apiVersion: batch/v1
kind: Job
metadata:
  name: "{{ $fullName }}-{{ $containerName }}"
  labels:
    app.jumpserver.org/name: {{ $containerName }}
  annotations:
    "helm.sh/hook": pre-install,pre-upgrade
    "helm.sh/hook-weight": "5"
    "helm.sh/hook-delete-policy": before-hook-creation
spec:
  template:
    metadata:
      labels:
        app.kubernetes.io/name: {{ include "jumpserver.name" $ }}
        app.kubernetes.io/instance: {{ $.Release.Name }}
        {{- toYaml .labels | nindent 8 }}

@wojiushixiaobai
Copy link
Contributor

感谢反馈,我看下要不要单独拆分出来

@LiaoSirui
Copy link
Author

感谢反馈,我看下要不要单独拆分出来

我感觉再单独添加一个标签就好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants