Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.codespell*,.github,*: add codespell configuration, workflow, fix codespell errors. #356

Merged
merged 4 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .codespellignorelines
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
( vm-command "kubectl delete pods -n kube-system \$(kubectl get pods -n kube-system | awk '/t[0-9]r[gb][ue]/{print \$1}')" ) || true
( vm-command "kubectl delete pods -n default \$(kubectl get pods -n default | awk '/t[0-9][rgb][ue][0-9]/{print \$1}')" ) || true
docker run -v "$(pwd):/mnt/models" "$FMBT_IMAGE" sh -c 'cd /mnt/models; fmbt tmp.fuzz.fmbt.conf 2>/dev/null | fmbt-log -f STEP\$sn\$as\$al' | grep -v AAL | sed -e 's/^, / /g' -e '/^STEP/! s/\(^.*\)/echo "TESTGEN: \1"/g' -e 's/^STEP\([0-9]*\)i:\(.*\)/echo "TESTGEN: STEP \1"; vm-command "date +%T.%N"; \2; vm-command "date +%T.%N"; kubectl get pods -A/g' | sed "s/\([^a-z0-9]\)\(r\?\)\(gu\|bu\|be\)\([0-9]\)/\1t${testid}\2\3\4/g" > "$OUTFILE"
allocs := map[string]cpuset.CPUSet{"--:allo": currentCpus}
allocName := fmt.Sprintf("%02d:allo", i+1)
preferTightestFit = func(cA, cB *cpuCluster, pkgA, pkgB, dieA, dieB int, csetA, csetB cpuset.CPUSet) (r int) {
if dieA >= a.cnt && dieB < a.cnt {
if dieA < a.cnt && dieB >= a.cnt {
if dieA >= a.cnt && dieB >= a.cnt {
if diff := dieA - dieB; diff != 0 {
2 changes: 2 additions & 0 deletions .codespellignorewords
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
clos
NotIn
4 changes: 4 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
skip = .git,*.pdf,*.svg,go.sum,go.mod,./cmd/plugins/topology-aware/policy
ignore-words = .codespellignorewords
exclude-file = .codespellignorelines
18 changes: 18 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Codespell

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Codespell
uses: codespell-project/actions-codespell@v2
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,9 @@ verify-build: build

verify-docs: site-build clean-html

verify-codespell codespell:
$(Q) codespell

#
# targets for installing dependencies
#
Expand Down
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The estimated complexity and priority of a feature/task is defined like this:
- [ ] eliminate need for saving cache to disk, C2
- config
- [ ] switch to using CRDs (from ConfigMaps), C2
- [ ] consider usig 1 CRD per policy as opposed to a single 'union' CRD, C2
- [ ] consider using 1 CRD per policy as opposed to a single 'union' CRD, C2
- [ ] create helm chart support for the resource policies, C1
- policies
- [ ] remove support for multiple policies in a single binary, C1
Expand Down
2 changes: 1 addition & 1 deletion cmd/plugins/topology-aware/policy/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const (
)

func (p *policy) saveAllocations() {
p.cache.SetPolicyEntry(keyAllocations, cache.Cachable(&p.allocations))
p.cache.SetPolicyEntry(keyAllocations, cache.Cacheable(&p.allocations))
p.cache.Save()
}

Expand Down
6 changes: 3 additions & 3 deletions config/crd/bases/config.nri_balloonspolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec:
consist of a key, an operator and a set of values. An expressions is
evaluated against an object which implements the Evaluable interface.
Evaluating an expression consists of looking up the value for the key
in the object, then using the operator to check it agains the values
in the object, then using the operator to check it against the values
of the expression. The result is a single boolean value. An object is
said to satisfy the evaluated expression if this value is true. An
expression can contain 0, 1 or more values depending on the operator.
Expand Down Expand Up @@ -217,7 +217,7 @@ spec:
preferPerNamespaceBalloon:
description: |-
PreferPerNamespaceBalloon: if true, containers in different
namespaces are preferrably placed in separate balloons,
namespaces are preferably placed in separate balloons,
even if the balloon type is the same for all of them. On
the other hand, containers in the same namespace will be
placed in the same balloon instances. The default is false:
Expand Down Expand Up @@ -406,7 +406,7 @@ spec:
consist of a key, an operator and a set of values. An expressions is
evaluated against an object which implements the Evaluable interface.
Evaluating an expression consists of looking up the value for the key
in the object, then using the operator to check it agains the values
in the object, then using the operator to check it against the values
of the expression. The result is a single boolean value. An object is
said to satisfy the evaluated expression if this value is true. An
expression can contain 0, 1 or more values depending on the operator.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ spec:
consist of a key, an operator and a set of values. An expressions is
evaluated against an object which implements the Evaluable interface.
Evaluating an expression consists of looking up the value for the key
in the object, then using the operator to check it agains the values
in the object, then using the operator to check it against the values
of the expression. The result is a single boolean value. An object is
said to satisfy the evaluated expression if this value is true. An
expression can contain 0, 1 or more values depending on the operator.
Expand Down Expand Up @@ -217,7 +217,7 @@ spec:
preferPerNamespaceBalloon:
description: |-
PreferPerNamespaceBalloon: if true, containers in different
namespaces are preferrably placed in separate balloons,
namespaces are preferably placed in separate balloons,
even if the balloon type is the same for all of them. On
the other hand, containers in the same namespace will be
placed in the same balloon instances. The default is false:
Expand Down Expand Up @@ -406,7 +406,7 @@ spec:
consist of a key, an operator and a set of values. An expressions is
evaluated against an object which implements the Evaluable interface.
Evaluating an expression consists of looking up the value for the key
in the object, then using the operator to check it agains the values
in the object, then using the operator to check it against the values
of the expression. The result is a single boolean value. An object is
said to satisfy the evaluated expression if this value is true. An
expression can contain 0, 1 or more values depending on the operator.
Expand Down
2 changes: 1 addition & 1 deletion docs/deployment/helm/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ All the available charts can be found in [artifacthub.io](https://artifacthub.io
- kubernetes version: 1.28.x
- containerd version: 1.7
- node image: Container-Optimized OS from Google (COS), Ubuntu 22.04
- Azure AKS
- Azure Kubernetes Service
- kubernetes version: 1.28.x
- containerd version: 1.7
- node image: Azure Linux Container Host, Ubuntu 20.04
Expand Down
2 changes: 1 addition & 1 deletion docs/memory/memory-qos.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ unifiedannotations:

This configuration defines the following.

- If a container belogs to the memory QoS class `bronze` has allocated
- If a container belongs to the memory QoS class `bronze` has allocated
half of the memory of its `resources.limits.memory`, next
allocations will cause kernel to swap out corresponding amount of
container's memory. In other words, when container's memory usage is
Expand Down
2 changes: 1 addition & 1 deletion docs/resource-policy/developers-guide/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ of activating and dispatching calls through to the configured active policy.
The generic resource controller layer defines the abstract interface the rest
of NRI-RP uses to interact with resource controller implementations and takes
care of the details of dispatching calls to the controller implementations
for post-policy enforcment of decisions.
for post-policy enforcement of decisions.

### [Metrics Collector](tree:/pkg/metrics/)

Expand Down
2 changes: 1 addition & 1 deletion docs/resource-policy/policy/balloons.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Balloons policy parameters:
balloon(s).
- `preferPerNamespaceBalloon`: if `true`, containers in the same
namespace will be placed in the same balloon(s). On the other
hand, containers in different namespaces are preferrably placed in
hand, containers in different namespaces are preferably placed in
different balloons. The default is `false`: namespace has no
effect on choosing the balloon of this type.
- `preferNewBalloons`: if `true`, prefer creating new balloons over
Expand Down
10 changes: 5 additions & 5 deletions docs/resource-policy/policy/topology-aware.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ behavior. These options can be supplied as part of the effective
- whether shared allocation is preferred by default for workloads that
would be otherwise eligible for exclusive CPU allocation
- `reservedPoolNamespaces`
- list of extra namespaces (or glob patters) that will be allocated to
- list of extra namespaces (or glob patterns) that will be allocated to
reserved CPUs
- `colocatePods`
- whether try to allocate containers in a pod to the same or close by
Expand Down Expand Up @@ -496,7 +496,7 @@ However as a general rule of thumb containers running
These hints are expressed by `container affinity annotations` on the Pod.
There are two types of affinities:

- `affinity` (or `positive affinty`): cause affected containers to *pull* each
- `affinity` (or `positive affinity`): cause affected containers to *pull* each
other closer
- `anti-affinity` (or `negative affinity`): cause affected containers to *push*
each other further away
Expand All @@ -516,7 +516,7 @@ annotation. They are specified in the `metadata` section of the `Pod YAML`, unde

```yaml
metadata:
anotations:
annotations:
resource-policy.nri.io/affinity: |
container1:
- scope:
Expand All @@ -541,7 +541,7 @@ as the annotation key.

```yaml
metadata:
anotations:
annotations:
resource-policy.nri.io/anti-affinity: |
container1:
- scope:
Expand Down Expand Up @@ -585,7 +585,7 @@ is. This is useful in situations where the policy needs to make some
compromises because an optimal placement is not possible. The weight then also
acts as a way to specify preferences of priorities between the various
compromises: the heavier the weight the stronger the pull or push and the
larger the propbability that it will be honored, if this is possible at all.
larger the probability that it will be honored, if this is possible at all.

The scope can be omitted from an affinity in which case it implies *Pod scope*,
in other words the scope of all containers that belong to the same Pod as the
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/node-resource-topology.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (a *Agent) UpdateNrtCR(policy string, zones []*policyapi.TopologyZone) erro

// To minimize the risk of an NRI request timeout (and the plugin getting
// kicked out) we do the update asynchronously. We can rework this to use
// a single goroutine that reads update requests from a channel to mimick
// a single goroutine that reads update requests from a channel to mimic
// the rest if necessary.
// XXX TODO(klihub): We can't/don't propagate update errors now back
// to the caller. We could do that (using a channel) if necessary...
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/config/v1alpha1/resmgr/policy/balloons/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ type BalloonDef struct {
// placing containers of a pod to the same balloon(s).
PreferSpreadingPods bool `json:"preferSpreadingPods,omitempty"`
// PreferPerNamespaceBalloon: if true, containers in different
// namespaces are preferrably placed in separate balloons,
// namespaces are preferably placed in separate balloons,
// even if the balloon type is the same for all of them. On
// the other hand, containers in the same namespace will be
// placed in the same balloon instances. The default is false:
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/resmgr/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package resmgr
// consist of a key, an operator and a set of values. An expressions is
// evaluated against an object which implements the Evaluable interface.
// Evaluating an expression consists of looking up the value for the key
// in the object, then using the operator to check it agains the values
// in the object, then using the operator to check it against the values
// of the expression. The result is a single boolean value. An object is
// said to satisfy the evaluated expression if this value is true. An
// expression can contain 0, 1 or more values depending on the operator.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cgroups/cgroupblkio.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func readFromFileInDir(baseDir string, filenames []string) (string, error) {
return "", nil
}

// SetBlkioParameters writes OCI BlockIO parameters to files in cgroups blkio contoller directory.
// SetBlkioParameters writes OCI BlockIO parameters to files in cgroups blkio controller directory.
func SetBlkioParameters(cgroupsDir string, blockIO OciBlockIOParameters) error {
log.Debug("configuring cgroups blkio controller in directory %#v with parameters %+v", cgroupsDir, blockIO)
errs := []error{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cgroups/cgroupstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type NumaLine struct {
Nodes map[string]int64
}

// NumaStat has parsed contets of a NUMA statistics file.
// NumaStat has parsed contents of a NUMA statistics file.
type NumaStat struct {
Total NumaLine
File NumaLine
Expand Down
4 changes: 2 additions & 2 deletions pkg/cpuallocator/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func (a *allocatorHelper) takeCacheGroups() {
// c. allocate using the smallest number of groups (largest to smallest)
//
// Notes:
// We might consider letting the requestor control some aspects of allocation,
// We might consider letting the requester control some aspects of allocation,
// for instance:
// - use only full idle groups (ideal maximum isolation)
// - use only full idle groups, and 1 fragmented (maximum isolation)
Expand Down Expand Up @@ -805,7 +805,7 @@ func (a *allocatorHelper) takeCacheGroups() {
g := groups[0]
cset := sorter.cpus[g]

log.Debug("=> took reamining %d CPUs (%s) of usable cache group %s", cnt, cset, g)
log.Debug("=> took remaining %d CPUs (%s) of usable cache group %s", cnt, cset, g)

result = result.Union(cset)
from = from.Difference(cset)
Expand Down
2 changes: 1 addition & 1 deletion pkg/log/ratelimit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestRateLimit(t *testing.T) {
limiters[msg] = rl.getMessageLimit(msg)
}

// check looked up vs. stored limters
// check looked up vs. stored limiters
for msg, limiter := range limiters {
if rl.getMessageLimit(msg) != limiter {
t.Errorf("unexpected new limiter for message %s", msg)
Expand Down
2 changes: 1 addition & 1 deletion pkg/resmgr/cache/affinity.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (pca *podContainerAffinity) parseSimple(pod *pod, value string, weight int3
//
// Notes:
// We turn affinities given in the simple notation into a symmetric set of
// affinities. IOW, if X has affinity on Y with wight W, then Y will have
// affinities. IOW, if X has affinity on Y with weight W, then Y will have
// affinity on X with W as well. In practice this is done by
// 1) ensuring there is an affinity Y: X for every affinity X: Y
// 2) generating an affinity expression for every container with affinities
Expand Down
18 changes: 9 additions & 9 deletions pkg/resmgr/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type Pod interface {
// GetProcesses returns the pids of all processes in the pod either excluding
// container processes, if called with false, or including those if called with true.
GetProcesses(bool) ([]string, error)
// GetTasks returns the pids of all threads in the pod either excluding cotnainer
// GetTasks returns the pids of all threads in the pod either excluding container
// processes, if called with false, or including those if called with true.
GetTasks(bool) ([]string, error)
}
Expand Down Expand Up @@ -339,7 +339,7 @@ type container struct {
type Mount = nri.Mount
type Device = nri.LinuxDevice

type Cachable interface {
type Cacheable interface {
// Set value (via a pointer receiver) to the object.
Set(value interface{})
// Get the object that should be cached.
Expand All @@ -349,7 +349,7 @@ type Cachable interface {
// Cache is the primary interface exposed for tracking pods and containers.
//
// Cache tracks pods and containers in the runtime, mostly by processing CRI
// requests and responses which the cache is fed as these are being procesed.
// requests and responses which the cache is fed as these are being processed.
// Cache also saves its state upon changes to secondary storage and restores
// itself upon startup.
type Cache interface {
Expand All @@ -368,7 +368,7 @@ type Cache interface {
// LookupContainerByCgroup looks up a container for the given cgroup path.
LookupContainerByCgroup(path string) (Container, bool)

// GetPendingContainers returs all containers with pending changes.
// GetPendingContainers returns all containers with pending changes.
GetPendingContainers() []Container

// GetPods returns all the pods known to the cache.
Expand Down Expand Up @@ -497,7 +497,7 @@ func (cch *cache) GetActivePolicy() string {
return cch.PolicyName
}

// SetActivePolicy updaes the name of the active policy stored in the cache.
// SetActivePolicy updates the name of the active policy stored in the cache.
func (cch *cache) SetActivePolicy(policy string) error {
cch.PolicyName = policy
return cch.Save()
Expand Down Expand Up @@ -849,8 +849,8 @@ func unmarshalEntry(data []byte, ptr interface{}) error {

// Cache an unmarshaled opaque policy entry, special-casing some simple/common types.
func (cch *cache) cacheEntry(key string, ptr interface{}) error {
if cachable, ok := ptr.(Cachable); ok {
cch.policyData[key] = cachable.Get()
if cacheable, ok := ptr.(Cacheable); ok {
cch.policyData[key] = cacheable.Get()
return nil
}

Expand Down Expand Up @@ -890,8 +890,8 @@ func (cch *cache) cacheEntry(key string, ptr interface{}) error {

// Serve an unmarshaled opaque policy entry, special-casing some simple/common types.
func (cch *cache) setEntry(key string, ptr, obj interface{}) error {
if cachable, ok := ptr.(Cachable); ok {
cachable.Set(obj)
if cacheable, ok := ptr.(Cacheable); ok {
cacheable.Set(obj)
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/resmgr/cache/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ func (c *container) PreserveMemoryResources() bool {
}

var (
// More complext rules, for Kubelet secrets and config maps
// More complex rules, for Kubelet secrets and config maps
ignoredTopologyPathRegexps = []*regexp.Regexp{
// Kubelet directory can be different, but we can detect it by structure inside of it.
// For now, we can safely ignore exposed config maps and secrets for topology hints.
Expand Down
2 changes: 1 addition & 1 deletion pkg/resmgr/control/cpu/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func getClassAssignments(c cache.Cache) *cpuClassAssignments {

// Save the state of CPU class assignments in cache
func setClassAssignments(c cache.Cache, a *cpuClassAssignments) {
c.SetPolicyEntry(cacheKeyCPUAssignments, cache.Cachable(a))
c.SetPolicyEntry(cacheKeyCPUAssignments, cache.Cacheable(a))
}

// Set the value of cached cpuClassAssignments
Expand Down
4 changes: 2 additions & 2 deletions pkg/resmgr/nri.go
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ func (p *nriPlugin) runPostStartHooks(method string, c cache.Container) error {
return nil
}

// runPostReleaseHooks runs the necessary hooks after releaseing resources of some containers
// runPostReleaseHooks runs the necessary hooks after releasing resources of some containers
func (p *nriPlugin) runPostReleaseHooks(method string, released ...cache.Container) error {
m := p.resmgr
for _, c := range released {
Expand All @@ -1058,7 +1058,7 @@ func (p *nriPlugin) runPostReleaseHooks(method string, released ...cache.Contain
return nil
}

// runPostUpdateHooks runs the necessary hooks after reconcilation.
// runPostUpdateHooks runs the necessary hooks after reconciliation.
func (p *nriPlugin) runPostUpdateHooks(method string) error {
m := p.resmgr
for _, c := range m.cache.GetPendingContainers() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/resmgr/policy/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ type policy struct {

// backend is a registered Backend.
type backend struct {
name string // unqiue backend name
name string // unique backend name
description string // verbose backend description
create CreateFn // backend creation function
}
Expand Down
Loading