Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add logic for queue controller (Part 1) #346

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: mock
mock: mockgen ## Generate mock client for k8sclient
mock: mockgen ## Generate mock clients
$(RM) test/k8sclient/mock_client.go
mockgen -destination=test/k8sclient/mock_client.go -package=k8sclient "github.com/armadaproject/armada-operator/test/k8sclient" Client
$(RM) test/armadaclient/mock_queue_client.go
mockgen -destination=test/armadaclient/mock_queue_client.go -package=armadaclient "github.com/armadaproject/armada-operator/test/armadaclient" QueueClient

.PHONY: generate-helm-chart
generate-helm-chart: manifests kustomize helmify ## Generate Helm chart from Kustomize manifests
Expand Down
23 changes: 14 additions & 9 deletions api/core/v1alpha1/queue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,30 @@ limitations under the License.
package v1alpha1

import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// 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.
type PermissionSubject struct {
Kind string `json:"kind,omitempty"`
Name string `json:"name,omitempty"`
}

type QueuePermissions struct {
Subjects []PermissionSubject `json:"subjects,omitempty"`
Verbs []string `json:"verbs,omitempty"`
}

// QueueSpec defines the desired state of Queue
type QueueSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of Queue. Edit queue_types.go to remove/update
Foo string `json:"foo,omitempty"`
// PriorityFactor is a multiplicative constant which is applied to the priority.
PriorityFactor *resource.Quantity `json:"priorityFactor,omitempty"`
// Permissions describe who can perform what operations on queue related resources.
Permissions []QueuePermissions `json:"permissions,omitempty"`
}

// QueueStatus defines the observed state of Queue
type QueueStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
Expand Down
54 changes: 53 additions & 1 deletion api/core/v1alpha1/zz_generated.deepcopy.go

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

32 changes: 28 additions & 4 deletions charts/armada-operator/crds/queue-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,34 @@ spec:
spec:
description: QueueSpec defines the desired state of Queue
properties:
foo:
description: Foo is an example field of Queue. Edit queue_types.go
to remove/update
type: string
permissions:
description: Permissions describe who can perform what operations
on queue related resources.
items:
properties:
subjects:
items:
properties:
kind:
type: string
name:
type: string
type: object
type: array
verbs:
items:
type: string
type: array
type: object
type: array
priorityFactor:
anyOf:
- type: integer
- type: string
description: PriorityFactor is a multiplicative constant which is
applied to the priority.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
status:
description: QueueStatus defines the observed state of Queue
Expand Down
32 changes: 28 additions & 4 deletions config/crd/bases/core.armadaproject.io_queues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,34 @@ spec:
spec:
description: QueueSpec defines the desired state of Queue
properties:
foo:
description: Foo is an example field of Queue. Edit queue_types.go
to remove/update
type: string
permissions:
description: Permissions describe who can perform what operations
on queue related resources.
items:
properties:
subjects:
items:
properties:
kind:
type: string
name:
type: string
type: object
type: array
verbs:
items:
type: string
type: array
type: object
type: array
priorityFactor:
anyOf:
- type: integer
- type: string
description: PriorityFactor is a multiplicative constant which is
applied to the priority.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
status:
description: QueueStatus defines the observed state of Queue
Expand Down
12 changes: 10 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ module github.com/armadaproject/armada-operator
go 1.23.2

require (
github.com/armadaproject/armada v0.15.11
github.com/go-logr/logr v1.4.2
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.6.0
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/pkg/errors v0.9.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.77.2
github.com/stretchr/testify v1.9.0
google.golang.org/grpc v1.67.1
google.golang.org/protobuf v1.35.1
k8s.io/api v0.31.2
k8s.io/apimachinery v0.31.2
Expand All @@ -25,7 +28,6 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
Expand All @@ -34,18 +36,21 @@ require (
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a // indirect
github.com/gogo/status v1.1.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
Expand All @@ -67,6 +72,9 @@ require (
golang.org/x/time v0.7.0 // indirect
golang.org/x/tools v0.26.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading
Loading