Skip to content

Commit f59eaea

Browse files
togashidmtmetsch
authored andcommitted
Release 0.3.0
- Versions bump for K8s 1.30 and Go 1.22. - Security patches. - Dependency Updates - Enabling Power KPIs in Custom Resource Definitions (CRDs). - Logs improvements. - Added timeout to HTTP clients. - Test timeout fixes. - Comprehensive Framework Testing. - Fine tuning on horizontal scaling model. - Increase data range usage for CPU rightsizing model. - Resource type changed to Int64. - Plugins refactoring. - Documentation updates. Co-authored-by: tmetsch tmetsch@users.noreply.github.com Co-authored-by: togashidm togashidm@users.noreply.github.com Co-authored-by: kcollinsInt kcollinsInt@users.noreply.github.com Co-authored-by: andrepcb andrepcb@users.noreply.github.com
1 parent fb972f0 commit f59eaea

File tree

107 files changed

+3359
-1282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+3359
-1282
lines changed

.github/workflows/sca.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: Shellcheck
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515
- run: |
1616
wget -q https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz
1717
tar -xvf shellcheck-stable.linux.x86_64.tar.xz
@@ -21,18 +21,18 @@ jobs:
2121
runs-on: ubuntu-latest
2222
name: Hadolint
2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2525
- run: wget -q https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64 -O hadolint; chmod +x hadolint ; find . -type f \( -name "Dockerfile*" \) -print0 | xargs -n 1 -0 ./hadolint ;
2626
gofmt-imports:
2727
runs-on: ubuntu-latest
2828
name: Go Fmt and Go Import
2929
steps:
30-
- uses: actions/checkout@v3
31-
- uses: actions/setup-go@v3
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-go@v5
3232
with:
33-
go-version: 1.19
33+
go-version-file: 'go.mod'
3434
- run: |
35-
go install golang.org/x/tools/cmd/goimports@v0.6.0 && goimports -l . && gofmt -l .
35+
go install golang.org/x/tools/cmd/goimports@v0.20.0 && goimports -l . && gofmt -l .
3636
shell: bash
3737
golangci:
3838
permissions:
@@ -41,12 +41,12 @@ jobs:
4141
runs-on: ubuntu-latest
4242
name: lint
4343
steps:
44-
- uses: actions/setup-go@v3
44+
- uses: actions/checkout@v4
45+
- uses: actions/setup-go@v5
4546
with:
46-
go-version: 1.19
47-
- uses: actions/checkout@v3
47+
go-version-file: 'go.mod'
4848
- name: golangci-lint
4949
run: |
50-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
50+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2
5151
make golangci-lint
5252
shell: bash

.github/workflows/test-build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: Set up Go
15-
uses: actions/setup-go@v3
15+
uses: actions/setup-go@v5
1616
with:
1717
go-version-file: 'go.mod'
1818
- name: Build
1919
run: make build && make build-plugins
2020
utests:
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424
- name: Set up Go
25-
uses: actions/setup-go@v3
25+
uses: actions/setup-go@v5
2626
with:
2727
go-version-file: 'go.mod'
2828
- name: Unit test
2929
run: make utest
3030
race:
3131
runs-on: ubuntu-latest
3232
steps:
33-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
3434
- name: Set up Go
35-
uses: actions/setup-go@v3
35+
uses: actions/setup-go@v5
3636
with:
3737
go-version-file: 'go.mod'
3838
- name: Test race
39-
run: go test -count=1 -race ./...
39+
run: go test -count=1 -parallel 1 -race ./...

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) 2022 Intel Corporation
22
# SPDX-License-Identifier: Apache-2.0
33

4-
FROM golang:1.19 AS build
4+
FROM golang:1.22 AS build
55

66
WORKDIR /app
77

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ RMPOD_PLUGIN=rm_pod
44
RDT_PLUGIN=rdt
55
CPU_PLUGIN=cpu_scale
66
GO_CILINT_CHECKERS=errcheck,goimports,gosec,gosimple,govet,ineffassign,nilerr,revive,staticcheck,unused
7-
DOCKER_IMAGE_VERSION=0.2.0
7+
DOCKER_IMAGE_VERSION=0.3.0
88

