Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #81 from intel/kpm-2.5.0
Browse files Browse the repository at this point in the history
KPM v2.5.0 release
  • Loading branch information
adorney99 authored Jun 4, 2024
2 parents 5290f69 + a8d3f82 commit 5d3ddab
Show file tree
Hide file tree
Showing 59 changed files with 1,944 additions and 870 deletions.
2 changes: 2 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ AVD-KSV-0014
AVD-KSV-0017
# complains about wildcard in rbac but we need full privelages for those resources
AVD-KSV-0045
# libnghttp2 issue with redhat image. Latest base image not fixed yet
CVE-2024-27316
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export APP_NAME=intel-kubernetes-power-manager
# Current Operator version
VERSION ?= 2.4.0
VERSION ?= 2.5.0
# parameter used for helm chart image
HELM_CHART ?= v2.4.0
HELM_CHART ?= v2.5.0
HELM_VERSION := $(shell echo $(HELM_CHART) | cut -d "v" -f2)
# used to detemine if certain targets should build for openshift
OCP ?= false
Expand Down Expand Up @@ -127,7 +127,7 @@ else
sed -i 's/- .*\/rbac\.yaml/- \.\/ocp\/rbac.yaml/' config/rbac/kustomization.yaml
sed -i 's/- .*\/role\.yaml/- \.\/ocp\/role.yaml/' config/rbac/kustomization.yaml
endif
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook crd paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases

# Run go fmt against code
fmt:
Expand Down Expand Up @@ -169,7 +169,7 @@ push:
# download controller-gen if necessary
controller-gen:
ifeq (, $(shell which controller-gen))
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.9.0
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
Expand Down Expand Up @@ -246,7 +246,7 @@ verify-test: tidy
go test -count=1 -v ./...

race: tidy
CGO_ENABLED=1 go test -count=1 -race -v ./...
CGO_ENABLED=1 go test -count=1 -race -v ./...

clean:
go clean --cache
Expand All @@ -260,4 +260,4 @@ update:
sed -i 's/intel\/power-operator.*$$/intel\/power-operator:v$(VERSION)/' config/manager/manager.yaml
sed -i 's/intel\/power-operator.*$$/intel\/power-operator_ocp-$(OCP_VERSION):v$(VERSION)/' config/manager/ocp/manager.yaml
sed -i 's/intel\/power-node-agent.*$$/intel\/power-node-agent:v$(VERSION)/' build/manifests/power-node-agent-ds.yaml
sed -i 's/intel\/power-node-agent.*$$/intel\/power-node-agent_ocp-$(OCP_VERSION):v$(VERSION)/' build/manifests/ocp/power-node-agent-ds.yaml
sed -i 's/intel\/power-node-agent.*$$/intel\/power-node-agent_ocp-$(OCP_VERSION):v$(VERSION)/' build/manifests/ocp/power-node-agent-ds.yaml
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,23 @@ spec:
- PowerNode CRD
- C-State CRD

If any error occurs it will be displayed in the status field of the custom resource, eg.
````yaml
apiVersion: power.intel.com/v1
kind: CStates
...
status:
errors:
- the C-States CRD name must match name of one of the power nodes
````
If no errors occurred or were corrected, the list will be empty
````yaml
apiVersion: power.intel.com/v1
kind: CStates
...
status:
errors: []
````
### Node Agent Pod

The Pod Controller watches for pods. When a pod comes along the Pod Controller checks if the pod is in the guaranteed
Expand Down
34 changes: 34 additions & 0 deletions api/v1/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1

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

type StatusErrors struct {
Errors []string `json:"errors,omitempty"`
}

// +kubebuilder:object:generate=false
type PowerCRWithStatusErrors interface {
metav1.Object
runtime.Object
SetStatusErrors(errs *[]string)
GetStatusErrors() *[]string
}
11 changes: 9 additions & 2 deletions api/v1/cstates_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ type CStatesSpec struct {

// CStatesStatus defines the observed state of CStates
type CStatesStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
StatusErrors `json:",inline,omitempty"`
}

//+kubebuilder:object:root=true
Expand All @@ -60,6 +59,14 @@ type CStatesList struct {
Items []CStates `json:"items"`
}

func (csts *CStates) SetStatusErrors(errs *[]string) {
csts.Status.Errors = *errs
}

func (csts *CStates) GetStatusErrors() *[]string {
return &csts.Status.Errors
}

