简体   繁体   English

无法修补 Kiali configMap

[英]Unable to patch Kiali configMap

I have this Kiali configMap along with different Kiali resources like deployment, service etc all in a single yaml file我有这个 Kiali configMap 以及不同的 Kiali 资源,如部署、服务等,都在一个 yaml 文件中

apiVersion: v1
kind: ConfigMap
metadata:
  name: kiali
  namespace: istio-system
  labels:
    helm.sh/chart: kiali-server-1.55.1
    app: kiali
    app.kubernetes.io/name: kiali
    app.kubernetes.io/instance: kiali
    version: "v1.55.1"
    app.kubernetes.io/version: "v1.55.1"
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/part-of: "kiali"
data:
  config.yaml: |
    external_services:
      custom_dashboards:
        enabled: true
      istio:
        root_namespace: istio-system
        config_map_name: istio-1-15-3
    auth:
      openid: {}
      openshift:
        client_id_prefix: kiali
      strategy: anonymous
    deployment:
      accessible_namespaces:
      - '**'
      additional_service_yaml: {}
      affinity:
        node: {}
        pod: {}
        pod_anti: {}
      configmap_annotations: {}
      custom_secrets: []
      host_aliases: []
      hpa:
        api_version: autoscaling/v2beta2
        spec: {}
      image_digest: ""
      image_name: quay.io/kiali/kiali
      image_pull_policy: Always
      image_pull_secrets: []
      image_version: v1.55
      ingress:
        additional_labels: {}
        class_name: nginx
        override_yaml:
          metadata: {}
      ingress_enabled: false
      instance_name: kiali
      logger:
        log_format: text
        log_level: info
        sampler_rate: "1"
        time_field_format: 2006-01-02T15:04:05Z07:00
      namespace: istio-system
      node_selector: {}
      pod_annotations: {}
      pod_labels:
        sidecar.istio.io/inject: "false"
      priority_class_name: ""
      replicas: 1
      resources:
        limits:
          memory: 1Gi
        requests:
          cpu: 10m
          memory: 64Mi
      secret_name: kiali
      service_annotations: {}
      service_type: ""
      tolerations: []
      version_label: v1.55.1
      view_only_mode: false

... ...

In this data I have to add this config under external-services在此数据中,我必须在外部服务下添加此配置

data:
  config.yaml: |
    external_services:  
      prometheus:
         url: "http://prometheus-prometheus.observability-prisma.svc:9090/"
      custom_dashboards:
        enabled: true
      istio:
        root_namespace: istio-system
        config_map_name: istio-1-15-3

I have tried using following kubectl patches but no one is working This patch is replacing the whole original data config part我尝试使用以下 kubectl 补丁,但没有人在工作这个补丁正在替换整个原始数据配置部分

kubectl patch configmap/kiali \                                                    
  -n istio-system \
  --type merge \
  -p '{"data":{"config.yaml":{"external_services":{"prometheus":{"url":"http://prometheus-prometheus.observability-prisma.svc:9090/"}}}}}'

This patch fails with the invalid request error.此补丁因无效请求错误而失败。 Since, the config under data is actually a string因为,data下的config其实是一个字符串

kubectl patch cm kiali -n istio-system --type json --patch '[{ "op": "add", "path": "/data/config.yaml/external_services", "value": {"prometheus":{"url":"http://prometheus-prometheus.observability-prisma.svc:9090/"}} }]'

May I please get some assistance on how I can resolve this using kubectl or json-path function?我可以就如何使用 kubectl 或 json-path function 解决这个问题获得一些帮助吗?

The Kiali operator stores its deployment configuration in Kiali CR(custom resource) , so if we create, update or remove a Kiali CR will trigger the Kiali operator to create, update or remove a Kiali. Kiali operator 将其部署配置存储在Kiali CR(custom resource)中,因此如果我们创建、更新或删除 Kiali CR 将触发 Kiali operator 创建、更新或删除 Kiali。 We cannot manually update a resource created by the Kiali operator, after you have created your Kiali CR you can manage your Kiali installation by using the below command我们无法手动更新由 Kiali 操作员创建的资源,在您创建 Kiali CR 后,您可以使用以下命令管理您的 Kiali 安装

kubectl edit kiali kiali -n istio-system

Your Kiali CR can be validated by using the Kiali CR validation tool .可以使用Kiali CR 验证工具来验证您的 Kiali CR。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM