Skip to content

Commit 53d5a96

Browse files
committed
[OCTRL-1088] rename author and properly handling TaskController as a daemon set
1 parent 85f1931 commit 53d5a96

11 files changed

Lines changed: 54 additions & 140 deletions

File tree

control-operator/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,15 @@ deploy-environment: manifests kustomize ## Deploy environment controller to the
220220
$(KUSTOMIZE) build config/environment | $(KUBECTL) apply -f - --server-side
221221

222222
.PHONY: undeploy
223-
undeploy: ## Undeploy both controllers from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
224-
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
223+
undeploy: undeploy-task undeploy-environment ## Undeploy both controllers from the K8s cluster specified in ~/.kube/config.
224+
225+
.PHONY: undeploy-task
226+
undeploy-task: kustomize ## Undeploy task controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
227+
$(KUSTOMIZE) build config/task | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
228+
229+
.PHONY: undeploy-environment
230+
undeploy-environment: kustomize ## Undeploy environment controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
231+
$(KUSTOMIZE) build config/environment | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
225232

226233
##@ Build Dependencies
227234

control-operator/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ make run
7878

7979
**NOTE:** You can also run this in one step by running: `make install run`
8080

81+
**NOTE:** The task-manager requires a `NODE_NAME` environment variable to know which node it is responsible for. In-cluster this is injected automatically via the downward API. When running locally you must set it manually:
82+
83+
```sh
84+
NODE_NAME=<your-node-name> make run
85+
```
86+
8187
### Modifying the API definitions
8288

8389
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:

control-operator/api/v1alpha1/environment_types.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* === This file is part of ALICE O² ===
33
*
4-
* Copyright 2024 CERN and copyright holders of ALICE O².
5-
* Author: Teo Mrnjavac <teo.mrnjavac@cern.ch>
4+
* Copyright 2026 CERN and copyright holders of ALICE O².
5+
* Author: Michal Tichak <michal.tichak@cern.ch>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by
@@ -66,6 +66,8 @@ type EnvironmentStatus struct {
6666
// - "Progressing": the resource is being created or updated
6767
// - "Degraded": the resource failed to reach or maintain its desired state
6868
//
69+
// TODO: use conditions properly during deployment
70+
//
6971
// The status of each condition is one of True, False, or Unknown.
7072
// +listType=map
7173
// +listMapKey=type

control-operator/api/v1alpha1/tasktemplate_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* === This file is part of ALICE O² ===
33
*
4-
* Copyright 2024 CERN and copyright holders of ALICE O².
5-
* Author: Teo Mrnjavac <teo.mrnjavac@cern.ch>
4+
* Copyright 2026 CERN and copyright holders of ALICE O².
5+
* Author: Michal Tichak <michal.tichak@cern.ch>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by

control-operator/cmd/environment-manager/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* === This file is part of ALICE O² ===
33
*
4-
* Copyright 2024 CERN and copyright holders of ALICE O².
5-
* Author: Teo Mrnjavac <teo.mrnjavac@cern.ch>
4+
* Copyright 2026 CERN and copyright holders of ALICE O².
5+
* Author: Michal Tichak <michal.tichak@cern.ch>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by

control-operator/cmd/main.go

Lines changed: 0 additions & 124 deletions
This file was deleted.

control-operator/cmd/task-manager/main.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* === This file is part of ALICE O² ===
33
*
4-
* Copyright 2024 CERN and copyright holders of ALICE O².
5-
* Author: Teo Mrnjavac <teo.mrnjavac@cern.ch>
4+
* Copyright 2026 CERN and copyright holders of ALICE O².
5+
* Author: Michal Tichak <michal.tichak@cern.ch>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@ package main
2626

2727
import (
2828
"flag"
29+
"fmt"
2930
"os"
3031

3132
"k8s.io/apimachinery/pkg/runtime"
@@ -82,10 +83,17 @@ func main() {
8283
os.Exit(1)
8384
}
8485

86+
nodeName := os.Getenv("NODE_NAME")
87+
if nodeName == "" {
88+
setupLog.Error(fmt.Errorf("NODE_NAME environment variable not set"), "NODE_NAME is required")
89+
os.Exit(1)
90+
}
91+
8592
if err = (&controller.TaskReconciler{
8693
Client: mgr.GetClient(),
8794
Scheme: mgr.GetScheme(),
8895
Recorder: mgr.GetEventRecorderFor("task-controller"),
96+
NodeName: nodeName,
8997
}).SetupWithManager(mgr); err != nil {
9098
setupLog.Error(err, "unable to create controller", "controller", "Task")
9199
os.Exit(1)

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ spec:
3131
- command:
3232
- /manager
3333
args:
34-
- --leader-elect
3534
- --health-probe-bind-address=:9082
3635
- --metrics-bind-address=:9083
36+
env:
37+
- name: NODE_NAME
38+
valueFrom:
39+
fieldRef:
40+
fieldPath: spec.nodeName
3741
image: task-manager:latest
3842
name: manager
3943
securityContext:

control-operator/internal/controller/environment_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* === This file is part of ALICE O² ===
33
*
4-
* Copyright 2024 CERN and copyright holders of ALICE O².
5-
* Author: Teo Mrnjavac <teo.mrnjavac@cern.ch>
4+
* Copyright 2026 CERN and copyright holders of ALICE O².
5+
* Author: Michal Tichak <michal.tichak@cern.ch>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by

control-operator/internal/controller/environment_controller_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* === This file is part of ALICE O² ===
33
*
4-
* Copyright 2024 CERN and copyright holders of ALICE O².
5-
* Author: Teo Mrnjavac <teo.mrnjavac@cern.ch>
4+
* Copyright 2026 CERN and copyright holders of ALICE O².
5+
* Author: Michal Tichak <michal.tichak@cern.ch>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU General Public License as published by

0 commit comments

Comments
 (0)