Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Commit

Permalink
adding codegen annotation for rbac, shotname and columns (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
xinsnake authored and xtellurian committed Jun 21, 2019
1 parent 69018ac commit d34a29a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
28 changes: 16 additions & 12 deletions config/crds/microsoft_v1beta1_notebookjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,23 @@ metadata:
controller-tools.k8s.io: "1.0"
name: notebookjobs.microsoft.k8s.io
spec:
additionalPrinterColumns:
- JSONPath: .metadata.creationTimestamp
name: Age
type: date
- JSONPath: .spec.notebookTask.runID
name: RunID
type: integer
- JSONPath: .status.stateMessage
name: State
type: string
group: microsoft.k8s.io
names:
kind: NotebookJob
singular: notebookjob
plural: notebookjobs
shortNames:
- nbj
scope: Namespaced
additionalPrinterColumns:
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
- name: RunID
type: integer
description: Run ID in DataBricks
JSONPath: .spec.notebookTask.runID
- name: State
type: string
JSONPath: .status.stateMessage
validation:
openAPIV3Schema:
properties:
Expand Down Expand Up @@ -101,6 +99,12 @@ spec:
type: integer
type: object
status:
properties:
stateMessage:
description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
of cluster Important: Run "make" to regenerate code after modifying
this file'
type: string
type: object
version: v1beta1
status:
Expand Down
14 changes: 7 additions & 7 deletions config/rbac/rbac_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ rules:
verbs:
- create
- patch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- watch
- apiGroups:
- admissionregistration.k8s.io
resources:
Expand Down Expand Up @@ -88,10 +95,3 @@ rules:
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- watch
4 changes: 4 additions & 0 deletions pkg/apis/microsoft/v1beta1/notebookjob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ type NotebookJobStatus struct {

// NotebookJob is the Schema for the notebookjobs API
// +k8s:openapi-gen=true
// +kubebuilder:resource:shortName=nbj
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="RunID",type="integer",JSONPath=".spec.notebookTask.runID"
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.stateMessage"
type NotebookJob struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions pkg/controller/notebookjob/notebookjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type ReconcileNotebookJob struct {
// +kubebuilder:rbac:groups=microsoft.k8s.io,resources=notebookjobs,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=microsoft.k8s.io,resources=notebookjobs/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=microsoft.k8s.io,resources=events,verbs=create;patch
// +kubebuilder:rbac:groups=core,resources=events,verbs=create;watch
func (r *ReconcileNotebookJob) Reconcile(request reconcile.Request) (reconcile.Result, error) {
// Fetch the NotebookJob instance
instance := &microsoftv1beta1.NotebookJob{}
Expand Down

0 comments on commit d34a29a

Please sign in to comment.