99
api:
1010
hack/generate_code.sh
@@ -57,7 +57,7 @@ prepare-build:
5757
go mod tidy
5858

5959
utest:
60-
go test -count=1 -v ./...
60+
go test -count=1 -parallel 1 -v ./...
6161

6262
test:
6363
hack/run_test.sh

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ Step 3) deploy the actuators of interest using:
6767

6868
These steps should be followed by setting up your default profiles (if needed).
6969

70-
We recommend the usage of a service mesh like [Linkerd](https://linkerd.io/) or [Istio](https://istio.io/) to ensure
71-
encryption and monitoring capabilities for the subcomponents of the planning framework themselves. After creating the
72-
namespace, enable auto-injection; For Linkerd do:
70+
We recommend the usage of a service mesh like [Linkerd](https://linkerd.io/) or [Istio](https://istio.io/) to ensure
71+
robust authentication, encryption and monitoring capabilities for the subcomponents of the planning framework
72+
themselves. After creating the namespace, <enable auto-injection; For Linkerd do:
7373

7474
$ k annotate ns ido linkerd.io/inject=enabled
7575

artefacts/deploy/manifest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ spec:
199199
serviceAccountName: planner-service-account
200200
containers:
201201
- name: planner
202-
image: 127.0.0.1:5000/planner:0.2.0
202+
image: 127.0.0.1:5000/planner:0.3.0
203203
ports:
204204
- containerPort: 33333
205205
imagePullPolicy: Always

artefacts/intents_crds_v1alpha1.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ spec:
7272
type: string
7373
description: "Target intents."
7474
jsonPath: .spec.objectives[*].targetName
75-
# BUG: https://github.com/kubernetes/kubectl/issues/517
75+
# Won't fix: https://github.com/kubernetes/kubectl/issues/517
7676
- name: Prio
7777
type: number
7878
description: "Priority."
@@ -122,7 +122,8 @@ spec:
122122
- availability
123123
- latency
124124
- throughput
125-
# TODO: power
125+
- power
126+
# TODO: carbon
126127
# TODO: assure cardinality: 0..1 avail & throughput, 0..* latency.
127128
props:
128129
type: object

cmd/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ func main() {
6666
defer planner.Stop()
6767

6868
// This is main controller.
69-
c := controller.NewController(cfg, k8sClient, podInformerFactory.Core().V1().Pods())
69+
tracer := controller.NewMongoTracer(cfg.Generic.MongoEndpoint)
70+
c := controller.NewController(cfg, tracer, k8sClient, podInformerFactory.Core().V1().Pods())
7071
c.SetPlanner(planner)
7172

7273
// 1/3 bring up the monitor for the KPIProfiles.

docs/actuators.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ The planner uses the actuators for a set of tasks:
2222

2323
## Interface
2424

25-
The interface an actuator needs to implement is defined [here](../pkg/planner/actuators/interface.go).
26-
27-
// ActuatorPlugin defines the interface for the actuators.
28-
type ActuatorPlugin interface {
29-
Plugin
30-
// NextState should return a set of potential follow-up states for a given state if this actuator would potentially be used.
31-
NextState(state *common.State, goal *common.State, profiles map[string]common.Profile) ([]common.State, []float64, []planner.Action)
32-
// Perform should perform those actions of the plan that it is in charge off.
33-
Perform(state *common.State, plan []planner.Action)
34-
// Effect should (optionally) recalculate the effect this actuator has for ALL objectives for this workload.
35-
Effect(state *common.State, profiles map[string]common.Profile)
36-
}
25+
The interface an actuator needs to implement is defined [here](../pkg/planner/actuators/types.go).
26+
27+
// Actuator defines the interface for the actuators.
28+
type Actuator interface {
29+
Plugin
30+
// NextState should return a set of potential follow-up states for a given state if this actuator would potentially be used.
31+
NextState(state *common.State, goal *common.State, profiles map[string]common.Profile) ([]common.State, []float64, []planner.Action)
32+
// Perform should perform those actions of the plan that it is in charge off.
33+
Perform(state *common.State, plan []planner.Action)
34+
// Effect should (optionally) recalculate the effect this actuator has for ALL objectives for this workload.
35+
Effect(state *common.State, profiles map[string]common.Profile)
36+
}
3737

3838
Each actuator will have a unique name and a group assignment.
3939

docs/pluggability.md

Lines changed: 6 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -20,74 +20,11 @@ After successful registration, the planner will call the functions **_NextState_
2020
[gRPC](https://grpc.io/). The bi-directional streaming is implemented on **_NextState_** which has demonstrated an
2121
improvement on the planner's performance.
2222

23-
## Implementing new plugins
23+
## Using GRPC to launch an actuator
2424

25-
To implement a new actuator plugin, the developer needs to follow these steps:
25+
The [plugins_helper](../plugins/plugins_helper.go) provides a function that can be used to connect an actuator with the
26+
rest of the framework. To do so, the user will need to provide the GRPC endpoint and port for the actuator as well as
27+
for the plugin manager:
2628

27-
1. Implement the new Actuator callbacks (NextState, Perform and Effect).
28-
2. Create a plugin stub by calling **_plugins.NewActuatorPluginStub_**.
29-
3. Set actuator callbacks for the stub.
30-
4. Start the Plugin server (listens for actuator gRPC calls).
31-
5. Register with the plugin-manager.
32-
6. Wait for termination.
33-
7. Stop the plugin stub.
34-
35-
Skeleton code for an actuator plugin can hence look like this:
36-
37-
package main
38-
39-
import (
40-
"os"
41-
"os/signal"
42-
43-
plugins "github.com/intel/intent-driven-orchestrationpkg/api/plugins/v1alpha1"
44-
"github.com/intel/intent-driven-orchestration/pkg/common"
45-
"github.com/intel/intent-driven-orchestration/pkg/controller"
46-
"github.com/intel/intent-driven-orchestration/pkg/planner"
47-
"github.com/intel/intent-driven-orchestration/pkg/planner/actuators"
48-
"k8s.io/klog/v2"
49-
...
50-
)
51-
52-
func NextState(state *common.State, goal *common.State, profiles map[string]common.Profile)
53-
([] common.State, []float64, []planner.Action) {
54-
klog.V(1).InfoS("Invoked NextState() callback")
55-
return ...
56-
}
57-
58-
func Perform(state *common.State, plan []planner.Action) {
59-
klog.V(1).InfoS("Invoked Perform() callback")
60-
return ...
61-
}
62-
63-
func (s *RmpodPluginHandler) Effect(state *common.State, profiles map[string]common.Profile) {
64-
klog.V(1).InfoS("Invoked Effect() callback")
65-
return ...
66-
}
67-
68-
func main() {
69-
klog.InitFlags(nil)
70-
...
71-
stub := plugins.NewActuatorPluginStub("plugin name", "plugin endpoint", some-port, "plugin-manager-service", 33333)
72-
stub.SetNextStateFunc(NextState)
73-
stub.SetPerformFunc(Perform)
74-
stub.SetEffectFunc(Effect)
75-
err = stub.Start()
76-
if err != nil {
77-
klog.Fatalf("Error starting plugin server: %s", err)
78-
}
79-
err = stub.Register()
80-
if err != nil {
81-
klog.Fatalf("Error registering plugin: %s", err)
82-
}
83-
signalChan := make(chan os.Signal, 1)
84-
signal.Notify(signalChan, os.Interrupt)
85-
<-signalChan
86-
err = stub.Stop()
87-
if err != nil {
88-
klog.Fatalf("Error stopping plugin server: %s", err)
89-
}
90-
}
91-
92-
Example usage in the current set of supported plugins can be found in the plugins folder under the root directory of the
93-
repository.
29+
actuator := <...>
30+
plugins.StartActuatorPlugin(actuator, "localhost", 12345, "localhost", "33333")

0 commit comments

Comments
 (0)