在 Gitlab 中部署 helm chart 时如何修复节点主机名过长 CI

How to fix nodes hostnames too long when deploying helm chart in Gitlab CI

我想要实现的目标

嗨,我目前正在尝试通过 gitlab CI 作业部署 postgresql-ha(更具体地说 bitnami/postgresql-ha)helm chart。

我可以在本地实现什么

在本地,当 运行ning helm install postgresql ./postgresql-ha 时,我能够在我的远程 Kubernetes 集群上成功创建图表,没有任何错误。

./postgresql-habitnami/postgresql-ha.

的未修改拉取

当我 运行 通过 CI

时会发生什么

当我在 Gitlab 的 CI 中尝试 运行 相同的命令时,正确设置 helmkubectl,我得到这个错误:

Release "postgresql" does not exist. Installing it now.
Error: template: postgresql-ha/templates/NOTES.txt:60:4: executing "postgresql-ha/templates/NOTES.txt" at <include "postgresql-ha.validateValues" .>: error calling include: template: postgresql-ha/templates/_helpers.tpl:682:51: executing "postgresql-ha.validateValues" at <fail>: error calling fail: 
VALUES VALIDATION:
postgresql-ha: Nodes hostnames
    PostgreSQL nodes hostnames exceeds the characters limit for Pgpool: 128.
    Consider using a shorter release name or namespace.

第一行验证 kubectl/helm 配置。

.gitlab-ci.yml 文件

##########
# Stages #
##########

stages:
  - deploy charts

########
# Jobs #
########

deploy_postgresql-ha:
  image: dtzar/helm-kubectl:3.0.0
  stage: deploy charts
  environment:
    name: production
  script:
    - helm upgrade --install postgresql ./postgresql-ha

Kubernetes 集群是通过 Gitlab 的 Kubernetes 集成工具创建的,因此已经根据 this Gitlab Documentation page.

进行了设置

在此先感谢您的帮助!

pgpool 上似乎有一个错误:

由于缓冲区较小,使用长主机名进行 ping 探测失败 pgpool 调用 "ping -q -c3 " 并解析结果以确定主机是启动还是关闭。不幸的是,它使用相当小的缓冲区来读取输出,并且 ping 命令的最后一行可能会被截断。 这意味着 pgpool 假定主机已关闭。

https://pgpool.net/mantisbt/print_all_bug_page_word.php?search=&sort=&dir=DESC&type_page=html&export=-1&show_flag=0

Bitnami 升级了代码,现在不再允许使用长主机名。 Nodehostname由以下部分组成,所以你可以调整:

$nodeHostname := printf "%s-00.%s.%s.svc.%s:1234" $postgresqlFullname $postgresqlHeadlessServiceName $releaseNamespace $clusterDomain }}

https://github.com/bitnami/charts/blob/master/bitnami/postgresql-ha/templates/_helpers.tpl