Update CRD validation and RBAC

This commit is contained in:
Moto Ishizawa 2020-02-02 10:30:42 +09:00
parent 127a601fb7
commit 7db5340595
5 changed files with 20 additions and 0 deletions

View File

@ -22,6 +22,8 @@ import (
// RunnerSpec defines the desired state of Runner
type RunnerSpec struct {
// +kubebuilder:validation:MinLength=3
// +kubebuilder:validation:Pattern=`^[^/]+/[^/]+$`
Repository string `json:"repository"`
// +optional

View File

@ -39,6 +39,8 @@ spec:
image:
type: string
repository:
minLength: 3
pattern: ^[^/]+/[^/]+$
type: string
required:
- repository

View File

@ -1,2 +1,8 @@
resources:
- manager.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: summerwind/actions-runner-controller
newTag: latest

View File

@ -26,3 +26,12 @@ rules:
- get
- patch
- update
- apiGroups:
- ""
resources:
- pod
verbs:
- delete
- get
- patch
- update

View File

@ -55,6 +55,7 @@ type RunnerReconciler struct {
// +kubebuilder:rbac:groups=actions.summerwind.dev,resources=runners,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=actions.summerwind.dev,resources=runners/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=core,resources=pod,verbs=get;update;patch;delete
func (r *RunnerReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
ctx := context.Background()