本文主要是介绍k8s crd设置额外header,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
可以通过设置crd.spec.additionalPrinterColumns来实现:
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:name: crontabs.stable.example.com
spec:group: stable.example.comscope: Namespacednames:plural: crontabssingular: crontabkind: CronTabshortNames:- ctversions:- name: v1served: truestorage: trueschema:openAPIV3Schema:type: objectproperties:spec:type: objectproperties:cronSpec:type: stringimage:type: stringreplicas:type: integeradditionalPrinterColumns:- name: Spectype: stringdescription: The cron spec defining the interval a CronJob is runjsonPath: .spec.cronSpec- name: Replicastype: integerdescription: The number of jobs launched by the CronJobjsonPath: .spec.replicas- name: Agetype: datejsonPath: .metadata.creationTimestamp
参考:
使用 CustomResourceDefinition 扩展 Kubernetes API | Kubernetes
这篇关于k8s crd设置额外header的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!