From eca3cc79413933c3e2659a5577d801b539dcf685 Mon Sep 17 00:00:00 2001 From: Reinier Timmer Date: Fri, 24 Apr 2020 09:50:41 +0200 Subject: [PATCH] add organization info to runner status --- api/v1alpha1/runner_types.go | 9 ++++++--- config/crd/bases/actions.summerwind.dev_runners.yaml | 8 +++++++- controllers/runner_controller.go | 7 ++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/api/v1alpha1/runner_types.go b/api/v1alpha1/runner_types.go index c8266a62..bb681393 100644 --- a/api/v1alpha1/runner_types.go +++ b/api/v1alpha1/runner_types.go @@ -80,14 +80,17 @@ type RunnerStatus struct { Message string `json:"message"` } +// RunnerStatusRegistration contains runner registration status type RunnerStatusRegistration struct { - Repository string `json:"repository"` - Token string `json:"token"` - ExpiresAt metav1.Time `json:"expiresAt"` + Organization string `json:"organization"` + Repository string `json:"repository,omitempty"` + Token string `json:"token"` + ExpiresAt metav1.Time `json:"expiresAt"` } // +kubebuilder:object:root=true // +kubebuilder:subresource:status +// +kubebuilder:printcolumn:JSONPath=".spec.organization",name=Organization,type=string // +kubebuilder:printcolumn:JSONPath=".spec.repository",name=Repository,type=string // +kubebuilder:printcolumn:JSONPath=".status.phase",name=Status,type=string diff --git a/config/crd/bases/actions.summerwind.dev_runners.yaml b/config/crd/bases/actions.summerwind.dev_runners.yaml index ccb0a965..13f05915 100644 --- a/config/crd/bases/actions.summerwind.dev_runners.yaml +++ b/config/crd/bases/actions.summerwind.dev_runners.yaml @@ -9,6 +9,9 @@ metadata: name: runners.actions.summerwind.dev spec: additionalPrinterColumns: + - JSONPath: .spec.organization + name: Organization + type: string - JSONPath: .spec.repository name: Repository type: string @@ -6308,17 +6311,20 @@ spec: reason: type: string registration: + description: RunnerStatusRegistration contains runner registration status properties: expiresAt: format: date-time type: string + organization: + type: string repository: type: string token: type: string required: - expiresAt - - repository + - organization - token type: object required: diff --git a/controllers/runner_controller.go b/controllers/runner_controller.go index 9454e751..92e06c49 100644 --- a/controllers/runner_controller.go +++ b/controllers/runner_controller.go @@ -117,9 +117,10 @@ func (r *RunnerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) { updated := runner.DeepCopy() updated.Status.Registration = v1alpha1.RunnerStatusRegistration{ - Repository: runner.Spec.Repository, - Token: rt.GetToken(), - ExpiresAt: metav1.NewTime(rt.GetExpiresAt().Time), + Organization: runner.Spec.Organization, + Repository: runner.Spec.Repository, + Token: rt.GetToken(), + ExpiresAt: metav1.NewTime(rt.GetExpiresAt().Time), } if err := r.Status().Update(ctx, updated); err != nil {