func init() {
SchemeBuilder.Register(&CStates{}, &CStatesList{})
}
6 changes: 2 additions & 4 deletions api/v1/powerconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ type PowerConfigSpec struct {

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

// The Nodes that the Node Agent has been deployed to
Nodes []string `json:"nodes,omitempty"`
Nodes []string `json:"nodes,omitempty"`
StatusErrors `json:",inline,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
10 changes: 9 additions & 1 deletion api/v1/powerprofile_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ type PowerProfileSpec struct {
// PowerProfileStatus defines the observed state of PowerProfile
type PowerProfileStatus struct {
// The ID given to the power profile
ID int `json:"id"`
ID int `json:"id,omitempty"`
StatusErrors `json:",inline,omitempty"`
}

// +kubebuilder:object:root=true
Expand All @@ -69,6 +70,13 @@ type PowerProfileList struct {
Items []PowerProfile `json:"items"`
}

func (prfl *PowerProfile) SetStatusErrors(errs *[]string) {
prfl.Status.Errors = *errs
}
func (prfl *PowerProfile) GetStatusErrors() *[]string {
return &prfl.Status.Errors
}

func init() {
SchemeBuilder.Register(&PowerProfile{}, &PowerProfileList{})
}
17 changes: 12 additions & 5 deletions api/v1/powerworkload_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,15 @@ type PowerWorkloadSpec struct {
}

type ReservedSpec struct {
Cores [] uint `json:"cores"`
Cores []uint `json:"cores"`
PowerProfile string `json:"powerProfile,omitempty"`
}

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

// The Node that this Shared PowerWorkload is associated with
Node string `json:"node:,omitempty"`
Node string `json:"node:,omitempty"`
StatusErrors `json:",inline,omitempty"`
}

// +kubebuilder:object:root=true
Expand All @@ -92,6 +91,14 @@ type PowerWorkloadList struct {
Items []PowerWorkload `json:"items"`
}

func (wrkld *PowerWorkload) SetStatusErrors(errs *[]string) {
wrkld.Status.Errors = *errs
}

func (wrkld *PowerWorkload) GetStatusErrors() *[]string {
return &wrkld.Status.Errors
}

func init() {
SchemeBuilder.Register(&PowerWorkload{}, &PowerWorkloadList{})
}
10 changes: 10 additions & 0 deletions api/v1/timeofday_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ type TimeOfDayStatus struct {

// PowerProfile associated with Time of Day
PowerProfile string `json:"powerProfile,omitempty"`

StatusErrors `json:",inline,omitempty"`
}

//+kubebuilder:object:root=true
Expand All @@ -80,6 +82,14 @@ type TimeOfDayList struct {
Items []TimeOfDay `json:"items"`
}

func (tod *TimeOfDay) SetStatusErrors(errs *[]string) {
tod.Status.Errors = *errs
}

func (tod *TimeOfDay) GetStatusErrors() *[]string {
return &tod.Status.Errors
}

func init() {
SchemeBuilder.Register(&TimeOfDay{}, &TimeOfDayList{})
}
12 changes: 9 additions & 3 deletions api/v1/timeofdaycronjob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ type PodInfo struct {
}

// TimeOfDayCronJobStatus defines the observed state of TimeOfDayCronJob

type TimeOfDayCronJobStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Active []v1.ObjectReference `json:"active,omitempty"`
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"`
LastSuccessfulTime *metav1.Time `json:"lastSuccessfulTime,omitempty"`

StatusErrors `json:",inline,omitempty"`
}

//+kubebuilder:object:root=true
Expand All @@ -74,6 +73,13 @@ type TimeOfDayCronJobList struct {
Items []TimeOfDayCronJob `json:"items"`
}

func (todcr *TimeOfDayCronJob) SetStatusErrors(errs *[]string) {
todcr.Status.Errors = *errs
}
func (todcr *TimeOfDayCronJob) GetStatusErrors() *[]string {
return &todcr.Status.Errors
}

func init() {
SchemeBuilder.Register(&TimeOfDayCronJob{}, &TimeOfDayCronJobList{})
}
11 changes: 9 additions & 2 deletions api/v1/uncore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ type DieSelector struct {

// UncoreStatus defines the observed state of Uncore
type UncoreStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
StatusErrors `json:",inline,omitempty"`
}

//+kubebuilder:object:root=true
Expand All @@ -67,6 +66,14 @@ type UncoreList struct {
Items []Uncore `json:"items"`
}

func (ucnre *Uncore) SetStatusErrors(err *[]string) {
ucnre.Status.Errors = *err
}

func (ucnre *Uncore) GetStatusErrors() *[]string {
return &ucnre.Status.Errors
}

func init() {
SchemeBuilder.Register(&Uncore{}, &UncoreList{})
}
Loading

0 comments on commit 5d3ddab

Please sign in to comment.