Skip to content

Commit c7d0209

Browse files
committed
print columns and field selectors
1 parent d6d8a02 commit c7d0209

File tree

7 files changed

+31
-4
lines changed

7 files changed

+31
-4
lines changed

api/crds/manifests/openmcp.cloud_clusterproviders.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ spec:
1616
singular: clusterprovider
1717
scope: Cluster
1818
versions:
19-
- name: v1alpha1
19+
- additionalPrinterColumns:
20+
- jsonPath: .status.phase
21+
name: Phase
22+
type: string
23+
name: v1alpha1
2024
schema:
2125
openAPIV3Schema:
2226
description: ClusterProvider is the Schema for the clusterproviders API.
@@ -160,6 +164,8 @@ spec:
160164
- observedGeneration
161165
type: object
162166
type: object
167+
selectableFields:
168+
- jsonPath: .status.phase
163169
served: true
164170
storage: true
165171
subresources:

api/crds/manifests/openmcp.cloud_platformservices.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ spec:
1616
singular: platformservice
1717
scope: Cluster
1818
versions:
19-
- name: v1alpha1
19+
- additionalPrinterColumns:
20+
- jsonPath: .status.phase
21+
name: Phase
22+
type: string
23+
name: v1alpha1
2024
schema:
2125
openAPIV3Schema:
2226
description: PlatformService is the Schema for the platformservices API.
@@ -160,6 +164,8 @@ spec:
160164
- observedGeneration
161165
type: object
162166
type: object
167+
selectableFields:
168+
- jsonPath: .status.phase
163169
served: true
164170
storage: true
165171
subresources:

api/crds/manifests/openmcp.cloud_serviceproviders.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ spec:
1616
singular: serviceprovider
1717
scope: Cluster
1818
versions:
19-
- name: v1alpha1
19+
- additionalPrinterColumns:
20+
- jsonPath: .status.phase
21+
name: Phase
22+
type: string
23+
name: v1alpha1
2024
schema:
2125
openAPIV3Schema:
2226
description: ServiceProvider is the Schema for the serviceproviders API.
@@ -160,6 +164,8 @@ spec:
160164
- observedGeneration
161165
type: object
162166
type: object
167+
selectableFields:
168+
- jsonPath: .status.phase
163169
served: true
164170
storage: true
165171
subresources:

api/provider/v1alpha1/clusterprovider_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ type ClusterProviderStatus struct {
3838
// +kubebuilder:subresource:status
3939
// +kubebuilder:resource:scope=Cluster
4040
// +kubebuilder:metadata:labels="openmcp.cloud/cluster=platform"
41+
// +kubebuilder:selectablefield:JSONPath=".status.phase"
42+
// +kubebuilder:printcolumn:JSONPath=".status.phase",name="Phase",type=string
4143

4244
// ClusterProvider is the Schema for the clusterproviders API.
4345
type ClusterProvider struct {

api/provider/v1alpha1/platformservice_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ type PlatformServiceStatus struct {
3838
// +kubebuilder:subresource:status
3939
// +kubebuilder:resource:scope=Cluster
4040
// +kubebuilder:metadata:labels="openmcp.cloud/cluster=platform"
41+
// +kubebuilder:selectablefield:JSONPath=".status.phase"
42+
// +kubebuilder:printcolumn:JSONPath=".status.phase",name="Phase",type=string
4143

4244
// PlatformService is the Schema for the platformservices API.
4345
type PlatformService struct {

api/provider/v1alpha1/serviceprovider_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ type ServiceProviderStatus struct {
3838
// +kubebuilder:subresource:status
3939
// +kubebuilder:resource:scope=Cluster
4040
// +kubebuilder:metadata:labels="openmcp.cloud/cluster=platform"
41+
// +kubebuilder:selectablefield:JSONPath=".status.phase"
42+
// +kubebuilder:printcolumn:JSONPath=".status.phase",name="Phase",type=string
4143

4244
// ServiceProvider is the Schema for the serviceproviders API.
4345
type ServiceProvider struct {

internal/controllers/provider/controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,10 @@ func (r *ProviderReconciler) checkReconcileAnnotation(
219219
) error {
220220
if controller.HasAnnotationWithValue(provider, constants.OperationAnnotation, constants.OperationAnnotationValueReconcile) && deploymentStatus.Phase == phaseReady {
221221
log := logging.FromContextOrPanic(ctx)
222+
log.Debug("reconciling due to reconcile annotation")
222223
deploymentStatus.Phase = phaseProgressing
224+
deploymentStatus.ObservedGeneration = provider.GetGeneration()
225+
resetConditions(provider, deploymentStatus)
223226

224227
if err := DeploymentStatusIntoUnstructured(deploymentStatus, provider); err != nil {
225228
log.Error(err, "failed to handle reconcile annotation")
@@ -266,8 +269,8 @@ func (r *ProviderReconciler) removeFinalizer(ctx context.Context, provider *unst
266269
func (r *ProviderReconciler) observeGeneration(provider *unstructured.Unstructured, status *v1alpha1.DeploymentStatus) {
267270
gen := provider.GetGeneration()
268271
if status.ObservedGeneration != gen {
269-
status.ObservedGeneration = gen
270272
status.Phase = phaseProgressing
273+
status.ObservedGeneration = gen
271274
resetConditions(provider, status)
272275
}
273276
}

0 commit comments

Comments
 (0)