From 73087c2dd73522cf8e4e1a070151d9964ae05cb6 Mon Sep 17 00:00:00 2001 From: RTann Date: Tue, 15 Feb 2022 16:17:54 -0800 Subject: [PATCH 1/3] remove clusters --- .../datastore/datastore_impl.go | 4 +- .../imageintegration/service/service_impl.go | 11 - .../v1/image_integration_service.swagger.json | 7 - generated/storage/image_integration.pb.go | 204 +++++++----------- pkg/images/enricher/enricher_impl.go | 3 - pkg/images/enricher/enricher_impl_test.go | 4 - pkg/registries/docker/docker.go | 5 - pkg/registries/set_impl_test.go | 4 - pkg/registries/types/types.go | 1 - proto/storage/image_integration.proto | 6 +- 10 files changed, 77 insertions(+), 172 deletions(-) diff --git a/central/imageintegration/datastore/datastore_impl.go b/central/imageintegration/datastore/datastore_impl.go index a2d888ef9f9b7..84a974fe6b765 100644 --- a/central/imageintegration/datastore/datastore_impl.go +++ b/central/imageintegration/datastore/datastore_impl.go @@ -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 ( @@ -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 len(request.GetCluster()) != 0 { continue } if request.GetName() != "" && request.GetName() != integration.GetName() { diff --git a/central/imageintegration/service/service_impl.go b/central/imageintegration/service/service_impl.go index 15e0a6d9cfb3a..c90838157a145 100644 --- a/central/imageintegration/service/service_impl.go +++ b/central/imageintegration/service/service_impl.go @@ -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") diff --git a/generated/api/v1/image_integration_service.swagger.json b/generated/api/v1/image_integration_service.swagger.json index a381d15023503..a6d78209f8ebd 100644 --- a/generated/api/v1/image_integration_service.swagger.json +++ b/generated/api/v1/image_integration_service.swagger.json @@ -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": { diff --git a/generated/storage/image_integration.pb.go b/generated/storage/image_integration.pb.go index ddc19b9b99e83..4ef74e7245872 100644 --- a/generated/storage/image_integration.pb.go +++ b/generated/storage/image_integration.pb.go @@ -56,11 +56,9 @@ func (ImageIntegrationCategory) EnumDescriptor() ([]byte, []int) { // Next Tag: 21 type ImageIntegration struct { - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` - // If a list of clusters is provided, the integration will only be accessed from the specified clusters' sensors. - Clusters []string `protobuf:"bytes,5,rep,name=clusters,proto3" json:"clusters,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` Categories []ImageIntegrationCategory `protobuf:"varint,6,rep,packed,name=categories,proto3,enum=storage.ImageIntegrationCategory" json:"categories,omitempty"` // Types that are valid to be assigned to IntegrationConfig: // *ImageIntegration_Dtr @@ -292,13 +290,6 @@ func (m *ImageIntegration) GetType() string { return "" } -func (m *ImageIntegration) GetClusters() []string { - if m != nil { - return m.Clusters - } - return nil -} - func (m *ImageIntegration) GetCategories() []ImageIntegrationCategory { if m != nil { return m.Categories @@ -423,10 +414,6 @@ func (m *ImageIntegration) Clone() *ImageIntegration { cloned := new(ImageIntegration) *cloned = *m - if m.Clusters != nil { - cloned.Clusters = make([]string, len(m.Clusters)) - copy(cloned.Clusters, m.Clusters) - } if m.Categories != nil { cloned.Categories = make([]ImageIntegrationCategory, len(m.Categories)) copy(cloned.Categories, m.Categories) @@ -1273,75 +1260,75 @@ func init() { func init() { proto.RegisterFile("storage/image_integration.proto", fileDescriptor_9e3766be4a43c581) } var fileDescriptor_9e3766be4a43c581 = []byte{ - // 1077 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x96, 0xcf, 0x6e, 0x23, 0xc5, - 0x13, 0xc7, 0x77, 0xec, 0xc4, 0x7f, 0xca, 0x7f, 0xe2, 0x74, 0xbc, 0xbb, 0xf3, 0x8b, 0xf4, 0x8b, - 0xcd, 0x68, 0xb5, 0x0a, 0xb0, 0x72, 0x76, 0x03, 0xcb, 0x21, 0x48, 0x48, 0xb6, 0xd7, 0x0a, 0x66, - 0x21, 0x88, 0x49, 0x2e, 0x70, 0x19, 0x75, 0x66, 0x6a, 0x67, 0x87, 0xd8, 0xd3, 0xa6, 0xbb, 0x67, - 0x77, 0xfd, 0x12, 0x5c, 0xe1, 0x19, 0xb8, 0xf2, 0x00, 0x1c, 0xb8, 0x70, 0xe4, 0x88, 0x04, 0x8a, - 0x50, 0x78, 0x83, 0x3c, 0x01, 0xea, 0x9e, 0xf1, 0x78, 0xec, 0x90, 0x28, 0x28, 0x39, 0x71, 0x9b, - 0xa9, 0xfe, 0x54, 0xf5, 0xb7, 0xab, 0xab, 0xba, 0x1b, 0x5a, 0x42, 0x32, 0x4e, 0x7d, 0xdc, 0x09, - 0xc6, 0xd4, 0x47, 0x27, 0x08, 0x25, 0xfa, 0x9c, 0xca, 0x80, 0x85, 0x9d, 0x09, 0x67, 0x92, 0x91, - 0x62, 0x02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, 0xf0, - 0xbf, 0x80, 0x75, 0x84, 0xa4, 0xee, 0x09, 0x67, 0x6f, 0xe2, 0x97, 0xf7, 0xec, 0x51, 0xf4, 0xd5, - 0xec, 0x81, 0x7e, 0x5c, 0xd0, 0xf6, 0xf7, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x68, 0x0f, 0x88, - 0xa1, 0xd3, 0x0b, 0x00, 0x00, + // 1076 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x96, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0xeb, 0x24, 0x4d, 0x9c, 0x97, 0x1f, 0x4d, 0xa7, 0xe9, 0xae, 0xa9, 0x44, 0x53, 0xac, + 0xd5, 0xaa, 0xc0, 0x2a, 0xdd, 0x2d, 0x2c, 0x87, 0x22, 0x21, 0x25, 0xd9, 0xa8, 0xa4, 0x0b, 0x45, + 0xb8, 0xbd, 0xc0, 0xc5, 0x9a, 0xda, 0x6f, 0xbd, 0xa6, 0x89, 0x27, 0xcc, 0x8c, 0x77, 0x37, 0x7f, + 0x01, 0x37, 0xce, 0xfc, 0x0d, 0x5c, 0xf9, 0x03, 0x38, 0x70, 0xe1, 0xc8, 0x11, 0x09, 0x54, 0xa1, + 0xf2, 0x1f, 0xf4, 0x2f, 0x40, 0x63, 0x3b, 0x8e, 0x93, 0xd2, 0xaa, 0xa8, 0x3d, 0x71, 0xb3, 0xdf, + 0x7c, 0xde, 0x9b, 0xef, 0xbc, 0x79, 0x6f, 0x66, 0xa0, 0x25, 0x24, 0xe3, 0xd4, 0xc3, 0x1d, 0x7f, + 0x44, 0x3d, 0xb4, 0xfd, 0x40, 0xa2, 0xc7, 0xa9, 0xf4, 0x59, 0xd0, 0x1e, 0x73, 0x26, 0x19, 0x29, + 0x25, 0xc0, 0x46, 0xd3, 0x63, 0x1e, 0x8b, 0x6c, 0x3b, 0xea, 0x2b, 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d, 0xfc, 0xd2, 0x9e, 0x3e, 0x90, 0xbe, 0x9e, 0x3e, + 0xc8, 0x4f, 0x8a, 0x91, 0xfd, 0x83, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x05, 0xed, 0xcd, 0x3d, + 0xc3, 0x0b, 0x00, 0x00, } func (m *ImageIntegration) Marshal() (dAtA []byte, err error) { @@ -1426,15 +1413,6 @@ func (m *ImageIntegration) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - if len(m.Clusters) > 0 { - for iNdEx := len(m.Clusters) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Clusters[iNdEx]) - copy(dAtA[i:], m.Clusters[iNdEx]) - i = encodeVarintImageIntegration(dAtA, i, uint64(len(m.Clusters[iNdEx]))) - i-- - dAtA[i] = 0x2a - } - } if len(m.Type) > 0 { i -= len(m.Type) copy(dAtA[i:], m.Type) @@ -2243,12 +2221,6 @@ func (m *ImageIntegration) Size() (n int) { if l > 0 { n += 1 + l + sovImageIntegration(uint64(l)) } - if len(m.Clusters) > 0 { - for _, s := range m.Clusters { - l = len(s) - n += 1 + l + sovImageIntegration(uint64(l)) - } - } if len(m.Categories) > 0 { l = 0 for _, e := range m.Categories { @@ -2782,38 +2754,6 @@ func (m *ImageIntegration) Unmarshal(dAtA []byte) error { } m.Type = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Clusters", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowImageIntegration - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthImageIntegration - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthImageIntegration - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Clusters = append(m.Clusters, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex case 6: if wireType == 0 { var v ImageIntegrationCategory diff --git a/pkg/images/enricher/enricher_impl.go b/pkg/images/enricher/enricher_impl.go index 7ddcdfe053b4b..7ff8a19ee97b5 100644 --- a/pkg/images/enricher/enricher_impl.go +++ b/pkg/images/enricher/enricher_impl.go @@ -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 } diff --git a/pkg/images/enricher/enricher_impl_test.go b/pkg/images/enricher/enricher_impl_test.go index 1c0fac24e606f..9c3a996da2800 100644 --- a/pkg/images/enricher/enricher_impl_test.go +++ b/pkg/images/enricher/enricher_impl_test.go @@ -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 } diff --git a/pkg/registries/docker/docker.go b/pkg/registries/docker/docker.go index b2412150b0c8a..42a2cba17a758 100644 --- a/pkg/registries/docker/docker.go +++ b/pkg/registries/docker/docker.go @@ -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 { diff --git a/pkg/registries/set_impl_test.go b/pkg/registries/set_impl_test.go index c0d1c1c71445a..54de6d9bdeaca 100644 --- a/pkg/registries/set_impl_test.go +++ b/pkg/registries/set_impl_test.go @@ -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 } diff --git a/pkg/registries/types/types.go b/pkg/registries/types/types.go index 4c5daa316cd19..3257d962d2b8a 100644 --- a/pkg/registries/types/types.go +++ b/pkg/registries/types/types.go @@ -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 } diff --git a/proto/storage/image_integration.proto b/proto/storage/image_integration.proto index 052534b96cf51..1de2bf588bcaf 100644 --- a/proto/storage/image_integration.proto +++ b/proto/storage/image_integration.proto @@ -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 clusters. + reserved 5; repeated ImageIntegrationCategory categories = 6; oneof IntegrationConfig { From a3bfceef6cb5590d3f90336476402b0b68167faf Mon Sep 17 00:00:00 2001 From: RTann Date: Tue, 15 Feb 2022 16:21:24 -0800 Subject: [PATCH 2/3] updates --- central/imageintegration/datastore/datastore_impl.go | 2 +- proto/storage/image_integration.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/central/imageintegration/datastore/datastore_impl.go b/central/imageintegration/datastore/datastore_impl.go index 84a974fe6b765..132defed87bd7 100644 --- a/central/imageintegration/datastore/datastore_impl.go +++ b/central/imageintegration/datastore/datastore_impl.go @@ -44,7 +44,7 @@ func (ds *datastoreImpl) GetImageIntegrations(ctx context.Context, request *v1.G integrationSlice := integrations[:0] for _, integration := range integrations { - if len(request.GetCluster()) != 0 { + if request.GetCluster() != "" { continue } if request.GetName() != "" && request.GetName() != integration.GetName() { diff --git a/proto/storage/image_integration.proto b/proto/storage/image_integration.proto index 1de2bf588bcaf..b94e1eb85f5e4 100644 --- a/proto/storage/image_integration.proto +++ b/proto/storage/image_integration.proto @@ -14,7 +14,7 @@ message ImageIntegration { string type = 3; // Accidentally skipped or accidentally deleted? reserved 4; - // Previously, repeated clusters. + // Previously, repeated string clusters. reserved 5; repeated ImageIntegrationCategory categories = 6; From 01e05390fdbd1130fc6798faabeeeb7311d873d7 Mon Sep 17 00:00:00 2001 From: RTann Date: Wed, 16 Feb 2022 10:19:03 -0800 Subject: [PATCH 3/3] remove unused function which make style missed locally --- central/imageintegration/service/service_impl.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/central/imageintegration/service/service_impl.go b/central/imageintegration/service/service_impl.go index c90838157a145..d66ef1c0b3951 100644 --- a/central/imageintegration/service/service_impl.go +++ b/central/imageintegration/service/service_impl.go @@ -306,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