以獲取模式為例,secretproviderclasses.secrets-store.csi.x-k8s.io我將使用該命令kubectl describe crd secretproviderclasses.secrets-store.csi.x-k8s.io并得到以下結果:
Name: secretproviderclasses.secrets-store.csi.x-k8s.io
Namespace:
Labels: <none>
Annotations: controller-gen.kubebuilder.io/version: v0.9.0
helm.sh/resource-policy: keep
API Version: apiextensions.k8s.io/v1
Kind: CustomResourceDefinition
Metadata:
Creation Timestamp: 2022-10-11T15:27:15Z
Generation: 1
Managed Fields:
API Version: apiextensions.k8s.io/v1
Fields Type: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.:
f:controller-gen.kubebuilder.io/version:
f:spec:
f:conversion:
.:
f:strategy:
f:group:
f:names:
f:kind:
f:listKind:
f:plural:
f:singular:
f:scope:
f:versions:
Manager: helm
Operation: Update
Time: 2022-10-11T15:27:15Z
API Version: apiextensions.k8s.io/v1
Fields Type: FieldsV1
fieldsV1:
f:status:
f:acceptedNames:
f:kind:
f:listKind:
f:plural:
f:singular:
f:conditions:
k:{"type":"Established"}:
.:
f:lastTransitionTime:
f:message:
f:reason:
f:status:
f:type:
k:{"type":"NamesAccepted"}:
.:
f:lastTransitionTime:
f:message:
f:reason:
f:status:
f:type:
Manager: kube-apiserver
Operation: Update
Subresource: status
Time: 2022-10-11T15:27:15Z
API Version: apiextensions.k8s.io/v1
Fields Type: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
f:kubectl.kubernetes.io/last-applied-configuration:
Manager: kubectl-client-side-apply
Operation: Update
Time: 2022-10-11T15:27:38Z
API Version: apiextensions.k8s.io/v1
Fields Type: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
f:helm.sh/resource-policy:
Manager: kubectl-patch
Operation: Update
Time: 2022-10-12T16:02:53Z
Resource Version: 123907610
UID: 4a251e0a-97fc-4369-903f-9aa9a13469c1
Spec:
Conversion:
Strategy: None
Group: secrets-store.csi.x-k8s.io
Names:
Kind: SecretProviderClass
List Kind: SecretProviderClassList
Plural: secretproviderclasses
Singular: secretproviderclass
Scope: Namespaced
Versions:
Name: v1
Schema:
openAPIV3Schema:
Description: SecretProviderClass is the Schema for the secretproviderclasses API
Properties:
API Version:
Description: APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Type: string
Kind:
Description: Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Type: string
Metadata:
Type: object
Spec:
Description: SecretProviderClassSpec defines the desired state of SecretProviderClass
Properties:
Parameters:
Additional Properties:
Type: string
Description: Configuration for specific provider
Type: object
Provider:
Description: Configuration for provider name
Type: string
Secret Objects:
Items:
Description: SecretObject defines the desired state of synced K8s secret objects
Properties:
Annotations:
Additional Properties:
Type: string
Description: annotations of k8s secret object
Type: object
Data:
Items:
Description: SecretObjectData defines the desired state of synced K8s secret object data
Properties:
Key:
Description: data field to populate
Type: string
Object Name:
Description: name of the object to sync
Type: string
Type: object
Type: array
Labels:
Additional Properties:
Type: string
Description: labels of K8s secret object
Type: object
Secret Name:
Description: name of the K8s secret object
Type: string
Type:
Description: type of K8s secret object
Type: string
Type: object
Type: array
Type: object
Status:
Description: SecretProviderClassStatus defines the observed state of SecretProviderClass
Properties:
By Pod:
Items:
Description: ByPodStatus defines the state of SecretProviderClass as seen by an individual controller
Properties:
Id:
Description: id of the pod that wrote the status
Type: string
Namespace:
Description: namespace of the pod that wrote the status
Type: string
Type: object
Type: array
Type: object
Type: object
Served: true
Storage: true
Deprecated: true
Deprecation Warning: secrets-store.csi.x-k8s.io/v1alpha1 is deprecated. Use secrets-store.csi.x-k8s.io/v1 instead.
Name: v1alpha1
Schema:
openAPIV3Schema:
Description: SecretProviderClass is the Schema for the secretproviderclasses API
Properties:
API Version:
Description: APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
Type: string
Kind:
Description: Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
Type: string
Metadata:
Type: object
Spec:
Description: SecretProviderClassSpec defines the desired state of SecretProviderClass
Properties:
Parameters:
Additional Properties:
Type: string
Description: Configuration for specific provider
Type: object
Provider:
Description: Configuration for provider name
Type: string
Secret Objects:
Items:
Description: SecretObject defines the desired state of synced K8s secret objects
Properties:
Annotations:
Additional Properties:
Type: string
Description: annotations of k8s secret object
Type: object
Data:
Items:
Description: SecretObjectData defines the desired state of synced K8s secret object data
Properties:
Key:
Description: data field to populate
Type: string
Object Name:
Description: name of the object to sync
Type: string
Type: object
Type: array
Labels:
Additional Properties:
Type: string
Description: labels of K8s secret object
Type: object
Secret Name:
Description: name of the K8s secret object
Type: string
Type:
Description: type of K8s secret object
Type: string
Type: object
Type: array
Type: object
Status:
Description: SecretProviderClassStatus defines the observed state of SecretProviderClass
Properties:
By Pod:
Items:
Description: ByPodStatus defines the state of SecretProviderClass as seen by an individual controller
Properties:
Id:
Description: id of the pod that wrote the status
Type: string
Namespace:
Description: namespace of the pod that wrote the status
Type: string
Type: object
Type: array
Type: object
Type: object
Served: true
Storage: false
Status:
Accepted Names:
Kind: SecretProviderClass
List Kind: SecretProviderClassList
Plural: secretproviderclasses
Singular: secretproviderclass
Conditions:
Last Transition Time: 2022-10-11T15:27:15Z
Message: no conflicts found
Reason: NoConflicts
Status: True
Type: NamesAccepted
Last Transition Time: 2022-10-11T15:27:15Z
Message: the initial names have been accepted
Reason: InitialNamesAccepted
Status: True
Type: Established
Stored Versions:
v1
事件:
這真的很冗長且難以閱讀,那么是否有一些命令可以回傳帶有示例的 json 模式?
uj5u.com熱心網友回復:
我不知道有什么東西直接給你一個例子。但是您可以使用它kubectl explain來獲取有關 api-resources 模式的欄位的資訊:
例如
$ kubectl explain secretproviderclasses.secrets-store.csi.x-k8s.io
要獲取以遞回方式列出的欄位,請使用:
kubectl explain secretproviderclasses.secrets-store.csi.x-k8s.io --recursive
alm-examples一些運營商還在其 ClusterServiceVersion 的注釋中提供了他們提供的 CRD 的示例。所以也許這對你來說可能是另一種方式。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/520321.html
