k8s crd设置额外header

可以通过设置crd.spec.additionalPrinterColumns来实现:

XML 复制代码
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: crontabs.stable.example.com
spec:
  group: stable.example.com
  scope: Namespaced
  names:
    plural: crontabs
    singular: crontab
    kind: CronTab
    shortNames:
    - ct
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              cronSpec:
                type: string
              image:
                type: string
              replicas:
                type: integer
    additionalPrinterColumns:
    - name: Spec
      type: string
      description: The cron spec defining the interval a CronJob is run
      jsonPath: .spec.cronSpec
    - name: Replicas
      type: integer
      description: The number of jobs launched by the CronJob
      jsonPath: .spec.replicas
    - name: Age
      type: date
      jsonPath: .metadata.creationTimestamp

参考:

使用 CustomResourceDefinition 扩展 Kubernetes API | Kubernetes

相关推荐
大盛供应链·卢生8 小时前
哪些国产芯片可以替代进口芯片,哪些替代不了
fpga开发·容器
Mr小林13 小时前
Docker 安装教程(在线 + 离线)
运维·docker·容器
阿里云云原生13 小时前
云栖剧透丨四场论坛,看清智能体走进生产的关键路径
云原生
Henry-SAP13 小时前
SAP PP模块核心机制解析
人工智能·云原生·sap·erp
运维开发王义杰14 小时前
内存不报警、Pod 却连环死循环?揭秘 Linux Major Page Fault 致命抖动
云原生
wdfk_prog17 小时前
VMware Ubuntu 虚拟机从 124 GB 压缩到 33 GB
运维·缓存·docker·容器
colourmind20 小时前
K3S+Hami+Higress+Vip(nginx+keepalived)搭建云原生高可用的大模型部署平台
运维·nginx·云原生
闲云野鹤在人间20 小时前
Docker入门|第3章 镜像详解
linux·网络·docker·容器·centos·云计算·php
闲云野鹤在人间21 小时前
Docker入门|第2章 容器架构详解
linux·运维·docker·容器·架构·云计算
wzq11_66621 小时前
Docker数据卷管理
运维·docker·容器