diff --git a/api/v1alpha1/runner_types.go b/api/v1alpha1/runner_types.go index ce384ef0..806a5bdc 100644 --- a/api/v1alpha1/runner_types.go +++ b/api/v1alpha1/runner_types.go @@ -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 diff --git a/config/crd/bases/actions.summerwind.dev_runners.yaml b/config/crd/bases/actions.summerwind.dev_runners.yaml index dfd7a7d9..8c34b1f5 100644 --- a/config/crd/bases/actions.summerwind.dev_runners.yaml +++ b/config/crd/bases/actions.summerwind.dev_runners.yaml @@ -39,6 +39,8 @@ spec: image: type: string repository: + minLength: 3 + pattern: ^[^/]+/[^/]+$ type: string required: - repository diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 5c5f0b84..847ec4e0 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -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 diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 378d00b7..ce15157b 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -26,3 +26,12 @@ rules: - get - patch - update +- apiGroups: + - "" + resources: + - pod + verbs: + - delete + - get + - patch + - update diff --git a/controllers/runner_controller.go b/controllers/runner_controller.go index 1531f0d8..eede57f6 100644 --- a/controllers/runner_controller.go +++ b/controllers/runner_controller.go @@ -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()