Skip to content

Commit bf792e6

Browse files
committed
move markers to v1beta2 types
1 parent 92155c2 commit bf792e6

32 files changed

+179
-180
lines changed

api/addons/v1beta1/clusterresourceset_types.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ type ClusterResourceSetV1Beta2Status struct {
135135
// +listType=map
136136
// +listMapKey=type
137137
// +kubebuilder:validation:MaxItems=32
138-
// +Metrics:stateset:name="status_condition",help="The condition of a clusterresourceset.",labelName="status",JSONPath=.status,list={"True","False","Unknown"},labelsFromPath={"type":".type"}
139-
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition's last transition time of a clusterresourceset.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
140138
Conditions []metav1.Condition `json:"conditions,omitempty"`
141139
}
142140

@@ -174,10 +172,6 @@ func (m *ClusterResourceSet) SetV1Beta2Conditions(conditions []metav1.Condition)
174172

175173
// ClusterResourceSet is the Schema for the clusterresourcesets API.
176174
// For advanced use cases an add-on provider should be used instead.
177-
// +Metrics:gvk:namePrefix="capi_clusterresourceset"
178-
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
179-
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
180-
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
181175
type ClusterResourceSet struct {
182176
metav1.TypeMeta `json:",inline"`
183177
// metadata is the standard object's metadata.

api/addons/v1beta2/clusterresourceset_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ type ClusterResourceSetStatus struct {
122122
// +listType=map
123123
// +listMapKey=type
124124
// +kubebuilder:validation:MaxItems=32
125+
// +Metrics:stateset:name="status_condition",help="The condition of a clusterresourceset.",labelName="status",JSONPath=.status,list={"True","False","Unknown"},labelsFromPath={"type":".type"}
126+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition's last transition time of a clusterresourceset.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
125127
Conditions []metav1.Condition `json:"conditions,omitempty"`
126128

127129
// observedGeneration reflects the generation of the most recently observed ClusterResourceSet.
@@ -192,6 +194,10 @@ func (m *ClusterResourceSet) SetConditions(conditions []metav1.Condition) {
192194

193195
// ClusterResourceSet is the Schema for the clusterresourcesets API.
194196
// For advanced use cases an add-on provider should be used instead.
197+
// +Metrics:gvk:namePrefix="capi_clusterresourceset"
198+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
199+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
200+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
195201
type ClusterResourceSet struct {
196202
metav1.TypeMeta `json:",inline"`
197203
// metadata is the standard object's metadata.

api/bootstrap/kubeadm/v1beta1/kubeadmconfig_types.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,6 @@ type KubeadmConfigV1Beta2Status struct {
502502
// +listType=map
503503
// +listMapKey=type
504504
// +kubebuilder:validation:MaxItems=32
505-
// +Metrics:stateset:name="status_condition",help="The condition of a kubeadmconfig.",labelName="status",JSONPath=.status,list={"True","False","Unknown"},labelsFromPath={"type":".type"}
506-
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition's last transition time of a kubeadmconfig.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
507505
Conditions []metav1.Condition `json:"conditions,omitempty"`
508506
}
509507

@@ -515,20 +513,11 @@ type KubeadmConfigV1Beta2Status struct {
515513
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of KubeadmConfig"
516514

517515
// KubeadmConfig is the Schema for the kubeadmconfigs API.
518-
// +Metrics:gvk:namePrefix="capi_kubeadmconfig"
519-
// +Metrics:labelFromPath:name="name",JSONPath=.metadata.name
520-
// +Metrics:labelFromPath:name="namespace",JSONPath=.metadata.namespace
521-
// +Metrics:labelFromPath:name="uid",JSONPath=.metadata.uid
522-
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.labels.cluster\.x-k8s\.io/cluster-name
523-
// +Metrics:info:name="info",help="Information about a kubeadmconfig.",labelsFromPath={name:.metadata.name}
524516
type KubeadmConfig struct {
525517
metav1.TypeMeta `json:",inline"`
526518
// metadata is the standard object's metadata.
527519
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
528520
// +optional
529-
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
530-
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the kubeadmconfig is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
531-
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
532521
metav1.ObjectMeta `json:"metadata,omitempty"`
533522

534523
// spec is the desired state of KubeadmConfig.

api/bootstrap/kubeadm/v1beta2/kubeadmconfig_types.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ type KubeadmConfigStatus struct {
453453
// +listType=map
454454
// +listMapKey=type
455455
// +kubebuilder:validation:MaxItems=32
456+
// +Metrics:stateset:name="status_condition",help="The condition of a kubeadmconfig.",labelName="status",JSONPath=.status,list={"True","False","Unknown"},labelsFromPath={"type":".type"}
457+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition's last transition time of a kubeadmconfig.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
456458
Conditions []metav1.Condition `json:"conditions,omitempty"`
457459

458460
// initialization provides observations of the KubeadmConfig initialization process.
@@ -532,11 +534,20 @@ type KubeadmConfigV1Beta1DeprecatedStatus struct {
532534
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of KubeadmConfig"
533535

534536
// KubeadmConfig is the Schema for the kubeadmconfigs API.
537+
// +Metrics:gvk:namePrefix="capi_kubeadmconfig"
538+
// +Metrics:labelFromPath:name="name",JSONPath=.metadata.name
539+
// +Metrics:labelFromPath:name="namespace",JSONPath=.metadata.namespace
540+
// +Metrics:labelFromPath:name="uid",JSONPath=.metadata.uid
541+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.labels.cluster\.x-k8s\.io/cluster-name
542+
// +Metrics:info:name="info",help="Information about a kubeadmconfig.",labelsFromPath={name:.metadata.name}
535543
type KubeadmConfig struct {
536544
metav1.TypeMeta `json:",inline"`
537545
// metadata is the standard object's metadata.
538546
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
539547
// +optional
548+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
549+
// +Metrics:info:name="annotation_paused",JSONPath=.annotations['cluster\.x-k8s\.io/paused'],help="Whether the kubeadmconfig is paused and any of its resources will not be processed by the controllers.",labelsFromPath={paused_value:"."}
550+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
540551
metav1.ObjectMeta `json:"metadata,omitempty"`
541552

542553
// spec is the desired state of KubeadmConfig.

api/controlplane/kubeadm/v1beta1/kubeadm_control_plane_types.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ type KubeadmControlPlaneSpec struct {
8383
// odd numbers are permitted, as per [etcd best practice](https://etcd.io/docs/v3.3.12/faq/#why-an-odd-number-of-cluster-members).
8484
// This is a pointer to distinguish between explicit zero and not specified.
8585
// +optional
86-
// +Metrics:gauge:name="spec_replicas",help="The number of desired machines for a kubeadmcontrolplane."
8786
Replicas *int32 `json:"replicas,omitempty"`
8887

8988
// version defines the desired Kubernetes version.
@@ -215,7 +214,6 @@ type RollingUpdate struct {
215214
// Example: when this is set to 1, the control plane can be scaled
216215
// up immediately when the rolling update starts.
217216
// +optional
218-
// +Metrics:gauge:name="spec_strategy_rollingupdate_max_surge",help="Maximum number of replicas that can be scheduled above the desired number of replicas during a rolling update of a kubeadmcontrolplane."
219217
MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"`
220218
}
221219

@@ -297,7 +295,6 @@ type KubeadmControlPlaneStatus struct {
297295
// replicas is the total number of non-terminated machines targeted by this control plane
298296
// (their labels match the selector).
299297
// +optional
300-
// +Metrics:gauge:name="status_replicas",help="The number of replicas per kubeadmcontrolplane.",nilIsZero=true
301298
Replicas int32 `json:"replicas"`
302299

303300
// version represents the minimum Kubernetes version for the control plane machines
@@ -310,12 +307,10 @@ type KubeadmControlPlaneStatus struct {
310307
// updatedReplicas is the total number of non-terminated machines targeted by this control plane
311308
// that have the desired template spec.
312309
// +optional
313-
// +Metrics:gauge:name="status_replicas_updated",help="The number of updated replicas per kubeadmcontrolplane.",nilIsZero=true
314310
UpdatedReplicas int32 `json:"updatedReplicas"`
315311

316312
// readyReplicas is the total number of fully running and ready control plane machines.
317313
// +optional
318-
// +Metrics:gauge:name="status_replicas_ready",help="The number of ready replicas per kubeadmcontrolplane.",nilIsZero=true
319314
ReadyReplicas int32 `json:"readyReplicas"`
320315

321316
// unavailableReplicas is the total number of unavailable machines targeted by this control plane.
@@ -327,7 +322,6 @@ type KubeadmControlPlaneStatus struct {
327322
// Deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.
328323
//
329324
// +optional
330-
// +Metrics:gauge:name="status_replicas_unavailable",help="The number of unavailable replicas per kubeadmcontrolplane.",nilIsZero=true
331325
UnavailableReplicas int32 `json:"unavailableReplicas"`
332326

333327
// initialized denotes that the KubeadmControlPlane API Server is initialized and thus
@@ -392,8 +386,6 @@ type KubeadmControlPlaneV1Beta2Status struct {
392386
// +listType=map
393387
// +listMapKey=type
394388
// +kubebuilder:validation:MaxItems=32
395-
// +Metrics:stateset:name="status_condition",help="The condition of a kubeadmcontrolplane.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
396-
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition's last transition time of a kubeadmcontrolplane.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
397389
Conditions []metav1.Condition `json:"conditions,omitempty"`
398390

399391
// readyReplicas is the number of ready replicas for this KubeadmControlPlane. A machine is considered ready when Machine's Ready condition is true.
@@ -446,20 +438,11 @@ type LastRemediationStatus struct {
446438
// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=".spec.version",description="Kubernetes version associated with this control plane"
447439

448440
// KubeadmControlPlane is the Schema for the KubeadmControlPlane API.
449-
// +Metrics:gvk:namePrefix="capi_kubeadmcontrolplane"
450-
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.ownerReferences.\[kind=Cluster\].name
451-
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
452-
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
453-
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
454-
// +Metrics:info:name="info",help="Information about a kubeadmcontrolplane.",labelsFromPath={version:".spec.version"}
455441
type KubeadmControlPlane struct {
456442
metav1.TypeMeta `json:",inline"`
457443
// metadata is the standard object's metadata.
458444
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
459445
// +optional
460-
// +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:"."}
461-
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
462-
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
463446
metav1.ObjectMeta `json:"metadata,omitempty"`
464447

465448
// spec is the desired state of KubeadmControlPlane.

api/controlplane/kubeadm/v1beta2/kubeadm_control_plane_types.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ type KubeadmControlPlaneSpec struct {
421421
// odd numbers are permitted, as per [etcd best practice](https://etcd.io/docs/v3.3.12/faq/#why-an-odd-number-of-cluster-members).
422422
// This is a pointer to distinguish between explicit zero and not specified.
423423
// +optional
424+
// +Metrics:gauge:name="spec_replicas",help="The number of desired machines for a kubeadmcontrolplane."
424425
Replicas *int32 `json:"replicas,omitempty"`
425426

426427
// version defines the desired Kubernetes version.
@@ -587,6 +588,7 @@ type KubeadmControlPlaneRolloutStrategyRollingUpdate struct {
587588
// Example: when this is set to 1, the control plane can be scaled
588589
// up immediately when the rolling update starts.
589590
// +optional
591+
// +Metrics:gauge:name="spec_strategy_rollingupdate_max_surge",help="Maximum number of replicas that can be scheduled above the desired number of replicas during a rolling update of a kubeadmcontrolplane."
590592
MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty"`
591593
}
592594

@@ -667,6 +669,8 @@ type KubeadmControlPlaneStatus struct {
667669
// +listType=map
668670
// +listMapKey=type
669671
// +kubebuilder:validation:MaxItems=32
672+
// +Metrics:stateset:name="status_condition",help="The condition of a kubeadmcontrolplane.",labelName="status",JSONPath=".status",list={"True","False","Unknown"},labelsFromPath={"type":".type"}
673+
// +Metrics:gauge:name="status_condition_last_transition_time",help="The condition's last transition time of a kubeadmcontrolplane.",valueFrom=.lastTransitionTime,labelsFromPath={"type":".type","status":".status"}
670674
Conditions []metav1.Condition `json:"conditions,omitempty"`
671675

672676
// initialization provides observations of the KubeadmControlPlane initialization process.
@@ -687,18 +691,22 @@ type KubeadmControlPlaneStatus struct {
687691
// replicas is the total number of non-terminated machines targeted by this control plane
688692
// (their labels match the selector).
689693
// +optional
694+
// +Metrics:gauge:name="status_replicas",help="The number of replicas per kubeadmcontrolplane.",nilIsZero=true
690695
Replicas *int32 `json:"replicas,omitempty"`
691696

692697
// readyReplicas is the number of ready replicas for this KubeadmControlPlane. A machine is considered ready when Machine's Ready condition is true.
693698
// +optional
699+
// +Metrics:gauge:name="status_replicas_ready",help="The number of ready replicas per kubeadmcontrolplane.",nilIsZero=true
694700
ReadyReplicas *int32 `json:"readyReplicas,omitempty"`
695701

696702
// availableReplicas is the number of available replicas targeted by this KubeadmControlPlane. A machine is considered available when Machine's Available condition is true.
697703
// +optional
704+
// +Metrics:gauge:name="status_replicas_available",help="The number of available replicas per kubeadmcontrolplane.",nilIsZero=true
698705
AvailableReplicas *int32 `json:"availableReplicas,omitempty"`
699706

700707
// upToDateReplicas is the number of up-to-date replicas targeted by this KubeadmControlPlane. A machine is considered up-to-date when Machine's UpToDate condition is true.
701708
// +optional
709+
// +Metrics:gauge:name="status_replicas_uptodate",help="The number of up-to-date replicas per kubeadmcontrolplane.",nilIsZero=true
702710
UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"`
703711

704712
// version represents the minimum Kubernetes version for the control plane machines
@@ -836,11 +844,20 @@ type LastRemediationStatus struct {
836844
// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=".spec.version",description="Kubernetes version associated with this control plane"
837845

838846
// KubeadmControlPlane is the Schema for the KubeadmControlPlane API.
847+
// +Metrics:gvk:namePrefix="capi_kubeadmcontrolplane"
848+
// +Metrics:labelFromPath:name="cluster_name",JSONPath=.metadata.ownerReferences.\[kind=Cluster\].name
849+
// +Metrics:labelFromPath:name="name",JSONPath=".metadata.name"
850+
// +Metrics:labelFromPath:name="namespace",JSONPath=".metadata.namespace"
851+
// +Metrics:labelFromPath:name="uid",JSONPath=".metadata.uid"
852+
// +Metrics:info:name="info",help="Information about a kubeadmcontrolplane.",labelsFromPath={version:".spec.version"}
839853
type KubeadmControlPlane struct {
840854
metav1.TypeMeta `json:",inline"`
841855
// metadata is the standard object's metadata.
842856
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
843857
// +optional
858+
// +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:"."}
859+
// +Metrics:gauge:name="created",JSONPath=".creationTimestamp",help="Unix creation timestamp."
860+
// +Metrics:info:name="owner",JSONPath=".ownerReferences",help="Owner references.",labelsFromPath={owner_is_controller:".controller",owner_kind:".kind",owner_name:".name",owner_uid:".uid"}
844861
metav1.ObjectMeta `json:"metadata,omitempty"`
845862

846863
// spec is the desired state of KubeadmControlPlane.

0 commit comments

Comments
 (0)