我正在部署一个 Spring Boot 3 应用程序,该应用程序严重依赖于
@Cacheable
注释,并且必须使用 Data Grid 8.4 (Infinispan 14) 作为分布式缓存来适应 Spring 集群。
安装基于我客户的 IT 服务安装的操作员。
我的目标是定义一个在Infinispan服务器和Spring Boot客户端中配置的技术帐户,以便与Hot Rod客户端连接
爆炸(不介意明文密码)
---
# Source: ipe-cache/templates/config.yaml
#Role application
apiVersion: v1
kind: Secret
type: Opaque
stringData:
user: "application"
data:
password: "MzRCRTRKTDVkWU91NnpIWg=="
---
# Source: ipe-cache/templates/config.yaml
# retrieve the secret data using lookup function and when not exists, return an empty dictionary / map as result
# set $jwtSecret to existing secret data or generate a random one when not exists
apiVersion: v1
kind: ConfigMap
data:
infinispan-config.yaml: |-
infinispan:
cacheContainer:
caches:
base-template:
distributedCacheConfiguration:
encoding:
mediaType: application/octet-stream
expiration:
lifespan: "129600000"
extended-template:
distributedCacheConfiguration:
configuration: base-template
expiration:
lifespan: "129600000"
maxIdle: "43200000"
ipe-template:
distributedCacheConfiguration:
configuration: extended-template
encoding:
media-type: application/octet-stream
locking:
striping: true
memory:
storage: OFF_HEAP
mode: SYNC
owners: 1
statistics: true
identities-batch.yaml: |-
user create application -p 34BE4JL5dYOu6zHZ -g application
---
# Source: ipe-cache/templates/cache.yaml
apiVersion: infinispan.org/v2alpha1
kind: Cache
spec:
name: "ipe.ipe-settings"
updates:
strategy: recreate
clusterName: ipe-cache-infinispan
templateName: "ipe-template"
---
# Source: ipe-cache/templates/infinispan.yaml
apiVersion: infinispan.org/v1
kind: Infinispan
spec:
replicas: 1
configMapName: ipe-cache-cm
service:
type: DataGrid
expose:
type: Route
port: 11223
targetPort: 11223
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
logging:
categories:
org.infinispan: debug
org.jgroups: debug
org.jgroups.protocols.TCP: error
org.jgroups.protocols.relay.RELAY2: error
---
# Source: ipe-cache/templates/route.yaml
kind: Route
apiVersion: route.openshift.io/v1
spec:
to:
kind: Service
name: ipe-cache-infinispan-admin
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
port:
targetPort: infinispan-adm
---
# Source: ipe-cache/templates/route.yaml
kind: Route
apiVersion: route.openshift.io/v1
spec:
to:
kind: Service
name: ipe-cache-infinispan
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
port:
targetPort: infinispan
解释:
我部署了
Infinispan
服务器(名为ipe-cache-infinispan
),以及我们主要不感兴趣的服务和路由,以及所有Cache
自定义对象对于每个Infinispan缓存,与Infinispan节点关联并与正确的基础模板。在此示例中,我仅显示一个缓存
对于身份验证,我从一篇文章中获得灵感,该文章告诉您如何自动生成秘密。
通过查阅 Helm 图表的 Infinispan 文档,我了解到可以使用 identities-batch.yaml
文件来配置服务帐户
operator
密码,我就可以访问 CLI 和控制台。
但是看看如果我登录 CLI 会发生什么[disconnected]> connect localhost:11223
Username: operator
Password: ****************
[ipe-cache-e3-dev-infinispan-0-11942@ipe-cache-e3-dev-infinispan//containers/default]> user ls
[]
在控制台上,我可以使用
operator
登录并查看所有运行状况良好的缓存。但是
application
登录被拒绝问题
application
用户有什么问题吗?我应该如何定义一个至少具有
application
授权的自定义用户(以便 Hot Rod 工作)?同时,如何调试 Infinispan 登录失败?
可以为规范在端口 11222 上公开的安全领域定义多个用户