Skip to content

Commit 8ba5462

Browse files
committed
Implement queue controller logic
Signed-off-by: Jason Parraga <sovietaced@gmail.com>
1 parent 5504878 commit 8ba5462

22 files changed

+1096
-61
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,11 @@ generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and
104104
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
105105

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

111113
.PHONY: generate-helm-chart
112114
generate-helm-chart: manifests kustomize helmify ## Generate Helm chart from Kustomize manifests

api/core/v1alpha1/queue_types.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,30 @@ limitations under the License.
1717
package v1alpha1
1818

1919
import (
20+
"k8s.io/apimachinery/pkg/api/resource"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
)
2223

23-
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24-
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
24+
type PermissionSubject struct {
25+
Kind string `json:"kind,omitempty"`
26+
Name string `json:"name,omitempty"`
27+
}
28+
29+
type QueuePermissions struct {
30+
Subjects []PermissionSubject `json:"subjects,omitempty"`
31+
Verbs []string `json:"verbs,omitempty"`
32+
}
2533

2634
// QueueSpec defines the desired state of Queue
2735
type QueueSpec struct {
28-
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
29-
// Important: Run "make" to regenerate code after modifying this file
30-
31-
// Foo is an example field of Queue. Edit queue_types.go to remove/update
32-
Foo string `json:"foo,omitempty"`
36+
// PriorityFactor is a multiplicative constant which is applied to the priority.
37+
PriorityFactor *resource.Quantity `json:"priorityFactor,omitempty"`
38+
// Permissions describe who can perform what operations on queue related resources.
39+
Permissions []QueuePermissions `json:"permissions,omitempty"`
3340
}
3441

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

4146
//+kubebuilder:object:root=true

api/core/v1alpha1/zz_generated.deepcopy.go

Lines changed: 53 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/core.armadaproject.io_queues.yaml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,34 @@ spec:
3939
spec:
4040
description: QueueSpec defines the desired state of Queue
4141
properties:
42-
foo:
43-
description: Foo is an example field of Queue. Edit queue_types.go
44-
to remove/update
45-
type: string
42+
permissions:
43+
description: Permissions describe who can perform what operations
44+
on queue related resources.
45+
items:
46+
properties:
47+
subjects:
48+
items:
49+
properties:
50+
kind:
51+
type: string
52+
name:
53+
type: string
54+
type: object
55+
type: array
56+
verbs:
57+
items:
58+
type: string
59+
type: array
60+
type: object
61+
type: array
62+
priorityFactor:
63+
anyOf:
64+
- type: integer
65+
- type: string
66+
description: PriorityFactor is a multiplicative constant which is
67+
applied to the priority.
68+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
69+
x-kubernetes-int-or-string: true
4670
type: object
4771
status:
4872
description: QueueStatus defines the observed state of Queue

go.mod

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ module github.com/armadaproject/armada-operator
33
go 1.23.2
44

55
require (
6+
github.com/armadaproject/armada v0.15.11
67
github.com/go-logr/logr v1.4.2
8+
github.com/gogo/protobuf v1.3.2
79
github.com/golang/mock v1.6.0
810
github.com/google/go-cmp v0.6.0
911
github.com/onsi/ginkgo/v2 v2.19.0
1012
github.com/onsi/gomega v1.33.1
1113
github.com/pkg/errors v0.9.1
1214
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.77.2
1315
github.com/stretchr/testify v1.9.0
16+
google.golang.org/grpc v1.67.1
1417
google.golang.org/protobuf v1.35.1
1518
k8s.io/api v0.31.2
1619
k8s.io/apimachinery v0.31.2
@@ -25,7 +28,6 @@ require (
2528
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2629
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
2730
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
28-
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
2931
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
3032
github.com/fsnotify/fsnotify v1.7.0 // indirect
3133
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
@@ -34,18 +36,21 @@ require (
3436
github.com/go-openapi/jsonreference v0.21.0 // indirect
3537
github.com/go-openapi/swag v0.23.0 // indirect
3638
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
37-
github.com/gogo/protobuf v1.3.2 // indirect
39+
github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a // indirect
40+
github.com/gogo/status v1.1.1 // indirect
3841
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3942
github.com/golang/protobuf v1.5.4 // indirect
4043
github.com/google/gnostic-models v0.6.8 // indirect
4144
github.com/google/gofuzz v1.2.0 // indirect
4245
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
4346
github.com/google/uuid v1.6.0 // indirect
47+
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
4448
github.com/imdario/mergo v0.3.16 // indirect
4549
github.com/josharian/intern v1.0.0 // indirect
4650
github.com/json-iterator/go v1.1.12 // indirect
4751
github.com/klauspost/compress v1.17.11 // indirect
4852
github.com/mailru/easyjson v0.7.7 // indirect
53+
github.com/minio/highwayhash v1.0.2 // indirect
4954
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5055
github.com/modern-go/reflect2 v1.0.2 // indirect
5156
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
@@ -67,6 +72,9 @@ require (
6772
golang.org/x/time v0.7.0 // indirect
6873
golang.org/x/tools v0.26.0 // indirect
6974
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
75+
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
76+
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
77+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
7078
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
7179
gopkg.in/inf.v0 v0.9.1 // indirect
7280
gopkg.in/yaml.v2 v2.4.0 // indirect

0 commit comments

Comments
 (0)