diff --git a/api/v1/fluxreport_types.go b/api/v1/fluxreport_types.go index 5563487..46ab93a 100644 --- a/api/v1/fluxreport_types.go +++ b/api/v1/fluxreport_types.go @@ -136,9 +136,11 @@ type FluxReportStatus struct { // +kubebuilder:storageversion // +kubebuilder:object:root=true // +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Entitlement",type="string",JSONPath=".spec.distribution.entitlement",description="",priority=10 // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="" // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",description="" // +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].message",description="" +// +kubebuilder:printcolumn:name="LastUpdated",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].lastTransitionTime",description="" // FluxReport is the Schema for the fluxreports API. type FluxReport struct { diff --git a/config/crd/bases/fluxcd.controlplane.io_fluxreports.yaml b/config/crd/bases/fluxcd.controlplane.io_fluxreports.yaml index 767b8eb..883f7e8 100644 --- a/config/crd/bases/fluxcd.controlplane.io_fluxreports.yaml +++ b/config/crd/bases/fluxcd.controlplane.io_fluxreports.yaml @@ -15,6 +15,10 @@ spec: scope: Namespaced versions: - additionalPrinterColumns: + - jsonPath: .spec.distribution.entitlement + name: Entitlement + priority: 10 + type: string - jsonPath: .metadata.creationTimestamp name: Age type: date @@ -24,6 +28,9 @@ spec: - jsonPath: .status.conditions[?(@.type=="Ready")].message name: Status type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].lastTransitionTime + name: LastUpdated + type: string name: v1 schema: openAPIV3Schema: diff --git a/internal/controller/entitlement_controller.go b/internal/controller/entitlement_controller.go index 578ae31..078a2db 100644 --- a/internal/controller/entitlement_controller.go +++ b/internal/controller/entitlement_controller.go @@ -21,7 +21,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/ratelimiter" + fluxcdv1 "github.com/controlplaneio-fluxcd/flux-operator/api/v1" "github.com/controlplaneio-fluxcd/flux-operator/internal/entitlement" + "github.com/controlplaneio-fluxcd/flux-operator/internal/reporter" ) // EntitlementReconciler reconciles entitlements. @@ -76,6 +78,12 @@ func (r *EntitlementReconciler) Reconcile(ctx context.Context, req ctrl.Request) log.Info("Entitlement registered", "vendor", r.EntitlementClient.GetVendor()) + if err := reporter.RequestReportUpdate(ctx, + r.Client, fluxcdv1.DefaultInstanceName, + r.StatusManager, r.WatchNamespace); err != nil { + log.Error(err, "failed to request report update") + } + // Requeue to verify the token. return ctrl.Result{Requeue: true}, nil }