Skip to content

Commit 05f599c

Browse files
committed
update to jsonpath
1 parent c265836 commit 05f599c

File tree

7 files changed

+60
-60
lines changed

7 files changed

+60
-60
lines changed

api/v1beta1/cluster_types.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ type ClusterStatus struct {
420420

421421
// Conditions defines current service state of the cluster.
422422
// +optional
423-
// +Metrics:stateset:name="status_condition",help="The condition of a cluster.",labelName="status",JSONPath={"status"},list={"True","False","Unknown"},labelsFromPath={"type":{"type"}}
423+
// +Metrics:stateset:name="status_condition",help="The condition of a cluster.",labelName="status",JSONPath=.status,list={"True","False","Unknown"},labelsFromPath={"type":".type"}
424424
Conditions Conditions `json:"conditions,omitempty"`
425425

426426
// ObservedGeneration is the latest generation observed by the controller.
@@ -490,14 +490,14 @@ func (v APIEndpoint) String() string {
490490

491491
// Cluster is the Schema for the clusters API.
492492
// +Metrics:namePrefix="capi_cluster"
493-
// +Metrics:labelFromPath:name="name",JSONPath={"metadata","name"}
494-
// +Metrics:labelFromPath:name="namespace",JSONPath={"metadata","namespace"}
495-
// +Metrics:labelFromPath:name="uid",JSONPath={"metadata","uid"}
496-
// +Metrics:info:name="info",help="Information about a cluster.",labelsFromPath={topology_version:{"spec","topology","version"},topology_class:{"spec","topology","class"},control_plane_endpoint_host:{"spec","controlPlaneEndpoint","host"},control_plane_endpoint_port:{"spec","controlPlaneEndpoint","port"},control_plane_reference_kind:{"spec","controlPlaneRef","kind"},control_plane_reference_name:{"spec","controlPlaneRef","name"},infrastructure_reference_kind:{"spec","infrastructureRef","kind"},infrastructure_reference_name:{"spec","infrastructureRef","name"}}
493+
// +Metrics:labelFromPath:name="name",JSONPath=.metadata.name
494+
// +Metrics:labelFromPath:name="namespace",JSONPath=.metadata.namespace
495+
// +Metrics:labelFromPath:name="uid",JSONPath=.metadata.uid
496+
// +Metrics:info:name="info",help="Information about a cluster.",labelsFromPath={topology_version:".spec.topology.version",topology_class:".spec.topology.class",control_plane_endpoint_host:".spec.controlPlaneEndpoint.host",control_plane_endpoint_port:".spec.controlPlaneEndpoint.port",control_plane_reference_kind:".spec.controlPlaneRef.kind",control_plane_reference_name:".spec.controlPlaneRef.name",infrastructure_reference_kind:".spec.infrastructureRef.kind",infrastructure_reference_name:".spec.infrastructureRef.name"}
497497
type Cluster struct {
498498
metav1.TypeMeta `json:",inline"`
499-
// +Metrics:gauge:name="created",JSONPath={"creationTimestamp"},help="Unix creation timestamp."
500-
// +Metrics:info:name="annotation_paused",JSONPath={"annotations","cluster.x-k8s.io/paused"},help="Whether the cluster is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:{}}
499+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
500+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the cluster is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
501501
metav1.ObjectMeta `json:"metadata,omitempty"`
502502

503503
Spec ClusterSpec `json:"spec,omitempty"`

api/v1beta1/machine_types.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ type MachineSpec struct {
142142
type MachineStatus struct {
143143
// NodeRef will point to the corresponding Node if it exists.
144144
// +optional
145-
// +Metrics:info:name="status_noderef",help="Information about the node reference of a machine.",labelsFromPath={node_name:{"name"},node_uid:{"uid"}}
145+
// +Metrics:info:name="status_noderef",help="Information about the node reference of a machine.",labelsFromPath={node_name:".name",node_uid:".uid"}
146146
NodeRef *corev1.ObjectReference `json:"nodeRef,omitempty"`
147147

148148
// NodeInfo is a set of ids/uuids to uniquely identify the node.
@@ -195,7 +195,7 @@ type MachineStatus struct {
195195
// Addresses is a list of addresses assigned to the machine.
196196
// This field is copied from the infrastructure provider reference.
197197
// +optional
198-
// +Metrics:info:name="addresses",help="Address information about a machine.",labelsFromPath={address:{address},type:{type}}
198+
// +Metrics:info:name="addresses",help="Address information about a machine.",labelsFromPath={address:".address",type:".type"}
199199
Addresses MachineAddresses `json:"addresses,omitempty"`
200200

201201
// Phase represents the current phase of machine actuation.
@@ -223,7 +223,7 @@ type MachineStatus struct {
223223

224224
// Conditions defines current service state of the Machine.
225225
// +optional
226-
// +Metrics:stateset:name="status_condition",help="The condition of a machine.",labelName="status",JSONPath={"status"},list={"True","False","Unknown"},labelsFromPath={"type":{"type"}}
226+
// +Metrics:stateset:name="status_condition",help="The condition of a machine.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
227227
Conditions Conditions `json:"conditions,omitempty"`
228228
}
229229

@@ -284,16 +284,16 @@ type Bootstrap struct {
284284

285285
// Machine is the Schema for the machines API.
286286
// +Metrics:namePrefix="capi_machine"
287-
// +Metrics:labelFromPath:name="name",JSONPath={"metadata","name"}
288-
// +Metrics:labelFromPath:name="namespace",JSONPath={"metadata","namespace"}
289-
// +Metrics:labelFromPath:name="uid",JSONPath={"metadata","uid"}
290-
// +Metrics:labelFromPath:name="cluster_name",JSONPath={"spec","clusterName"}
291-
// +Metrics:info:name="info",help="Information about a machine.",labelsFromPath={container_runtime_version:{status,nodeInfo,containerRuntimeVersion},failure_domain:{spec,failureDomain},kernel_version:{status,nodeInfo,kernelVersion},kube_proxy_version:{status,nodeInfo,kubeProxyVersion},kubelet_version:{status,nodeInfo,kubeletVersion},os_image:{status,nodeInfo,osImage},provider_id:{spec,providerID},version:{spec,version}}
287+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
288+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
289+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
290+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=".spec.clusterName"
291+
// +Metrics:info:name="info",help="Information about a machine.",labelsFromPath={container_runtime_version:.status.nodeInfo.containerRuntimeVersion,failure_domain:.spec.failureDomain,kernel_version:.status.nodeInfo.kernelVersion,kube_proxy_version:.status.nodeInfo.kubeProxyVersion,kubelet_version:.status.nodeInfo.kubeletVersion,os_image:.status.nodeInfo.osImage,provider_id:.spec.providerID,version:.spec.version}
292292
type Machine struct {
293293
metav1.TypeMeta `json:",inline"`
294-
// +Metrics:gauge:name="created",JSONPath={"creationTimestamp"},help="Unix creation timestamp."
295-
// +Metrics:info:name="annotation_paused",JSONPath={"annotations","cluster.x-k8s.io/paused"},help="Whether the machine is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:{}}
296-
// +Metrics:info:name="owner",JSONPath={"ownerReferences"},help="Owner references.",labelsFromPath={owner_is_controller:{controller},owner_kind:{kind},owner_name:{name},owner_uid:{uid}}
294+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
295+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the machine is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
296+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
297297
metav1.ObjectMeta `json:"metadata,omitempty"`
298298

299299
Spec MachineSpec `json:"spec,omitempty"`

api/v1beta1/machinedeployment_types.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ type MachineDeploymentStatus struct {
268268

269269
// Conditions defines current service state of the MachineDeployment.
270270
// +optional
271-
// +Metrics:stateset:name="status_condition",help="The condition of a machinedeployment.",labelName="status",JSONPath={"status"},list={"True","False","Unknown"},labelsFromPath={"type":{"type"}}
271+
// +Metrics:stateset:name="status_condition",help="The condition of a machinedeployment.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
272272
Conditions Conditions `json:"conditions,omitempty"`
273273
}
274274

@@ -331,15 +331,15 @@ func (md *MachineDeploymentStatus) GetTypedPhase() MachineDeploymentPhase {
331331

332332
// MachineDeployment is the Schema for the machinedeployments API.
333333
// +Metrics:namePrefix="capi_machinedeployment"
334-
// +Metrics:labelFromPath:name="name",JSONPath={"metadata","name"}
335-
// +Metrics:labelFromPath:name="namespace",JSONPath={"metadata","namespace"}
336-
// +Metrics:labelFromPath:name="uid",JSONPath={"metadata","uid"}
337-
// +Metrics:labelFromPath:name="cluster_name",JSONPath={"spec","clusterName"}
334+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
335+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
336+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
337+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=".spec.clusterName"
338338
type MachineDeployment struct {
339339
metav1.TypeMeta `json:",inline"`
340-
// +Metrics:gauge:name="created",JSONPath={"creationTimestamp"},help="Unix creation timestamp."
341-
// +Metrics:info:name="annotation_paused",JSONPath={"annotations","cluster.x-k8s.io/paused"},help="Whether the machinedeployment is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:{}}
342-
// +Metrics:info:name="owner",JSONPath={"ownerReferences"},help="Owner references.",labelsFromPath={owner_is_controller:{controller},owner_kind:{kind},owner_name:{name},owner_uid:{uid}}
340+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
341+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the machinedeployment is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
342+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
343343
metav1.ObjectMeta `json:"metadata,omitempty"`
344344

345345
Spec MachineDeploymentSpec `json:"spec,omitempty"`

api/v1beta1/machinehealthcheck_types.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ type MachineHealthCheckStatus struct {
135135

136136
// Conditions defines current service state of the MachineHealthCheck.
137137
// +optional
138-
// +Metrics:stateset:name="status_condition",help="The condition of a machinehealthcheck.",labelName="status",JSONPath={"status"},list={"True","False","Unknown"},labelsFromPath={"type":{"type"}}
138+
// +Metrics:stateset:name="status_condition",help="The condition of a machinehealthcheck.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
139139
Conditions Conditions `json:"conditions,omitempty"`
140140
}
141141

@@ -153,15 +153,15 @@ type MachineHealthCheckStatus struct {
153153

154154
// MachineHealthCheck is the Schema for the machinehealthchecks API.
155155
// +Metrics:namePrefix="capi_machinehealthcheck"
156-
// +Metrics:labelFromPath:name="name",JSONPath={"metadata","name"}
157-
// +Metrics:labelFromPath:name="namespace",JSONPath={"metadata","namespace"}
158-
// +Metrics:labelFromPath:name="uid",JSONPath={"metadata","uid"}
159-
// +Metrics:labelFromPath:name="cluster_name",JSONPath={"spec","clusterName"}
156+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
157+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
158+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
159+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=".spec.clusterName"
160160
type MachineHealthCheck struct {
161161
metav1.TypeMeta `json:",inline"`
162-
// +Metrics:gauge:name="created",JSONPath={"creationTimestamp"},help="Unix creation timestamp."
163-
// +Metrics:info:name="annotation_paused",JSONPath={"annotations","cluster.x-k8s.io/paused"},help="Whether the machinehealthcheck is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:{}}
164-
// +Metrics:info:name="owner",JSONPath={"ownerReferences"},help="Owner references.",labelsFromPath={owner_is_controller:{controller},owner_kind:{kind},owner_name:{name},owner_uid:{uid}}
162+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
163+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the machinehealthcheck is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
164+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
165165
metav1.ObjectMeta `json:"metadata,omitempty"`
166166

167167
// Specification of machine health check policy

api/v1beta1/machineset_types.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ type MachineSetStatus struct {
175175
FailureMessage *string `json:"failureMessage,omitempty"`
176176
// Conditions defines current service state of the MachineSet.
177177
// +optional
178-
// +Metrics:stateset:name="status_condition",help="The condition of a machineset.",labelName="status",JSONPath={"status"},list={"True","False","Unknown"},labelsFromPath={"type":{"type"}}
178+
// +Metrics:stateset:name="status_condition",help="The condition of a machineset.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
179179
Conditions Conditions `json:"conditions,omitempty"`
180180
}
181181

@@ -219,15 +219,15 @@ func (m *MachineSet) Validate() field.ErrorList {
219219

220220
// MachineSet is the Schema for the machinesets API.
221221
// +Metrics:namePrefix="capi_machineset"
222-
// +Metrics:labelFromPath:name="name",JSONPath={"metadata","name"}
223-
// +Metrics:labelFromPath:name="namespace",JSONPath={"metadata","namespace"}
224-
// +Metrics:labelFromPath:name="uid",JSONPath={"metadata","uid"}
225-
// +Metrics:labelFromPath:name="cluster_name",JSONPath={"spec","clusterName"}
222+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
223+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
224+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
225+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=".spec.clusterName"
226226
type MachineSet struct {
227227
metav1.TypeMeta `json:",inline"`
228-
// +Metrics:gauge:name="created",JSONPath={"creationTimestamp"},help="Unix creation timestamp."
229-
// +Metrics:info:name="annotation_paused",JSONPath={"annotations","cluster.x-k8s.io/paused"},help="Whether the machineset is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:{}}
230-
// +Metrics:info:name="owner",JSONPath={"ownerReferences"},help="Owner references.",labelsFromPath={owner_is_controller:{controller},owner_kind:{kind},owner_name:{name},owner_uid:{uid}}
228+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
229+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the machineset is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
230+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
231231
metav1.ObjectMeta `json:"metadata,omitempty"`
232232

233233
Spec MachineSetSpec `json:"spec,omitempty"`

controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_types.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ type KubeadmControlPlaneStatus struct {
298298

299299
// Conditions defines current service state of the KubeadmControlPlane.
300300
// +optional
301-
// +Metrics:stateset:name="status_condition",help="The condition of a kubeadmcontrolplane.",labelName="status",JSONPath={"status"},list={"True","False","Unknown"},labelsFromPath={"type":{"type"}}
301+
// +Metrics:stateset:name="status_condition",help="The condition of a kubeadmcontrolplane.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
302302
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
303303

304304
// LastRemediation stores info about last remediation performed.
@@ -339,16 +339,16 @@ type LastRemediationStatus struct {
339339

340340
// KubeadmControlPlane is the Schema for the KubeadmControlPlane API.
341341
// +Metrics:namePrefix="capi_kubeadmcontrolplane"
342-
// +Metrics:labelFromPath:name="cluster_name",JSONPath={metadata,ownerReferences,[kind=Cluster],name}
343-
// +Metrics:labelFromPath:name="name",JSONPath={metadata,name}
344-
// +Metrics:labelFromPath:name="namespace",JSONPath={metadata,namespace}
345-
// +Metrics:labelFromPath:name="uid",JSONPath={metadata,uid}
346-
// +Metrics:info:name="info",help="Information about a kubeadmcontrolplane.",labelsFromPath={version:{"spec","version"}}
342+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.ownerReferences.\[kind=Cluster\].name
343+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
344+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
345+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
346+
// +Metrics:info:name="info",help="Information about a kubeadmcontrolplane.",labelsFromPath={version:".spec.version"}
347347
type KubeadmControlPlane struct {
348348
metav1.TypeMeta `json:",inline"`
349-
// +Metrics:info:name="annotation_paused",JSONPath={"annotations","cluster.x-k8s.io/paused"},help="Whether the kubeadmcontrolplane is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:{}}
350-
// +Metrics:gauge:name="created",JSONPath={"creationTimestamp"},help="Unix creation timestamp."
351-
// +Metrics:info:name="owner",JSONPath={"ownerReferences"},help="Owner references.",labelsFromPath={owner_is_controller:{controller},owner_kind:{kind},owner_name:{name},owner_uid:{uid}}
349+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the kubeadmcontrolplane is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
350+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
351+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
352352
metav1.ObjectMeta `json:"metadata,omitempty"`
353353

354354
Spec KubeadmControlPlaneSpec `json:"spec,omitempty"`

0 commit comments

Comments
 (0)