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
4 changes: 1 addition & 3 deletions central/imageintegration/datastore/datastore_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
v1 "github.com/stackrox/rox/generated/api/v1"
"github.com/stackrox/rox/generated/storage"
"github.com/stackrox/rox/pkg/sac"
"github.com/stackrox/rox/pkg/set"
)

var (
Expand Down Expand Up @@ -45,8 +44,7 @@ func (ds *datastoreImpl) GetImageIntegrations(ctx context.Context, request *v1.G

integrationSlice := integrations[:0]
for _, integration := range integrations {
clusterSet := set.NewStringSet(integration.GetClusters()...)
if len(request.GetCluster()) != 0 && !clusterSet.Contains(request.GetCluster()) {
if request.GetCluster() != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't we also want to remove this parameter from this proto as well (and add a changelog entry saying so)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The autogenerated registries still do this. Does it work? I don't think so, but I'm thinking I should save that for when we cleanup autogenerated registries

continue
}
if request.GetName() != "" && request.GetName() != integration.GetName() {
Expand Down
20 changes: 0 additions & 20 deletions central/imageintegration/service/service_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,6 @@ func (s *serviceImpl) validateIntegration(ctx context.Context, request *storage.
errorList.AddStrings("integrations require a category")
}

clustersRequested := request.GetClusters()
existingClusters, err := s.clusterDatastore.GetClusters(ctx)
if err != nil {
return err
}
for _, req := range clustersRequested {
if !s.clusterExists(req, existingClusters) {
errorList.AddStringf("cluster %s does not exist", req)
}
}

// Validate if there is a name. If there isn't, then skip the DB name check by returning the accumulated errors
if request.GetName() == "" {
errorList.AddString("name for integration is required")
Expand All @@ -317,15 +306,6 @@ func (s *serviceImpl) validateIntegration(ctx context.Context, request *storage.
return errorList.ToError()
}

func (s *serviceImpl) clusterExists(name string, clusters []*storage.Cluster) bool {
for _, c := range clusters {
if name == c.GetName() {
return true
}
}
return false
}

func (s *serviceImpl) reconcileUpdateImageIntegrationRequest(ctx context.Context, updateRequest *v1.UpdateImageIntegrationRequest) error {
if updateRequest.GetUpdatePassword() {
return nil
Expand Down
7 changes: 0 additions & 7 deletions generated/api/v1/image_integration_service.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,6 @@
"type": {
"type": "string"
},
"clusters": {
"type": "array",
"items": {
"type": "string"
},
"description": "If a list of clusters is provided, the integration will only be accessed from the specified clusters' sensors."
},
"categories": {
"type": "array",
"items": {
Expand Down
204 changes: 72 additions & 132 deletions generated/storage/image_integration.pb.go

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions pkg/images/enricher/enricher_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ func getRef(image *storage.Image) string {
}

func (e *enricherImpl) enrichImageWithRegistry(image *storage.Image, registry registryTypes.ImageRegistry) (bool, error) {
if !registry.Global() {
return false, nil
}
if !registry.Match(image.GetName()) {
return false, nil
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/images/enricher/enricher_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ func (f *fakeRegistryScanner) Metadata(image *storage.Image) (*storage.ImageMeta
return &storage.ImageMetadata{}, nil
}

func (f *fakeRegistryScanner) Global() bool {
return true
}

func (f *fakeRegistryScanner) Config() *types.Config {
return nil
}
Expand Down
5 changes: 0 additions & 5 deletions pkg/registries/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@ func (r *Registry) Match(image *storage.ImageName) bool {
return r.repositoryList.Contains(image.GetRemote())
}

// Global returns whether or not this registry is available from all clusters
func (r *Registry) Global() bool {
return len(r.protoImageIntegration.GetClusters()) == 0
}

// Metadata returns the metadata via this registries implementation
func (r *Registry) Metadata(image *storage.Image) (*storage.ImageMetadata, error) {
if image == nil {
Expand Down
4 changes: 0 additions & 4 deletions pkg/registries/set_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ func (f fakeRegistry) Test() error {
return nil
}

func (f fakeRegistry) Global() bool {
return false
}

func (f fakeRegistry) Config() *types.Config {
return f.config
}
Expand Down
1 change: 0 additions & 1 deletion pkg/registries/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type Registry interface {
Match(image *storage.ImageName) bool
Metadata(image *storage.Image) (*storage.ImageMetadata, error)
Test() error
Global() bool
Config() *Config
Name() string
}
Expand Down
6 changes: 4 additions & 2 deletions proto/storage/image_integration.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ message ImageIntegration {
string id = 1;
string name = 2;
string type = 3;
// If a list of clusters is provided, the integration will only be accessed from the specified clusters' sensors.
repeated string clusters = 5;
// Accidentally skipped or accidentally deleted?
reserved 4;
// Previously, repeated string clusters.
reserved 5;
repeated ImageIntegrationCategory categories = 6;

oneof IntegrationConfig {
Expand Down