在 opensearch_dashboards.yml 中添加自定义品牌时出现验证错误

问题描述 投票:0回答:2

我有一个使用 opster opensearch 运算符在 aks 中运行的工作 opensearch 集群。当我在additionalConfig部分添加自定义品牌时,它会抛出错误。

dashboards:
version: 2.5.0
enable: true

additionalConfig:
  server.basePath: "/opensearch"
  server.rewriteBasePath: "false"
  opensearch_security.multitenancy.enabled: "true"
  opensearchDashboards.branding:
    logo:
      defaultUrl: "https://example.com/sample.svg"
      darkModeUrl: "https://example.com/dark-mode-sample.svg"
    mark:
      defaultUrl: "https://example.com/sample1.svg"
      darkModeUrl: "https://example.com/dark-mode-sample1.svg"
    loadingLogo:
      defaultUrl: "https://example.com/sample2.svg"
      darkModeUrl: "https://example.com/dark-mode-sample2.svg"
    faviconUrl: "https://example.com/sample3.svg"
    applicationTitle: "My Custom Title"

收到错误:

错误:验证“opensearch-cluster.yaml”时出错:验证数据时出错:ValidationError(OpenSearchCluster.spec.dashboards.additionalConfig.opensearchDashboards.branding):io.opster.opensearch.v1.OpenSearchCluster.spec.dashboards 的类型无效。 extraConfig:得到“地图”,期望“字符串”;如果您选择忽略这些错误,请使用 --validate=false

关闭验证

我也尝试更新指向 opensearch_dashboards.yml 的 configmap,但 configmap 没有更新。

opensearch opensearch-dashboards
2个回答
0
投票

这有点棘手,但

additionalConfig
应该是一个字符串映射。

因此,

opensearchDashboards.branding
YAML 值应该是一个字符串,在您的示例中它是一个地图。

我还没有测试过,但类似:

  opensearchDashboards.branding: |
    logo:
      defaultUrl: "https://example.com/sample.svg"
      darkModeUrl: "https://example.com/dark-mode-sample.svg"
    mark:
      defaultUrl: "https://example.com/sample1.svg"
      darkModeUrl: "https://example.com/dark-mode-sample1.svg"
    loadingLogo:
      defaultUrl: "https://example.com/sample2.svg"
      darkModeUrl: "https://example.com/dark-mode-sample2.svg"
    faviconUrl: "https://example.com/sample3.svg"
    applicationTitle: "My Custom Title"

也许可以完成这项工作。这确实令人沮丧,特别是因为这并不是唯一受此影响的领域,而且操作员的相关文档也缺乏。


0
投票

这适用于 OpenSearch v2.17.0 和 opensearch-k8s-operator v2.6.1:

additionalConfig:
  opensearchDashboards.branding.logo.defaultUrl: "https://example.com/sample.svg"
  opensearchDashboards.branding.logo.darkModeUrl: "https://example.com/dark-mode-sample.svg"
  opensearchDashboards.branding.mark.defaultUrl: "https://example.com/sample1.svg"
  opensearchDashboards.branding.mark.darkModeUrl: "https://example.com/dark-mode-sample1.svg"
  opensearchDashboards.branding.loadingLogo.defaultUrl: "https://example.com/sample2.svg"
  opensearchDashboards.branding.loadingLogo.darkModeUrl: "https://example.com/dark-mode-sample2.svg"
  opensearchDashboards.branding.faviconUrl: "https://example.com/sample3.svg"
  opensearchDashboards.branding.applicationTitle: "My Custom Title"
© www.soinside.com 2019 - 2024. All rights reserved.