Skip to content
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
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ output:
linters:
disable-all: true
enable:
# - deadcode
- deadcode
- errcheck
# - gofmt
- gosimple
Expand Down
10 changes: 0 additions & 10 deletions lib/resourcemerge/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,16 +508,6 @@ func ensureCapabilities(modified *bool, existing *corev1.Capabilities, required
}
}

func setStringSliceIfSet(modified *bool, existing *[]string, required []string) {
if required == nil {
return
}
if !equality.Semantic.DeepEqual(required, *existing) {
*existing = required
*modified = true
}
}

func setStringSlice(modified *bool, existing *[]string, required []string) {
if !reflect.DeepEqual(required, *existing) {
*existing = required
Expand Down
14 changes: 0 additions & 14 deletions lib/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,6 @@ func countPayloadsForVersion(config *configv1.ClusterVersion, version string) in
return 0
}

func hasAmbiguousPayloadForVersion(config *configv1.ClusterVersion, version string) bool {
for _, update := range config.Status.AvailableUpdates {
if update.Version == version {
return len(update.Image) > 0
}
}
for _, history := range config.Status.History {
if history.Version == version {
return len(history.Image) > 0
}
}
return false
}

func ClearInvalidFields(config *configv1.ClusterVersion, errs field.ErrorList) *configv1.ClusterVersion {
if len(errs) == 0 {
return config
Expand Down
5 changes: 0 additions & 5 deletions pkg/cvo/cvo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3313,11 +3313,6 @@ func expectCreate(t *testing.T, a ktesting.Action, resource, namespace string, o
expectMutation(t, a, "create", resource, "", namespace, obj)
}

func expectUpdate(t *testing.T, a ktesting.Action, resource, namespace string, obj interface{}) {
t.Helper()
expectMutation(t, a, "update", resource, "", namespace, obj)
}

func expectUpdateStatus(t *testing.T, a ktesting.Action, resource, namespace string, obj interface{}) {
t.Helper()
expectMutation(t, a, "update", resource, "status", namespace, obj)
Expand Down
15 changes: 0 additions & 15 deletions pkg/cvo/internal/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ package internal

import (
"context"
"encoding/json"
"fmt"

"github.com/openshift/cluster-version-operator/lib/resourceapply"

apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/diff"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/strategicpatch"
"k8s.io/client-go/dynamic"
"k8s.io/klog/v2"

Expand Down Expand Up @@ -152,15 +149,3 @@ func (b *genericBuilder) Do(ctx context.Context) error {
}
return err
}

func createPatch(original, modified runtime.Object) ([]byte, error) {
originalData, err := json.Marshal(original)
if err != nil {
return nil, err
}
modifiedData, err := json.Marshal(modified)
if err != nil {
return nil, err
}
return strategicpatch.CreateTwoWayMergePatch(originalData, modifiedData, original)
}
8 changes: 0 additions & 8 deletions pkg/cvo/internal/operatorstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"sort"
"strings"
"unicode"

kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -232,10 +231,3 @@ func checkOperatorHealth(ctx context.Context, client ClusterOperatorsGetter, exp

return nil
}

func lowerFirst(str string) string {
for i, v := range str {
return string(unicode.ToLower(v)) + str[i+1:]
}
return ""
}
12 changes: 0 additions & 12 deletions pkg/cvo/sync_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/prometheus/client_golang/prometheus"
"golang.org/x/time/rate"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/errors"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
Expand All @@ -23,7 +22,6 @@ import (

configv1 "github.com/openshift/api/config/v1"

"github.com/openshift/cluster-version-operator/lib/resourcebuilder"
"github.com/openshift/cluster-version-operator/pkg/payload"
"github.com/openshift/cluster-version-operator/pkg/payload/precondition"
"github.com/openshift/library-go/pkg/manifest"
Expand Down Expand Up @@ -1072,16 +1070,6 @@ func getOverrideForManifest(overrides []configv1.ComponentOverride, manifest *ma
return configv1.ComponentOverride{}, false
}

// ownerKind contains the schema.GroupVersionKind for type that owns objects managed by CVO.
var ownerKind = configv1.SchemeGroupVersion.WithKind("ClusterVersion")

func ownerRefModifier(config *configv1.ClusterVersion) resourcebuilder.MetaV1ObjectModifierFunc {
oref := metav1.NewControllerRef(config, ownerKind)
return func(obj metav1.Object) {
obj.SetOwnerReferences([]metav1.OwnerReference{*oref})
}
}

// runThrottledStatusNotifier invokes fn every time ch is updated, but no more often than once
// every interval. If bucket is non-zero then the channel is throttled like a rate limiter bucket.
func runThrottledStatusNotifier(ctx context.Context, interval time.Duration, bucket int, ch <-chan SyncWorkerStatus, fn func()) {
Expand Down
9 changes: 0 additions & 9 deletions pkg/payload/task_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,6 @@ func (g *TaskGraph) Tree() string {
return strings.Join(out, "\n")
}

func covers(all []int, some []int) bool {
for _, i := range some {
if all[i] == 0 {
return false
}
}
return true
}

func (g *TaskGraph) bulkAdd(nodes []*TaskNode, inNodes []int) []int {
from := len(g.Nodes)
g.Nodes = append(g.Nodes, nodes...)
Expand Down