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 central/detection/alertmanager/alert_manager_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func mergeAlerts(old, newAlert *storage.Alert) *storage.Alert {
if newAlert.GetLifecycleStage() == storage.LifecycleStage_DEPLOY && old.GetLifecycleStage() == storage.LifecycleStage_DEPLOY {
newAlert.Enforcement = old.GetEnforcement()
// Don't keep updating the timestamp of the violation _unless_ the violations are actually different.
if protoutils.EqualStorageAlert_ViolationSlices(newAlert.GetViolations(), old.GetViolations()) {
if protoutils.SlicesEqual(newAlert.GetViolations(), old.GetViolations()) {
newAlert.Time = old.GetTime()
}
}
Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/proxy/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func updateProxyEnvSecret(ctx context.Context, obj k8sutil.Object, client ctrlCl
strData[k] = string(v)
}

if maputil.StringStringMapsEqual(strData, proxyEnvVars) {
if maputil.Equal(strData, proxyEnvVars) {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/auth/authproviders/oidc/backend_factory_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ func (f *factory) ResolveProviderAndClientState(state string) (string, string, e

func (f *factory) RedactConfig(config map[string]string) map[string]string {
if config[clientSecretConfigKey] != "" {
config = maputil.CloneStringStringMap(config)
config = maputil.ShallowClone(config)
config[clientSecretConfigKey] = "*****"
}
return config
}

func (f *factory) MergeConfig(newCfg, oldCfg map[string]string) map[string]string {
mergedCfg := maputil.CloneStringStringMap(newCfg)
mergedCfg := maputil.ShallowClone(newCfg)
// This handles the case where the client sends an "unchanged" client secret. In that case,
// we will take the client secret from the stored config and put it into the merged config.
// We only put secret into the merged config if the new config says it wants to use a client secret, AND the client
Expand Down
3 changes: 0 additions & 3 deletions pkg/detection/generate.go

This file was deleted.

131 changes: 0 additions & 131 deletions pkg/detection/map_gen.go

This file was deleted.

3 changes: 2 additions & 1 deletion pkg/detection/policy_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package detection
import (
"github.com/stackrox/rox/generated/storage"
"github.com/stackrox/rox/pkg/logging"
"github.com/stackrox/rox/pkg/maputil"
)

var (
Expand All @@ -24,6 +25,6 @@ type PolicySet interface {
// NewPolicySet returns a new instance of a PolicySet.
func NewPolicySet() PolicySet {
return &setImpl{
policyIDToCompiled: NewStringCompiledPolicyFastRMap(),
policyIDToCompiled: maputil.NewFastRMap[string, CompiledPolicy](),
}
}
3 changes: 2 additions & 1 deletion pkg/detection/policy_set_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (

"github.com/stackrox/rox/generated/storage"
"github.com/stackrox/rox/pkg/errorhelpers"
"github.com/stackrox/rox/pkg/maputil"
)

type setImpl struct {
policyIDToCompiled StringCompiledPolicyFastRMap
policyIDToCompiled *maputil.FastRMap[string, CompiledPolicy]
}

func (p *setImpl) ForEach(f func(policy CompiledPolicy) error) error {
Expand Down
4 changes: 2 additions & 2 deletions pkg/helm/charts/tests/centralservices/customize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (s *customizeSuite) TestCustomizeMetadata() {
obj := objs[i]
for _, mdType := range []string{"labels", "annotations"} {
objRef := k8sobjects.RefOf(&obj)
expectedMD := maputil.CloneStringStringMap(expectedMDs[mdType][objRef])
expectedMD := maputil.ShallowClone(expectedMDs[mdType][objRef])

actualMD, found, err := unstructured.NestedStringMap(obj.Object, "metadata", mdType)
s.Require().NoErrorf(err, "could not retrieve %s metadata for object %v", mdType, objRef)
Expand Down Expand Up @@ -225,7 +225,7 @@ func (s *customizeSuite) TestCustomizePodMetadata() {

for _, mdType := range []string{"labels", "annotations"} {
objRef := k8sobjects.RefOf(&obj)
expectedMD := maputil.CloneStringStringMap(expectedMDs[mdType][objRef])
expectedMD := maputil.ShallowClone(expectedMDs[mdType][objRef])

actualMD, found, err := unstructured.NestedStringMap(obj.Object, "spec", "template", "metadata", mdType)
s.Require().NoErrorf(err, "could not retrieve %s metadata for object %v", mdType, objRef)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (s *customizeSuite) TestCustomizeMetadata() {
obj := objs[i]
for _, mdType := range []string{"labels", "annotations"} {
objRef := k8sobjects.RefOf(&obj)
expectedMD := maputil.CloneStringStringMap(expectedMDs[mdType][objRef])
expectedMD := maputil.ShallowClone(expectedMDs[mdType][objRef])

actualMD, found, err := unstructured.NestedStringMap(obj.Object, "metadata", mdType)
s.Require().NoErrorf(err, "could not retrieve %s metadata for object %v", mdType, objRef)
Expand Down Expand Up @@ -226,7 +226,7 @@ func (s *customizeSuite) TestCustomizePodMetadata() {

for _, mdType := range []string{"labels", "annotations"} {
objRef := k8sobjects.RefOf(&obj)
expectedMD := maputil.CloneStringStringMap(expectedMDs[mdType][objRef])
expectedMD := maputil.ShallowClone(expectedMDs[mdType][objRef])

actualMD, found, err := unstructured.NestedStringMap(obj.Object, "spec", "template", "metadata", mdType)
s.Require().NoErrorf(err, "could not retrieve %s metadata for object %v", mdType, objRef)
Expand Down
4 changes: 2 additions & 2 deletions pkg/kubernetes/annotations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var (
func TestTrimAnnotations(t *testing.T) {
obj := v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Annotations: maputil.CloneStringStringMap(untrimmedAnnotations),
Annotations: maputil.ShallowClone(untrimmedAnnotations),
},
}

Expand All @@ -43,7 +43,7 @@ func TestTrimAnnotations(t *testing.T) {
func TestTrimAnnotationsRace(t *testing.T) {
obj := v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Annotations: maputil.CloneStringStringMap(untrimmedAnnotations),
Annotations: maputil.ShallowClone(untrimmedAnnotations),
},
}

Expand Down
131 changes: 0 additions & 131 deletions pkg/maputil/gen-string-maputil.go

This file was deleted.

Loading