Skip to content

Commit 85f1931

Browse files
committed
[OCTRL-1088] added TaskDefinitions to environment-controller
1 parent 917bbad commit 85f1931

12 files changed

Lines changed: 390 additions & 390 deletions

File tree

control-operator/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.25 as builder
2+
FROM golang:1.25 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55
ARG MANAGER=task-manager

control-operator/api/v1alpha1/environment_types.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,21 @@ import (
3232
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
3333
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
3434

35+
// TaskDefinition is a lightweight inline task definition used within an Environment spec.
36+
// Unlike TaskTemplate, it is not a cluster resource — it carries a plain name and the same spec fields.
37+
type TaskDefinition struct {
38+
Name string `json:"name"`
39+
Spec TaskTemplateSpec `json:"spec"`
40+
}
41+
3542
// EnvironmentSpec defines the desired state of Environment
3643
type EnvironmentSpec struct {
3744
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
3845
// Important: Run "make" to regenerate code after modifying this file
3946
// The following markers will use OpenAPI v3 schema to validate the value
4047
// More info: https://book.kubebuilder.io/reference/markers/crd-validation.html
4148

42-
Tasks map[string][]TaskTemplate `json:"tasks"`
49+
Tasks map[string][]TaskDefinition `json:"tasks"`
4350
// +kubebuilder:validation:Enum=standby;deployed;configured;running
4451
State string `json:"state"`
4552
}

control-operator/api/v1alpha1/tasktemplate_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ type TaskTemplateSpec struct {
5353
// +optional
5454
Properties map[string]string `json:"properties,omitempty"`
5555

56+
// Arguments defines transition arguments passed to the task via OCC gRPC.
57+
// +optional
58+
Arguments map[string]string `json:"arguments,omitempty"`
59+
5660
// Names of the expected Environment variables to be passed to Pod
5761
// +optional
5862
EnvVars []string `json:"envVars,omitempty"`

control-operator/api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 26 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

control-operator/config/crd/bases/aliecs.alice.cern_environments.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ spec:
4747
additionalProperties:
4848
items:
4949
properties:
50-
apiVersion:
51-
type: string
52-
kind:
50+
name:
5351
type: string
54-
metadata:
55-
type: object
5652
spec:
5753
properties:
54+
arguments:
55+
additionalProperties:
56+
type: string
57+
type: object
5858
bind:
5959
items:
6060
properties:
@@ -3940,6 +3940,7 @@ spec:
39403940
type: object
39413941
type: object
39423942
required:
3943+
- name
39433944
- spec
39443945
type: object
39453946
type: array

control-operator/config/crd/bases/aliecs.alice.cern_tasktemplates.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ spec:
2626
type: object
2727
spec:
2828
properties:
29+
arguments:
30+
additionalProperties:
31+
type: string
32+
type: object
2933
bind:
3034
items:
3135
properties:

control-operator/config/manager/environment-manager/environment-manager.yaml

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,39 +23,42 @@ spec:
2323
labels:
2424
control-plane: environment-manager
2525
spec:
26+
imagePullSecrets:
27+
- name: gitlab-registry-secret
2628
securityContext:
2729
runAsNonRoot: true
2830
containers:
29-
- command:
30-
- /manager
31-
args:
32-
- --leader-elect
33-
- --health-probe-bind-address=:8081
34-
image: environment-manager:latest
35-
name: manager
36-
securityContext:
37-
allowPrivilegeEscalation: false
38-
capabilities:
39-
drop:
40-
- "ALL"
41-
livenessProbe:
42-
httpGet:
43-
path: /healthz
44-
port: 8081
45-
initialDelaySeconds: 15
46-
periodSeconds: 20
47-
readinessProbe:
48-
httpGet:
49-
path: /readyz
50-
port: 8081
51-
initialDelaySeconds: 5
52-
periodSeconds: 10
53-
resources:
54-
limits:
55-
cpu: 500m
56-
memory: 128Mi
57-
requests:
58-
cpu: 10m
59-
memory: 64Mi
31+
- command:
32+
- /manager
33+
args:
34+
- --leader-elect
35+
- --health-probe-bind-address=:9080
36+
- --metrics-bind-address=:9081
37+
image: environment-manager:latest
38+
name: manager
39+
securityContext:
40+
allowPrivilegeEscalation: false
41+
capabilities:
42+
drop:
43+
- "ALL"
44+
livenessProbe:
45+
httpGet:
46+
path: /healthz
47+
port: 9080
48+
initialDelaySeconds: 15
49+
periodSeconds: 20
50+
readinessProbe:
51+
httpGet:
52+
path: /readyz
53+
port: 9080
54+
initialDelaySeconds: 5
55+
periodSeconds: 10
56+
resources:
57+
limits:
58+
cpu: 500m
59+
memory: 128Mi
60+
requests:
61+
cpu: 10m
62+
memory: 64Mi
6063
serviceAccountName: controller-manager
6164
terminationGracePeriodSeconds: 10

0 commit comments

Comments
 (0)