Closed Euthpic closed 2 years ago
我们部署的时候也是有这个问题,但是我修改了默认的配置,关闭掉ldap相关的就可以了呀 在这里 https://github.com/didi/LogiKM/blob/master/container/helm/templates/configmap.yaml#L66
这种注入配置的代码方式可以尝试下,不过按照chart template里边的默认配置都是 false,也启动不起来是吗?方便贴下helm get manifest $releaseName
的内容吗
我们部署的时候也是有这个问题,但是我修改了默认的配置,关闭掉ldap相关的就可以了呀 在这里 https://github.com/didi/LogiKM/blob/master/container/helm/templates/configmap.yaml#L66
ldap是关闭的,configmap没有改动.我本地又试了下,spring boot读取这个值似乎没啥问题,可是丢到k8s上跑就出问题了... configmap.yaml:
{{- define "datasource.mysql" -}}
{{- if .Values.mysql.enabled }}
{{- printf "%s-mysql" (include "didi-km.fullname" .) -}}
{{- else -}}
{{- printf "%s" .Values.externalDatabase.host -}}
{{- end -}}
{{- end -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "didi-km.fullname" . }}-configs
labels:
{{- include "didi-km.labels" . | nindent 4 }}
data:
application.yml: |
server:
port: 8080
tomcat:
accept-count: 1000
max-connections: 10000
max-threads: 800
min-spare-threads: 100
spring:
application:
name: kafkamanager
datasource:
kafka-manager:
jdbc-url: jdbc:mysql://{{ include "datasource.mysql" . }}:3306/{{ .Values.mysql.auth.database }}?characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false
username: {{ .Values.mysql.auth.username }}
password: {{ .Values.mysql.auth.password }}
driver-class-name: com.mysql.jdbc.Driver
main:
allow-bean-definition-overriding: true
profiles:
active: dev
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
logging:
config: classpath:logback-spring.xml
custom:
idc: cn
jmx:
max-conn: 20
store-metrics-task:
community:
broker-metrics-enabled: true
topic-metrics-enabled: true
didi:
app-topic-metrics-enabled: false
topic-request-time-metrics-enabled: false
topic-throttled-metrics: false
save-days: 7
# 任务相关的开关
task:
op:
sync-topic-enabled: false # 未落盘的Topic定期同步到DB中
account:
# ldap settings
ldap:
enabled: false
authUserRegistration: false
kcm:
enabled: false
storage:
base-url: http://127.0.0.1
n9e:
base-url: http://127.0.0.1:8004
user-token: 12345678
timeout: 300
account: root
script-file: kcm_script.sh
monitor:
enabled: false
n9e:
nid: 2
user-token: 1234567890
mon:
base-url: http://127.0.0.1:8032
sink:
base-url: http://127.0.0.1:8006
rdb:
base-url: http://127.0.0.1:80
notify:
kafka:
cluster-id: 95
topic-name: didi-kafka-notify
order:
detail-url: http://127.0.0.1
values.yaml改了ingress和imagePullSecrets,不过应该没影响吧.
# Default values for didi-km.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
repository: docker.io/fengxsong/logi-kafka-manager
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "v2.4.2"
imagePullSecrets: [{name: xxx.com.cn}]
nameOverride: ""
# fullnameOverride must set same as release name
fullnameOverride: "km"
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
port: 8080
ingress:
enabled: true
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: xxx.com.cn
paths: [{/}]
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
resources:
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
limits:
cpu: 500m
memory: 2048Mi
requests:
cpu: 100m
memory: 200Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80
nodeSelector: {}
tolerations: []
affinity: {}
# more configurations are set with configmap in file template/configmap.yaml
externalDatabase:
host: ""
mysql:
# if enabled is set to false, then you should manually specified externalDatabase.host
enabled: true
architecture: standalone
auth:
rootPassword: "s3cretR00t"
database: "logi_kafka_manager"
username: "logi_kafka_manager"
password: "n0tp@55w0rd"
我们部署的时候也是有这个问题,但是我修改了默认的配置,关闭掉ldap相关的就可以了呀 在这里 https://github.com/didi/LogiKM/blob/master/container/helm/templates/configmap.yaml#L66
这种注入配置的代码方式可以尝试下,不过按照chart template里边的默认配置都是 false,也启动不起来是吗?方便贴下
helm get manifest $releaseName
的内容吗
问题定位到了,accountLdapEnabled的类型是Boolean,authUserRegistration的类型是boolean,spring在启动时只尝试注入了authUserRegistration,没有用到accountLdapEnabled,所以报错只提及了authUserRegistration.可是如果启动后尝试去读取accountLdapEnabled的值,也会报空指针(只不过这个报错不是在启动阶段,所以不会导致启动失败). 似乎km从头到尾都没有正确获取到ldap的配置.
建议修改authUserRegistration的类型:
//ldap自动注册是否开启
@Value(value = "${account.ldap.auth-user-registration:}")
private Boolean authUserRegistration;
我们部署的时候也是有这个问题,但是我修改了默认的配置,关闭掉ldap相关的就可以了呀 在这里 https://github.com/didi/LogiKM/blob/master/container/helm/templates/configmap.yaml#L66 这种注入配置的代码方式可以尝试下,不过按照chart template里边的默认配置都是 false,也启动不起来是吗?方便贴下
helm get manifest $releaseName
的内容吗问题定位到了,accountLdapEnabled的类型是Boolean,authUserRegistration的类型是boolean,spring在启动时只尝试注入了authUserRegistration,没有用到accountLdapEnabled,所以报错只提及了authUserRegistration.可是如果启动后尝试去读取accountLdapEnabled的值,也会报空指针(只不过这个报错不是在启动阶段,所以不会导致启动失败). 似乎km从头到尾都没有正确获取到ldap的配置.
建议修改authUserRegistration的类型:
//ldap自动注册是否开启 @Value(value = "${account.ldap.auth-user-registration:}") private Boolean authUserRegistration;
老哥,方便的话,辛苦提个PR
这是来自QQ邮箱的假期自动回复邮件。 您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。
如何复现? 使用container目录下的helm部署(仅改动了ingress和imagePullSecrets配置).
错误提示:
改进意见: 参照 https://stackoverflow.com/questions/13585259/evaluating-spring-value-annotation-as-primitive-boolean 和 https://stackoverflow.com/questions/42733067/spring-value-typemismatchexceptionfailed-to-convert-value-of-type-java-lang-s 可能是BaseSessionSignOn里通过@Value注入布尔值失败了
可以尝试下这么改:
环境依赖: k8s -> v1.18.4-tke.6 helm -> v3.5.1