Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
alekc committed Nov 29, 2023
1 parent 3f5c771 commit 438c971
Show file tree
Hide file tree
Showing 16 changed files with 427 additions and 336 deletions.
2 changes: 1 addition & 1 deletion api/v1beta2/multirunner_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1
package v1beta2

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
30 changes: 5 additions & 25 deletions api/v1beta2/runner_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ import (
"k8s.io/utils/pointer"
)

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// RunnerSpec defines the desired state of Runner
type RunnerSpec struct {
RegistrationConfig RegisterNewRunnerOptions `json:"registration_config"`
// +kubebuilder:validation:Optional
Token *string `url:"token" json:"token,omitempty"`

// +kubebuilder:validation:Optional
TokenSecret string `json:"token_secret,omitempty"`

// +kubebuilder:validation:Optional
GitlabInstanceURL string `json:"gitlab_instance_url,omitempty"`
Expand Down Expand Up @@ -369,27 +370,6 @@ type Service struct {
Entrypoint []string `toml:"entrypoint" json:"entrypoint" long:"entrypoint" description:"Command or script that should be executed as the container’s entrypoint. syntax is similar to https://docs.docker.com/engine/reference/builder/#entrypoint"`
}

// RegisterNewRunnerOptions represents the available RegisterNewRunner()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#register-a-new-runner
type RegisterNewRunnerOptions struct {
Token *string `url:"token" json:"token,omitempty"`
TokenSecret string `json:"token_secret,omitempty"`
Description *string `url:"description,omitempty" json:"description,omitempty"`
Info *RegisterNewRunnerInfoOptions `url:"info,omitempty" json:"info,omitempty"`
// Active is deprecated. use paused instead
Active *bool `url:"active,omitempty" json:"active,omitempty"`
Paused *bool `url:"paused,omitempty" json:"paused,omitempty"`
Locked *bool `url:"locked,omitempty" json:"locked,omitempty"`
RunUntagged *bool `url:"run_untagged,omitempty" json:"run_untagged,omitempty"`
TagList *[]string `url:"tag_list[],omitempty" json:"tag_list,omitempty"`
AccessLevel *string `url:"accessLevel,omitempty" json:"accessLevel,omitempty"`
MaximumTimeout *int `url:"maximum_timeout,omitempty" json:"maximum_timeout,omitempty"`
MaintenanceNote *string `url:"maintenance_note,omitempty" json:"maintenance_note,omitempty"`
}

// RegisterNewRunnerInfoOptions represents the info hashmap parameter in
// RegisterNewRunnerOptions.
//
Expand Down
1 change: 0 additions & 1 deletion api/v1beta2/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
)
Expand Down
80 changes: 5 additions & 75 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions config/crd/bases/gitlab.k8s.alekc.dev_multirunners.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
name: multirunners.gitlab.k8s.alekc.dev
spec:
group: gitlab.k8s.alekc.dev
names:
kind: MultiRunner
listKind: MultiRunnerList
plural: multirunners
singular: multirunner
scope: Namespaced
versions:
- name: v1beta2
schema:
openAPIV3Schema:
description: MultiRunner is the Schema for the multirunners API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: MultiRunnerSpec defines the desired state of MultiRunner
properties:
foo:
type: string
type: object
status:
description: MultiRunnerStatus defines the observed state of MultiRunner
type: object
type: object
served: true
storage: true
subresources:
status: {}
52 changes: 4 additions & 48 deletions config/crd/bases/gitlab.k8s.alekc.dev_runners.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -966,54 +966,10 @@ spec:
- info
- debug
type: string
registration_config:
description: "RegisterNewRunnerOptions represents the available RegisterNewRunner()
options. \n GitLab API docs: https://docs.gitlab.com/ce/api/runners.html#register-a-new-runner"
properties:
accessLevel:
type: string
active:
description: Active is deprecated. use paused instead
type: boolean
description:
type: string
info:
description: "RegisterNewRunnerInfoOptions represents the info
hashmap parameter in RegisterNewRunnerOptions. \n GitLab API
docs: https://docs.gitlab.com/ce/api/runners.html#register-a-new-runner"
properties:
architecture:
type: string
name:
type: string
platform:
type: string
revision:
type: string
version:
type: string
type: object
locked:
type: boolean
maintenance_note:
type: string
maximum_timeout:
type: integer
paused:
type: boolean
run_untagged:
type: boolean
tag_list:
items:
type: string
type: array
token:
type: string
token_secret:
type: string
type: object
required:
- registration_config
token:
type: string
token_secret:
type: string
type: object
status:
description: RunnerStatus defines the observed state of Runner
Expand Down
26 changes: 26 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,32 @@ rules:
- patch
- update
- watch
- apiGroups:
- gitlab.k8s.alekc.dev
resources:
- multirunners
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- gitlab.k8s.alekc.dev
resources:
- multirunners/finalizers
verbs:
- update
- apiGroups:
- gitlab.k8s.alekc.dev
resources:
- multirunners/status
verbs:
- get
- patch
- update
- apiGroups:
- gitlab.k8s.alekc.dev
resources:
Expand Down
4 changes: 2 additions & 2 deletions controllers/multirunner_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"

gitlabv1beta1 "gitlab.k8s.alekc.dev/api/v1beta1"
gitlabv1beta2 "gitlab.k8s.alekc.dev/api/v1beta2"
)

// MultiRunnerReconciler reconciles a MultiRunner object
Expand Down Expand Up @@ -57,6 +57,6 @@ func (r *MultiRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Request)
// SetupWithManager sets up the controller with the Manager.
func (r *MultiRunnerReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&gitlabv1beta1.MultiRunner{}).
For(&gitlabv1beta2.MultiRunner{}).
Complete(r)
}
Loading

0 comments on commit 438c971

Please sign in to comment.