diff --git a/adapters/backend/v1/client.go b/adapters/backend/v1/client.go index 6c7aef9..8ce774f 100644 --- a/adapters/backend/v1/client.go +++ b/adapters/backend/v1/client.go @@ -8,6 +8,7 @@ import ( "github.com/kubescape/go-logger" "github.com/kubescape/go-logger/helpers" + storageutils "github.com/kubescape/storage/pkg/utils" "github.com/kubescape/synchronizer/adapters" "github.com/kubescape/synchronizer/domain" "github.com/kubescape/synchronizer/messaging" @@ -73,7 +74,7 @@ func (c *Client) sendServerConnectedMessage(ctx context.Context) error { func (c *Client) callVerifyObject(ctx context.Context, id domain.KindName, object []byte) error { // calculate checksum - checksum, err := utils.CanonicalHash(object) + checksum, err := storageutils.CanonicalHash(object) if err != nil { return fmt.Errorf("calculate checksum: %w", err) } diff --git a/adapters/incluster/v1/client.go b/adapters/incluster/v1/client.go index 465208b..ec90720 100644 --- a/adapters/incluster/v1/client.go +++ b/adapters/incluster/v1/client.go @@ -25,6 +25,7 @@ import ( "github.com/kubescape/go-logger/helpers" helpersv1 "github.com/kubescape/k8s-interface/instanceidhandler/v1/helpers" spdxv1beta1 "github.com/kubescape/storage/pkg/generated/clientset/versioned/typed/softwarecomposition/v1beta1" + storageutils "github.com/kubescape/storage/pkg/utils" "github.com/kubescape/synchronizer/adapters" "github.com/kubescape/synchronizer/config" "github.com/kubescape/synchronizer/domain" @@ -151,14 +152,16 @@ func (c *Client) Start(ctx context.Context) error { switch { case event.Type == watch.Added: logger.L().Debug("added resource", helpers.String("id", id.String())) - newObject, err := c.getObjectFromMeta(d) + checksums, err := c.getChecksums(d) if err != nil { - logger.L().Ctx(ctx).Error("cannot get object", helpers.Error(err), helpers.String("id", id.String())) + logger.L().Ctx(ctx).Error("cannot get checksums", helpers.Error(err), helpers.String("id", id.String())) continue } - err = c.callVerifyObject(ctx, id, newObject) - if err != nil { - logger.L().Ctx(ctx).Error("cannot handle added resource", helpers.Error(err), helpers.String("id", id.String())) + for _, checksum := range checksums { + err = c.callbacks.VerifyObject(ctx, id, checksum) + if err != nil { + logger.L().Ctx(ctx).Error("cannot handle added resource", helpers.Error(err), helpers.String("id", id.String())) + } } case event.Type == watch.Deleted: logger.L().Debug("deleted resource", helpers.String("id", id.String())) @@ -344,7 +347,7 @@ func (c *Client) callPutOrPatch(ctx context.Context, id domain.KindName, baseObj return fmt.Errorf("verifying patch: %w", err) } // calculate checksum - checksum, err := utils.CanonicalHash(mergeResult) + checksum, err := storageutils.CanonicalHash(mergeResult) if err != nil { return fmt.Errorf("calculate checksum: %w", err) } @@ -371,7 +374,7 @@ func (c *Client) callPutOrPatch(ctx context.Context, id domain.KindName, baseObj func (c *Client) callVerifyObject(ctx context.Context, id domain.KindName, object []byte) error { // calculate checksum - checksum, err := utils.CanonicalHash(object) + checksum, err := storageutils.CanonicalHash(object) if err != nil { return fmt.Errorf("calculate checksum: %w", err) } @@ -382,6 +385,29 @@ func (c *Client) callVerifyObject(ctx context.Context, id domain.KindName, objec return nil } +func (c *Client) getChecksums(d metav1.Object) ([]string, error) { + // TODO add multiplier here + checksumFromAnnotation := "" + if checksum, ok := d.GetAnnotations()[helpersv1.SyncChecksumMetadataKey]; ok { + //return []string{checksum}, nil + checksumFromAnnotation = checksum + } + // we have to get the object and calculate the checksum + object, err := c.getObjectFromMeta(d) + if err != nil { + return nil, fmt.Errorf("get object: %w", err) + } + checksum, err := storageutils.CanonicalHash(object) + if err != nil { + return nil, fmt.Errorf("calculate checksum: %w", err) + } + if checksumFromAnnotation != "" { + logger.L().Info("Matthias, comparing checksums", helpers.String("checksumFromAnnotation", checksumFromAnnotation), helpers.String("checksum", checksum)) + logger.L().Info("Matthias - Checksum calculated", helpers.String("checksum", checksum), helpers.String("object", string(object))) + } + return []string{checksum}, nil +} + func (c *Client) DeleteObject(_ context.Context, id domain.KindName) error { if c.Strategy == domain.PatchStrategy { // remove from known resources @@ -430,7 +456,7 @@ func (c *Client) patchObject(ctx context.Context, id domain.KindName, checksum s return object, fmt.Errorf("apply patch: %w", err) } // verify checksum - newChecksum, err := utils.CanonicalHash(modified) + newChecksum, err := storageutils.CanonicalHash(modified) if err != nil { return object, fmt.Errorf("calculate checksum: %w", err) } @@ -515,7 +541,7 @@ func (c *Client) verifyObject(id domain.KindName, newChecksum string) ([]byte, e if err != nil { return nil, fmt.Errorf("marshal resource: %w", err) } - checksum, err := utils.CanonicalHash(object) + checksum, err := storageutils.CanonicalHash(object) if err != nil { return object, fmt.Errorf("calculate checksum: %w", err) } @@ -540,23 +566,16 @@ func (c *Client) getExistingStorageObjects(ctx context.Context) (string, error) Namespace: d.GetNamespace(), ResourceVersion: domain.ToResourceVersion(d.GetResourceVersion()), } - obj, err := c.getResource(d.GetNamespace(), d.GetName(), false) + // get checksum + checksums, err := c.getChecksums(d) if err != nil { - logger.L().Ctx(ctx).Error("cannot get object", helpers.Error(err), helpers.String("id", id.String())) + logger.L().Ctx(ctx).Error("cannot get checksums", helpers.Error(err), helpers.String("id", id.String())) return nil } - if c.multiplier > 0 { - c.multiplyVerifyObject(ctx, id, obj) - } else { - newObject, err := c.filterAndMarshal(obj) - if err != nil { - logger.L().Ctx(ctx).Error("cannot marshal object", helpers.Error(err), helpers.String("id", id.String())) - return nil - } - err = c.callVerifyObject(ctx, id, newObject) + for _, checksum := range checksums { + err = c.callbacks.VerifyObject(ctx, id, checksum) if err != nil { logger.L().Ctx(ctx).Error("cannot handle added resource", helpers.Error(err), helpers.String("id", id.String())) - return nil } } return nil @@ -567,40 +586,14 @@ func (c *Client) getExistingStorageObjects(ctx context.Context) (string, error) return resourceVersion, nil } -func (c *Client) multiplyVerifyObject(ctx context.Context, id domain.KindName, obj metav1.Object) { - objectName := id.Name - for i := 0; i < c.multiplier; i++ { - id.Name = fmt.Sprintf("%s-%d", objectName, i) - obj.SetName(id.Name) - // change the workload-name label too - if applicable - labels := obj.GetLabels() - if labels != nil { - if workloadName, ok := labels[helpersv1.NameMetadataKey]; ok { - labels[helpersv1.NameMetadataKey] = fmt.Sprintf("%s-%d", workloadName, i) - obj.SetLabels(labels) - } - } - newObject, err := c.filterAndMarshal(obj) - if err != nil { - logger.L().Ctx(ctx).Error("cannot marshal object", helpers.Error(err), helpers.String("id", id.String())) - continue - } - err = c.callVerifyObject(ctx, id, newObject) - if err != nil { - logger.L().Ctx(ctx).Error("cannot handle added resource", helpers.Error(err), helpers.String("id", id.String())) - continue - } - } -} - func (c *Client) filterAndMarshal(d metav1.Object) ([]byte, error) { - utils.RemoveManagedFields(d) + storageutils.RemoveManagedFields(d) if un, ok := d.(*unstructured.Unstructured); ok { fields, ok := fieldsToRemove[c.kind.String()] if !ok { fields = fieldsToRemove["default"] } - if err := utils.RemoveSpecificFields(un, fields); err != nil { + if err := storageutils.RemoveSpecificFields(un, fields); err != nil { return nil, fmt.Errorf("remove specific fields: %w", err) } } else { diff --git a/adapters/mock.go b/adapters/mock.go index c29d3c5..1c694fb 100644 --- a/adapters/mock.go +++ b/adapters/mock.go @@ -8,6 +8,7 @@ import ( jsonpatch "github.com/evanphx/json-patch" "github.com/kubescape/go-logger" "github.com/kubescape/go-logger/helpers" + storageutils "github.com/kubescape/storage/pkg/utils" "github.com/kubescape/synchronizer/domain" "github.com/kubescape/synchronizer/utils" "go.uber.org/multierr" @@ -121,7 +122,7 @@ func (m *MockAdapter) GetObject(ctx context.Context, id domain.KindName, baseObj return fmt.Errorf("verifying patch: %w", err) } // calculate checksum - checksum, err := utils.CanonicalHash(mergeResult) + checksum, err := storageutils.CanonicalHash(mergeResult) if err != nil { return fmt.Errorf("calculate checksum: %w", err) } @@ -152,7 +153,7 @@ func (m *MockAdapter) patchObject(id domain.KindName, checksum string, patch []b if err != nil { return object, fmt.Errorf("apply patch: %w", err) } - newChecksum, err := utils.CanonicalHash(modified) + newChecksum, err := storageutils.CanonicalHash(modified) if err != nil { return object, fmt.Errorf("calculate checksum: %w", err) } @@ -214,7 +215,7 @@ func (m *MockAdapter) verifyObject(id domain.KindName, newChecksum string) ([]by if !ok { return nil, fmt.Errorf("object not found") } - checksum, err := utils.CanonicalHash(object) + checksum, err := storageutils.CanonicalHash(object) if err != nil { return nil, fmt.Errorf("calculate checksum: %w", err) } @@ -264,7 +265,7 @@ func (m *MockAdapter) TestCallPutOrPatch(ctx context.Context, id domain.KindName return fmt.Errorf("verifying patch: %w", err) } // calculate checksum - checksum, err := utils.CanonicalHash(mergeResult) + checksum, err := storageutils.CanonicalHash(mergeResult) if err != nil { return fmt.Errorf("calculate checksum: %w", err) } @@ -295,7 +296,7 @@ func (m *MockAdapter) TestCallVerifyObject(ctx context.Context, id domain.KindNa // store object locally - this is only for testing purposes m.Resources[id.String()] = object // calculate checksum - checksum, err := utils.CanonicalHash(object) + checksum, err := storageutils.CanonicalHash(object) if err != nil { return fmt.Errorf("calculate checksum: %w", err) } diff --git a/go.mod b/go.mod index 07ed41b..3eb4974 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/kubescape/synchronizer go 1.22.5 require ( - github.com/SergJa/jsonhash v0.0.0-20210531165746-fc45f346aa74 github.com/apache/pulsar-client-go v0.12.1 github.com/armosec/armoapi-go v0.0.393 github.com/armosec/utils-k8s-go v0.0.26 @@ -17,9 +16,9 @@ require ( github.com/kinbiko/jsonassert v1.1.1 github.com/kubescape/backend v0.0.20 github.com/kubescape/go-logger v0.0.23 - github.com/kubescape/k8s-interface v0.0.165 + github.com/kubescape/k8s-interface v0.0.177 github.com/kubescape/messaging v0.0.33 - github.com/kubescape/storage v0.0.111 + github.com/kubescape/storage v0.0.133-0.20241118163532-a5a171088dc7 github.com/panjf2000/ants/v2 v2.9.1 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 github.com/prometheus/client_golang v1.19.0 @@ -29,7 +28,7 @@ require ( github.com/testcontainers/testcontainers-go v0.33.0 github.com/testcontainers/testcontainers-go/modules/k3s v0.33.0 go.uber.org/multierr v1.11.0 - golang.org/x/mod v0.19.0 + golang.org/x/mod v0.20.0 golang.org/x/net v0.29.0 istio.io/pkg v0.0.0-20231221211216-7635388a563e k8s.io/api v0.29.4 @@ -55,6 +54,7 @@ require ( github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect github.com/DataDog/zstd v1.5.5 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect + github.com/SergJa/jsonhash v0.0.0-20210531165746-fc45f346aa74 // indirect github.com/acobaugh/osrelease v0.1.0 // indirect github.com/anchore/go-logger v0.0.0-20230725134548-c21dafa1ec5a // indirect github.com/anchore/packageurl-go v0.1.1-0.20240312213626-055233e539b4 // indirect @@ -64,23 +64,23 @@ require ( github.com/armosec/gojay v1.2.17 // indirect github.com/armosec/utils-go v0.0.57 // indirect github.com/avast/retry-go v3.0.0+incompatible // indirect - github.com/aws/aws-sdk-go v1.50.20 // indirect - github.com/aws/aws-sdk-go-v2 v1.24.1 // indirect - github.com/aws/aws-sdk-go-v2/config v1.26.6 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.16.16 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3 // indirect - github.com/aws/aws-sdk-go-v2/service/ecr v1.20.2 // indirect - github.com/aws/aws-sdk-go-v2/service/eks v1.28.1 // indirect - github.com/aws/aws-sdk-go-v2/service/iam v1.21.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.18.7 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 // indirect - github.com/aws/smithy-go v1.19.0 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect + github.com/aws/aws-sdk-go-v2 v1.30.5 // indirect + github.com/aws/aws-sdk-go-v2/config v1.27.35 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.33 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect + github.com/aws/aws-sdk-go-v2/service/ecr v1.34.0 // indirect + github.com/aws/aws-sdk-go-v2/service/eks v1.48.5 // indirect + github.com/aws/aws-sdk-go-v2/service/iam v1.35.3 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.22.8 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.8 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.30.8 // indirect + github.com/aws/smithy-go v1.20.4 // indirect github.com/becheran/wildmatch-go v1.0.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.13.0 // indirect @@ -242,6 +242,7 @@ require ( gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/apiextensions-apiserver v0.29.0 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect sigs.k8s.io/controller-runtime v0.17.2 // indirect diff --git a/go.sum b/go.sum index c9f2791..7fa7329 100644 --- a/go.sum +++ b/go.sum @@ -142,51 +142,40 @@ github.com/armosec/utils-k8s-go v0.0.26 h1:gVSV1mrALyphaesc+JXbx9SfbxLqfgg1KvvC1 github.com/armosec/utils-k8s-go v0.0.26/go.mod h1:WL2brx3tszxeSl1yHac0oAVJUg3o22HYh1dPjaSfjXU= github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0= github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= -github.com/aws/aws-sdk-go v1.50.20 h1:xfAnSDVf/azIWTVQXQODp89bubvCS85r70O3nuQ4dnE= -github.com/aws/aws-sdk-go v1.50.20/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= -github.com/aws/aws-sdk-go-v2 v1.19.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= -github.com/aws/aws-sdk-go-v2 v1.19.1/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= -github.com/aws/aws-sdk-go-v2 v1.21.2/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM= -github.com/aws/aws-sdk-go-v2 v1.24.1 h1:xAojnj+ktS95YZlDf0zxWBkbFtymPeDP+rvUQIH3uAU= -github.com/aws/aws-sdk-go-v2 v1.24.1/go.mod h1:LNh45Br1YAkEKaAqvmE1m8FUx6a5b/V0oAKV7of29b4= -github.com/aws/aws-sdk-go-v2/config v1.26.6 h1:Z/7w9bUqlRI0FFQpetVuFYEsjzE3h7fpU6HuGmfPL/o= -github.com/aws/aws-sdk-go-v2/config v1.26.6/go.mod h1:uKU6cnDmYCvJ+pxO9S4cWDb2yWWIH5hra+32hVh1MI4= -github.com/aws/aws-sdk-go-v2/credentials v1.16.16 h1:8q6Rliyv0aUFAVtzaldUEcS+T5gbadPbWdV1WcAddK8= -github.com/aws/aws-sdk-go-v2/credentials v1.16.16/go.mod h1:UHVZrdUsv63hPXFo1H7c5fEneoVo9UXiz36QG1GEPi0= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 h1:c5I5iH+DZcH3xOIMlz3/tCKJDaHFwYEmxvlh2fAcFo8= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11/go.mod h1:cRrYDYAMUohBJUtUnOhydaMHtiK/1NZ0Otc9lIb6O0Y= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.35/go.mod h1:ipR5PvpSPqIqL5Mi82BxLnfMkHVbmco8kUwO2xrCi0M= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.36/go.mod h1:T8Jsn/uNL/AFOXrVYQ1YQaN1r9gN34JU1855/Lyjv+o= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43/go.mod h1:auo+PiyLl0n1l8A0e8RIeR8tOzYPfZZH/JNlrJ8igTQ= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 h1:vF+Zgd9s+H4vOXd5BMaPWykta2a6Ih0AKLq/X6NYKn4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10/go.mod h1:6BkRjejp/GR4411UGqkX8+wFMbFbqsUIimfK4XjOKR4= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.29/go.mod h1:M/eUABlDbw2uVrdAn+UsI6M727qp2fxkp8K0ejcBDUY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.30/go.mod h1:v3GSCnFxbHzt9dlWBqvA1K1f9lmWuf4ztupZBCAIVs4= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37/go.mod h1:Qe+2KtKml+FEsQF/DHmDV+xjtche/hwoF75EG4UlHW8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 h1:nYPe006ktcqUji8S2mqXf9c/7NdiKriOwMvWQHgYztw= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10/go.mod h1:6UV4SZkVvmODfXKql4LCbaZUpF7HO2BX38FgBf9ZOLw= -github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3 h1:n3GDfwqF2tzEkXlv5cuy4iy7LpKDtqDMcNLfZDu9rls= -github.com/aws/aws-sdk-go-v2/internal/ini v1.7.3/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY= -github.com/aws/aws-sdk-go-v2/service/ecr v1.20.2 h1:y6LX9GUoEA3mO0qpFl1ZQHj1rFyPWVphlzebiSt2tKE= -github.com/aws/aws-sdk-go-v2/service/ecr v1.20.2/go.mod h1:Q0LcmaN/Qr8+4aSBrdrXXePqoX0eOuYpJLbYpilmWnA= -github.com/aws/aws-sdk-go-v2/service/eks v1.28.1 h1:SA+98Rnehl2KXewvGXc2Lw2ns3Y4t9jdMHmEY5hcNws= -github.com/aws/aws-sdk-go-v2/service/eks v1.28.1/go.mod h1:cQRkgJKg6s9AIzFZ+i4pXdm+/3Fw4MuPNqCdMvSaqns= -github.com/aws/aws-sdk-go-v2/service/iam v1.21.1 h1:VTCWgsrromZqnlRgfziqqWWcW7LFkQLwJVYgf/5zgWA= -github.com/aws/aws-sdk-go-v2/service/iam v1.21.1/go.mod h1:LBsjrFczXiQLASO6FtDGTeHuZh6oHuIH6VKaOozFghg= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 h1:/b31bi3YVNlkzkBrm9LfpaKoaYZUxIAj4sHfOTmLfqw= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4/go.mod h1:2aGXHFmbInwgP9ZfpmdIfOELL79zhdNYNmReK8qDfdQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 h1:DBYTXwIGQSGs9w4jKm60F5dmCQ3EEruxdc0MFh+3EY4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10/go.mod h1:wohMUQiFdzo0NtxbBg0mSRGZ4vL3n0dKjLTINdcIino= -github.com/aws/aws-sdk-go-v2/service/sso v1.18.7 h1:eajuO3nykDPdYicLlP3AGgOyVN3MOlFmZv7WGTuJPow= -github.com/aws/aws-sdk-go-v2/service/sso v1.18.7/go.mod h1:+mJNDdF+qiUlNKNC3fxn74WWNN+sOiGOEImje+3ScPM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7 h1:QPMJf+Jw8E1l7zqhZmMlFw6w1NmfkfiSK8mS4zOx3BA= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7/go.mod h1:ykf3COxYI0UJmxcfcxcVuz7b6uADi1FkiUz6Eb7AgM8= -github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 h1:NzO4Vrau795RkUdSHKEwiR01FaGzGOH1EETJ+5QHnm0= -github.com/aws/aws-sdk-go-v2/service/sts v1.26.7/go.mod h1:6h2YuIoxaMSCFf5fi1EgZAwdfkGMgDY+DVfa61uLe4U= -github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/aws/smithy-go v1.19.0 h1:KWFKQV80DpP3vJrrA9sVAHQ5gc2z8i4EzrLhLlWXcBM= -github.com/aws/smithy-go v1.19.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go-v2 v1.30.5 h1:mWSRTwQAb0aLE17dSzztCVJWI9+cRMgqebndjwDyK0g= +github.com/aws/aws-sdk-go-v2 v1.30.5/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0= +github.com/aws/aws-sdk-go-v2/config v1.27.35 h1:jeFgiWYNV0vrgdZqB4kZBjYNdy0IKkwrAjr2fwpHIig= +github.com/aws/aws-sdk-go-v2/config v1.27.35/go.mod h1:qnpEvTq8ZfjrCqmJGRfWZuF+lGZ/vG8LK2K0L/TY1gQ= +github.com/aws/aws-sdk-go-v2/credentials v1.17.33 h1:lBHAQQznENv0gLHAZ73ONiTSkCtr8q3pSqWrpbBBZz0= +github.com/aws/aws-sdk-go-v2/credentials v1.17.33/go.mod h1:MBuqCUOT3ChfLuxNDGyra67eskx7ge9e3YKYBce7wpI= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13 h1:pfQ2sqNpMVK6xz2RbqLEL0GH87JOwSxPV2rzm8Zsb74= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13/go.mod h1:NG7RXPUlqfsCLLFfi0+IpKN4sCB9D9fw/qTaSB+xRoU= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17 h1:pI7Bzt0BJtYA0N/JEC6B8fJ4RBrEMi1LBrkMdFYNSnQ= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17/go.mod h1:Dh5zzJYMtxfIjYW+/evjQ8uj2OyR/ve2KROHGHlSFqE= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17 h1:Mqr/V5gvrhA2gvgnF42Zh5iMiQNcOYthFYwCyrnuWlc= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17/go.mod h1:aLJpZlCmjE+V+KtN1q1uyZkfnUWpQGpbsn89XPKyzfU= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= +github.com/aws/aws-sdk-go-v2/service/ecr v1.34.0 h1:kDSbKHvFf4I7Aw7wJSd2vGprafZbTEMUgwAxKXcnkVQ= +github.com/aws/aws-sdk-go-v2/service/ecr v1.34.0/go.mod h1:keOS9j4fv5ASh7dV29lIpGw2QgoJwGFAyMU0uPvfax4= +github.com/aws/aws-sdk-go-v2/service/eks v1.48.5 h1:vMwwdzKoUBt7vMHNkF16Hh7+8ndVGOAAEgqcrbz17M4= +github.com/aws/aws-sdk-go-v2/service/eks v1.48.5/go.mod h1:9dn8p15siUL80NCTPVNd+YvEpVTmWO+rboGx6qOMBa0= +github.com/aws/aws-sdk-go-v2/service/iam v1.35.3 h1:bWFkGGea2UoD/m229uuRfT0mu+6pKNB0Kq4U6j/Qz3U= +github.com/aws/aws-sdk-go-v2/service/iam v1.35.3/go.mod h1:PpmEOH3ZTQlDAezieBVdFMjPO1jovUMNPA4OpCtnwbY= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 h1:KypMCbLPPHEmf9DgMGw51jMj77VfGPAN2Kv4cfhlfgI= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4/go.mod h1:Vz1JQXliGcQktFTN/LN6uGppAIRoLBR2bMvIMP0gOjc= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19 h1:rfprUlsdzgl7ZL2KlXiUAoJnI/VxfHCvDFr2QDFj6u4= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19/go.mod h1:SCWkEdRq8/7EK60NcvvQ6NXKuTcchAD4ROAsC37VEZE= +github.com/aws/aws-sdk-go-v2/service/sso v1.22.8 h1:JRwuL+S1Qe1owZQoxblV7ORgRf2o0SrtzDVIbaVCdQ0= +github.com/aws/aws-sdk-go-v2/service/sso v1.22.8/go.mod h1:eEygMHnTKH/3kNp9Jr1n3PdejuSNcgwLe1dWgQtO0VQ= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.8 h1:+HpGETD9463PFSj7lX5+eq7aLDs85QUIA+NBkeAsscA= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.8/go.mod h1:bCbAxKDqNvkHxRaIMnyVPXPo+OaPRwvmgzMxbz1VKSA= +github.com/aws/aws-sdk-go-v2/service/sts v1.30.8 h1:bAi+4p5EKnni+jrfcAhb7iHFQ24bthOAV9t0taf3DCE= +github.com/aws/aws-sdk-go-v2/service/sts v1.30.8/go.mod h1:NXi1dIAGteSaRLqYgarlhP/Ij0cFT+qmCwiJqWh/U5o= +github.com/aws/smithy-go v1.20.4 h1:2HK1zBdPgRbjFOHlfeQZfpC4r72MOb9bZkiFwggKO+4= +github.com/aws/smithy-go v1.20.4/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/becheran/wildmatch-go v1.0.0 h1:mE3dGGkTmpKtT4Z+88t8RStG40yN9T+kFEGj2PZFSzA= github.com/becheran/wildmatch-go v1.0.0/go.mod h1:gbMvj0NtVdJ15Mg/mH9uxk2R1QCistMyU7d9KFzroX4= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -424,7 +413,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -571,12 +559,12 @@ github.com/kubescape/backend v0.0.20 h1:E3nZGqWW8ELSh/n3ZRitlkmuZq33Lyx/42Lm4gpg github.com/kubescape/backend v0.0.20/go.mod h1:FpazfN+c3Ucuvv4jZYCnk99moSBRNMVIxl5aWCZAEBo= github.com/kubescape/go-logger v0.0.23 h1:5xh+Nm8eGImhFbtippRKLaFgsvlKE1ufvQhNM2P/570= github.com/kubescape/go-logger v0.0.23/go.mod h1:Ayg7g769c7sXVB+P3fkJmbsJpoEmMmaUf9jeo+XuC3U= -github.com/kubescape/k8s-interface v0.0.165 h1:Tq1ZMnO6gI8gIrml6RSnt4XdlCJxRUJHNheAeh/i7xw= -github.com/kubescape/k8s-interface v0.0.165/go.mod h1:oF+Yxug3Kpfu9Yr2j63wy7gwswrKXpiqI0mLk/7gF/s= +github.com/kubescape/k8s-interface v0.0.177 h1:x+8agex4PSMubInFHprVG6y0E3AVhm1PvAHzSH7ehMs= +github.com/kubescape/k8s-interface v0.0.177/go.mod h1:1jA1z5uLLyVkGxWjlT9WibUvcE+chK4g9Hrxg+GajP4= github.com/kubescape/messaging v0.0.33 h1:55xVE03zriDZ6qiUSLo41fr04+bnAalbpmWTzx6/1uY= github.com/kubescape/messaging v0.0.33/go.mod h1:aoG05ge42kOe1wX90XPBFsWK4r8d3F1H4uyRo9x1R7M= -github.com/kubescape/storage v0.0.111 h1:QyfkfmLiSyQD+/29DMOX6U+qUtBkhrhqFTA6QS8bgns= -github.com/kubescape/storage v0.0.111/go.mod h1:I4i7NKl0xa85nHii3aXQAFuUZDJzawAq1+sJbYfEiU0= +github.com/kubescape/storage v0.0.133-0.20241118163532-a5a171088dc7 h1:smrB0ei9yT4Bx1WQBzCmGhhGSbjByNP59AXHONOGnMg= +github.com/kubescape/storage v0.0.133-0.20241118163532-a5a171088dc7/go.mod h1:wGGPAkLstPtptQvIQUBdgTkWWGr4vAHugS4uEDM1K/I= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/linkedin/goavro/v2 v2.12.0 h1:rIQQSj8jdAUlKQh6DttK8wCRv4t4QO09g1C4aBWXslg= @@ -982,8 +970,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= -golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1440,6 +1428,8 @@ istio.io/pkg v0.0.0-20231221211216-7635388a563e h1:ZlLVbKDlCzfP0MPbWc6VRcY23d9Nd istio.io/pkg v0.0.0-20231221211216-7635388a563e/go.mod h1:fvmqEdHhZjYYwf6dSiIwvwc7db54kMWVTfsb91KmhzY= k8s.io/api v0.29.4 h1:WEnF/XdxuCxdG3ayHNRR8yH3cI1B/llkWBma6bq4R3w= k8s.io/api v0.29.4/go.mod h1:DetSv0t4FBTcEpfA84NJV3g9a7+rSzlUHk5ADAYHUv0= +k8s.io/apiextensions-apiserver v0.29.0 h1:0VuspFG7Hj+SxyF/Z/2T0uFbI5gb5LRgEyUVE3Q4lV0= +k8s.io/apiextensions-apiserver v0.29.0/go.mod h1:TKmpy3bTS0mr9pylH0nOt/QzQRrW7/h7yLdRForMZwc= k8s.io/apimachinery v0.29.4 h1:RaFdJiDmuKs/8cm1M6Dh1Kvyh59YQFDcFuFTSmXes6Q= k8s.io/apimachinery v0.29.4/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y= k8s.io/client-go v0.29.4 h1:79ytIedxVfyXV8rpH3jCBW0u+un0fxHDwX5F9K8dPR8= diff --git a/tests/go.mod b/tests/go.mod index df66082..cc1e6a6 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -12,7 +12,7 @@ require ( github.com/deckarep/golang-set/v2 v2.6.0 github.com/kubescape/go-logger v0.0.23 github.com/kubescape/messaging v0.0.33 - github.com/kubescape/storage v0.0.111 + github.com/kubescape/storage v0.0.133-0.20241118163532-a5a171088dc7 github.com/kubescape/synchronizer v0.0.72 github.com/stretchr/testify v1.9.0 github.com/testcontainers/testcontainers-go v0.33.0 @@ -76,23 +76,23 @@ require ( github.com/armosec/utils-go v0.0.57 // indirect github.com/armosec/utils-k8s-go v0.0.26 // indirect github.com/avast/retry-go v3.0.0+incompatible // indirect - github.com/aws/aws-sdk-go v1.50.37 // indirect - github.com/aws/aws-sdk-go-v2 v1.25.3 // indirect - github.com/aws/aws-sdk-go-v2/config v1.27.7 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.7 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.3 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.3 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.3 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect - github.com/aws/aws-sdk-go-v2/service/ecr v1.27.2 // indirect - github.com/aws/aws-sdk-go-v2/service/eks v1.41.1 // indirect - github.com/aws/aws-sdk-go-v2/service/iam v1.31.2 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.5 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.20.2 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.2 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.28.4 // indirect - github.com/aws/smithy-go v1.20.1 // indirect + github.com/aws/aws-sdk-go v1.55.5 // indirect + github.com/aws/aws-sdk-go-v2 v1.30.5 // indirect + github.com/aws/aws-sdk-go-v2/config v1.27.35 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.33 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect + github.com/aws/aws-sdk-go-v2/service/ecr v1.34.0 // indirect + github.com/aws/aws-sdk-go-v2/service/eks v1.48.5 // indirect + github.com/aws/aws-sdk-go-v2/service/iam v1.35.3 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.22.8 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.8 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.30.8 // indirect + github.com/aws/smithy-go v1.20.4 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/becheran/wildmatch-go v1.0.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -218,7 +218,7 @@ require ( github.com/knqyf263/go-deb-version v0.0.0-20230223133812-3ed183d23422 // indirect github.com/knqyf263/go-rpmdb v0.1.0 // indirect github.com/kubescape/backend v0.0.20 // indirect - github.com/kubescape/k8s-interface v0.0.165 // indirect + github.com/kubescape/k8s-interface v0.0.177 // indirect github.com/kubescape/opa-utils v0.0.280 // indirect github.com/kubescape/rbac-utils v0.0.21-0.20230806101615-07e36f555520 // indirect github.com/kylelemons/godebug v1.1.0 // indirect @@ -354,7 +354,7 @@ require ( go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.27.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect - golang.org/x/mod v0.19.0 // indirect + golang.org/x/mod v0.20.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.8.0 // indirect @@ -380,6 +380,7 @@ require ( gorm.io/driver/postgres v1.5.6 // indirect gorm.io/gorm v1.25.10 // indirect istio.io/pkg v0.0.0-20231221211216-7635388a563e // indirect + k8s.io/apiextensions-apiserver v0.29.0 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect sigs.k8s.io/controller-runtime v0.17.2 // indirect diff --git a/tests/go.sum b/tests/go.sum index 927c200..76b8fc3 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -205,40 +205,40 @@ github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHSxpiH9JdtuBj0= github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY= -github.com/aws/aws-sdk-go v1.50.37 h1:gnAf6eYPSTb4QpVwugtWFqD07QXOoX7LewRrtLUx3lI= -github.com/aws/aws-sdk-go v1.50.37/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= -github.com/aws/aws-sdk-go-v2 v1.25.3 h1:xYiLpZTQs1mzvz5PaI6uR0Wh57ippuEthxS4iK5v0n0= -github.com/aws/aws-sdk-go-v2 v1.25.3/go.mod h1:35hUlJVYd+M++iLI3ALmVwMOyRYMmRqUXpTtRGW+K9I= -github.com/aws/aws-sdk-go-v2/config v1.27.7 h1:JSfb5nOQF01iOgxFI5OIKWwDiEXWTyTgg1Mm1mHi0A4= -github.com/aws/aws-sdk-go-v2/config v1.27.7/go.mod h1:PH0/cNpoMO+B04qET699o5W92Ca79fVtbUnvMIZro4I= -github.com/aws/aws-sdk-go-v2/credentials v1.17.7 h1:WJd+ubWKoBeRh7A5iNMnxEOs982SyVKOJD+K8HIezu4= -github.com/aws/aws-sdk-go-v2/credentials v1.17.7/go.mod h1:UQi7LMR0Vhvs+44w5ec8Q+VS+cd10cjwgHwiVkE0YGU= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.3 h1:p+y7FvkK2dxS+FEwRIDHDe//ZX+jDhP8HHE50ppj4iI= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.3/go.mod h1:/fYB+FZbDlwlAiynK9KDXlzZl3ANI9JkD0Uhz5FjNT4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.3 h1:ifbIbHZyGl1alsAhPIYsHOg5MuApgqOvVeI8wIugXfs= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.3/go.mod h1:oQZXg3c6SNeY6OZrDY+xHcF4VGIEoNotX2B4PrDeoJI= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.3 h1:Qvodo9gHG9F3E8SfYOspPeBt0bjSbsevK8WhRAUHcoY= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.3/go.mod h1:vCKrdLXtybdf/uQd/YfVR2r5pcbNuEYKzMQpcxmeSJw= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= -github.com/aws/aws-sdk-go-v2/service/ecr v1.27.2 h1:lkRbIgRuYW3C8y+vTQnSc4D4fiuby7XpEVzKTJkWjcU= -github.com/aws/aws-sdk-go-v2/service/ecr v1.27.2/go.mod h1:H4zhX7f/oFn2xNTW+vXOTSXx5SsJ3PjwIlKJCpzm0DU= -github.com/aws/aws-sdk-go-v2/service/eks v1.41.1 h1:08hbVK5suEtDMgI7r0x8MA6arzYWvQEcQ/zyU4E7hyM= -github.com/aws/aws-sdk-go-v2/service/eks v1.41.1/go.mod h1:tVeE5cg0q+69sxgMsiyFnWrMnuwgui7FruNgPMXt7Lc= -github.com/aws/aws-sdk-go-v2/service/iam v1.31.2 h1:LD+6Ln3nHvQ/1rn3hATa+xjnTkr3LUo4k/6RvdOVFGE= -github.com/aws/aws-sdk-go-v2/service/iam v1.31.2/go.mod h1:jB6UEWR0ROLtOO53UsEzv4wKHRczfrbm8s1JuWILo6Q= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibRTVAs6ECHZOw5/wlylS9OcTzwyjeQMudmREjE= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1/go.mod h1:JKpmtYhhPs7D97NL/ltqz7yCkERFW5dOlHyVl66ZYF8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.5 h1:K/NXvIftOlX+oGgWGIa3jDyYLDNsdVhsjHmsBH2GLAQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.5/go.mod h1:cl9HGLV66EnCmMNzq4sYOti+/xo8w34CsgzVtm2GgsY= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.2 h1:XOPfar83RIRPEzfihnp+U6udOveKZJvPQ76SKWrLRHc= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.2/go.mod h1:Vv9Xyk1KMHXrR3vNQe8W5LMFdTjSeWk0gBZBzvf3Qa0= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.2 h1:pi0Skl6mNl2w8qWZXcdOyg197Zsf4G97U7Sso9JXGZE= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.2/go.mod h1:JYzLoEVeLXk+L4tn1+rrkfhkxl6mLDEVaDSvGq9og90= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.4 h1:Ppup1nVNAOWbBOrcoOxaxPeEnSFB2RnnQdguhXpmeQk= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.4/go.mod h1:+K1rNPVyGxkRuv9NNiaZ4YhBFuyw2MMA9SlIJ1Zlpz8= -github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= -github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= +github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= +github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go-v2 v1.30.5 h1:mWSRTwQAb0aLE17dSzztCVJWI9+cRMgqebndjwDyK0g= +github.com/aws/aws-sdk-go-v2 v1.30.5/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0= +github.com/aws/aws-sdk-go-v2/config v1.27.35 h1:jeFgiWYNV0vrgdZqB4kZBjYNdy0IKkwrAjr2fwpHIig= +github.com/aws/aws-sdk-go-v2/config v1.27.35/go.mod h1:qnpEvTq8ZfjrCqmJGRfWZuF+lGZ/vG8LK2K0L/TY1gQ= +github.com/aws/aws-sdk-go-v2/credentials v1.17.33 h1:lBHAQQznENv0gLHAZ73ONiTSkCtr8q3pSqWrpbBBZz0= +github.com/aws/aws-sdk-go-v2/credentials v1.17.33/go.mod h1:MBuqCUOT3ChfLuxNDGyra67eskx7ge9e3YKYBce7wpI= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13 h1:pfQ2sqNpMVK6xz2RbqLEL0GH87JOwSxPV2rzm8Zsb74= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13/go.mod h1:NG7RXPUlqfsCLLFfi0+IpKN4sCB9D9fw/qTaSB+xRoU= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17 h1:pI7Bzt0BJtYA0N/JEC6B8fJ4RBrEMi1LBrkMdFYNSnQ= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17/go.mod h1:Dh5zzJYMtxfIjYW+/evjQ8uj2OyR/ve2KROHGHlSFqE= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17 h1:Mqr/V5gvrhA2gvgnF42Zh5iMiQNcOYthFYwCyrnuWlc= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17/go.mod h1:aLJpZlCmjE+V+KtN1q1uyZkfnUWpQGpbsn89XPKyzfU= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= +github.com/aws/aws-sdk-go-v2/service/ecr v1.34.0 h1:kDSbKHvFf4I7Aw7wJSd2vGprafZbTEMUgwAxKXcnkVQ= +github.com/aws/aws-sdk-go-v2/service/ecr v1.34.0/go.mod h1:keOS9j4fv5ASh7dV29lIpGw2QgoJwGFAyMU0uPvfax4= +github.com/aws/aws-sdk-go-v2/service/eks v1.48.5 h1:vMwwdzKoUBt7vMHNkF16Hh7+8ndVGOAAEgqcrbz17M4= +github.com/aws/aws-sdk-go-v2/service/eks v1.48.5/go.mod h1:9dn8p15siUL80NCTPVNd+YvEpVTmWO+rboGx6qOMBa0= +github.com/aws/aws-sdk-go-v2/service/iam v1.35.3 h1:bWFkGGea2UoD/m229uuRfT0mu+6pKNB0Kq4U6j/Qz3U= +github.com/aws/aws-sdk-go-v2/service/iam v1.35.3/go.mod h1:PpmEOH3ZTQlDAezieBVdFMjPO1jovUMNPA4OpCtnwbY= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 h1:KypMCbLPPHEmf9DgMGw51jMj77VfGPAN2Kv4cfhlfgI= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4/go.mod h1:Vz1JQXliGcQktFTN/LN6uGppAIRoLBR2bMvIMP0gOjc= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19 h1:rfprUlsdzgl7ZL2KlXiUAoJnI/VxfHCvDFr2QDFj6u4= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19/go.mod h1:SCWkEdRq8/7EK60NcvvQ6NXKuTcchAD4ROAsC37VEZE= +github.com/aws/aws-sdk-go-v2/service/sso v1.22.8 h1:JRwuL+S1Qe1owZQoxblV7ORgRf2o0SrtzDVIbaVCdQ0= +github.com/aws/aws-sdk-go-v2/service/sso v1.22.8/go.mod h1:eEygMHnTKH/3kNp9Jr1n3PdejuSNcgwLe1dWgQtO0VQ= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.8 h1:+HpGETD9463PFSj7lX5+eq7aLDs85QUIA+NBkeAsscA= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.8/go.mod h1:bCbAxKDqNvkHxRaIMnyVPXPo+OaPRwvmgzMxbz1VKSA= +github.com/aws/aws-sdk-go-v2/service/sts v1.30.8 h1:bAi+4p5EKnni+jrfcAhb7iHFQ24bthOAV9t0taf3DCE= +github.com/aws/aws-sdk-go-v2/service/sts v1.30.8/go.mod h1:NXi1dIAGteSaRLqYgarlhP/Ij0cFT+qmCwiJqWh/U5o= +github.com/aws/smithy-go v1.20.4 h1:2HK1zBdPgRbjFOHlfeQZfpC4r72MOb9bZkiFwggKO+4= +github.com/aws/smithy-go v1.20.4/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/becheran/wildmatch-go v1.0.0 h1:mE3dGGkTmpKtT4Z+88t8RStG40yN9T+kFEGj2PZFSzA= @@ -790,16 +790,16 @@ github.com/kubescape/backend v0.0.20 h1:E3nZGqWW8ELSh/n3ZRitlkmuZq33Lyx/42Lm4gpg github.com/kubescape/backend v0.0.20/go.mod h1:FpazfN+c3Ucuvv4jZYCnk99moSBRNMVIxl5aWCZAEBo= github.com/kubescape/go-logger v0.0.23 h1:5xh+Nm8eGImhFbtippRKLaFgsvlKE1ufvQhNM2P/570= github.com/kubescape/go-logger v0.0.23/go.mod h1:Ayg7g769c7sXVB+P3fkJmbsJpoEmMmaUf9jeo+XuC3U= -github.com/kubescape/k8s-interface v0.0.165 h1:Tq1ZMnO6gI8gIrml6RSnt4XdlCJxRUJHNheAeh/i7xw= -github.com/kubescape/k8s-interface v0.0.165/go.mod h1:oF+Yxug3Kpfu9Yr2j63wy7gwswrKXpiqI0mLk/7gF/s= +github.com/kubescape/k8s-interface v0.0.177 h1:x+8agex4PSMubInFHprVG6y0E3AVhm1PvAHzSH7ehMs= +github.com/kubescape/k8s-interface v0.0.177/go.mod h1:1jA1z5uLLyVkGxWjlT9WibUvcE+chK4g9Hrxg+GajP4= github.com/kubescape/messaging v0.0.33 h1:55xVE03zriDZ6qiUSLo41fr04+bnAalbpmWTzx6/1uY= github.com/kubescape/messaging v0.0.33/go.mod h1:aoG05ge42kOe1wX90XPBFsWK4r8d3F1H4uyRo9x1R7M= github.com/kubescape/opa-utils v0.0.280 h1:wrYkx78CHuzsOiYVxZ8ySI5s5NXSRIgQVW7pyJ9ox9I= github.com/kubescape/opa-utils v0.0.280/go.mod h1:N/UnbZHpoiHQH7O50yadhIXZvVl0IVtTGBmePPrSQSg= github.com/kubescape/rbac-utils v0.0.21-0.20230806101615-07e36f555520 h1:SqlwF8G+oFazeYmZQKoPczLEflBQpwpHCU8DoLLyfj8= github.com/kubescape/rbac-utils v0.0.21-0.20230806101615-07e36f555520/go.mod h1:wuxMUSDzGUyWd25IJfBzEJ/Udmw2Vy7npj+MV3u3GrU= -github.com/kubescape/storage v0.0.111 h1:QyfkfmLiSyQD+/29DMOX6U+qUtBkhrhqFTA6QS8bgns= -github.com/kubescape/storage v0.0.111/go.mod h1:I4i7NKl0xa85nHii3aXQAFuUZDJzawAq1+sJbYfEiU0= +github.com/kubescape/storage v0.0.133-0.20241118163532-a5a171088dc7 h1:smrB0ei9yT4Bx1WQBzCmGhhGSbjByNP59AXHONOGnMg= +github.com/kubescape/storage v0.0.133-0.20241118163532-a5a171088dc7/go.mod h1:wGGPAkLstPtptQvIQUBdgTkWWGr4vAHugS4uEDM1K/I= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs= @@ -1348,8 +1348,8 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= -golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= +golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1851,6 +1851,8 @@ istio.io/pkg v0.0.0-20231221211216-7635388a563e h1:ZlLVbKDlCzfP0MPbWc6VRcY23d9Nd istio.io/pkg v0.0.0-20231221211216-7635388a563e/go.mod h1:fvmqEdHhZjYYwf6dSiIwvwc7db54kMWVTfsb91KmhzY= k8s.io/api v0.29.4 h1:WEnF/XdxuCxdG3ayHNRR8yH3cI1B/llkWBma6bq4R3w= k8s.io/api v0.29.4/go.mod h1:DetSv0t4FBTcEpfA84NJV3g9a7+rSzlUHk5ADAYHUv0= +k8s.io/apiextensions-apiserver v0.29.0 h1:0VuspFG7Hj+SxyF/Z/2T0uFbI5gb5LRgEyUVE3Q4lV0= +k8s.io/apiextensions-apiserver v0.29.0/go.mod h1:TKmpy3bTS0mr9pylH0nOt/QzQRrW7/h7yLdRForMZwc= k8s.io/apimachinery v0.29.4 h1:RaFdJiDmuKs/8cm1M6Dh1Kvyh59YQFDcFuFTSmXes6Q= k8s.io/apimachinery v0.29.4/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y= k8s.io/client-go v0.29.4 h1:79ytIedxVfyXV8rpH3jCBW0u+un0fxHDwX5F9K8dPR8= diff --git a/utils/testdata/networkPolicy.json b/utils/testdata/networkPolicy.json deleted file mode 100644 index 0c47417..0000000 --- a/utils/testdata/networkPolicy.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "kind": "NetworkPolicy", - "apiVersion": "networking.k8s.io/v1", - "metadata": { - "name": "argocd-dex-server-network-policy", - "namespace": "argocd", - "uid": "1976d83a-4745-4e2b-8e43-799b15e7b4a2", - "resourceVersion": "856454", - "generation": 1, - "creationTimestamp": "2023-12-21T15:11:15Z", - "annotations": { - "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"networking.k8s.io/v1\",\"kind\":\"NetworkPolicy\",\"metadata\":{\"annotations\":{},\"name\":\"argocd-dex-server-network-policy\",\"namespace\":\"argocd\"},\"spec\":{\"ingress\":[{\"from\":[{\"podSelector\":{\"matchLabels\":{\"app.kubernetes.io/name\":\"argocd-server\"}}}],\"ports\":[{\"port\":5556,\"protocol\":\"TCP\"},{\"port\":5557,\"protocol\":\"TCP\"}]},{\"from\":[{\"namespaceSelector\":{}}],\"ports\":[{\"port\":5558,\"protocol\":\"TCP\"}]}],\"podSelector\":{\"matchLabels\":{\"app.kubernetes.io/name\":\"argocd-dex-server\"}},\"policyTypes\":[\"Ingress\"]}}\n" - }, - "managedFields": [ - { - "manager": "kubectl-client-side-apply", - "operation": "Update", - "apiVersion": "networking.k8s.io/v1", - "time": "2023-12-21T15:11:15Z", - "fieldsType": "FieldsV1", - "fieldsV1": { - "f:metadata": { - "f:annotations": { - ".": {}, - "f:kubectl.kubernetes.io/last-applied-configuration": {} - } - }, - "f:spec": { - "f:ingress": {}, - "f:podSelector": {}, - "f:policyTypes": {} - } - } - } - ] - }, - "spec": { - "podSelector": { - "matchLabels": { - "app.kubernetes.io/name": "argocd-dex-server" - } - }, - "ingress": [ - { - "ports": [ - { - "protocol": "TCP", - "port": 5556 - }, - { - "protocol": "TCP", - "port": 5557 - } - ], - "from": [ - { - "podSelector": { - "matchLabels": { - "app.kubernetes.io/name": "argocd-server" - } - } - } - ] - }, - { - "ports": [ - { - "protocol": "TCP", - "port": 5558 - } - ], - "from": [ - { - "namespaceSelector": {} - } - ] - } - ], - "policyTypes": [ - "Ingress" - ] - } - } \ No newline at end of file diff --git a/utils/testdata/networkPolicyCleaned.json b/utils/testdata/networkPolicyCleaned.json deleted file mode 100644 index a2222de..0000000 --- a/utils/testdata/networkPolicyCleaned.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "kind": "NetworkPolicy", - "apiVersion": "networking.k8s.io/v1", - "metadata": { - "name": "argocd-dex-server-network-policy", - "namespace": "argocd", - "uid": "1976d83a-4745-4e2b-8e43-799b15e7b4a2", - "resourceVersion": "856454", - "generation": 1, - "creationTimestamp": "2023-12-21T15:11:15Z", - "annotations": {} - }, - "spec": { - "podSelector": { - "matchLabels": { - "app.kubernetes.io/name": "argocd-dex-server" - } - }, - "ingress": [ - { - "ports": [ - { - "protocol": "TCP", - "port": 5556 - }, - { - "protocol": "TCP", - "port": 5557 - } - ], - "from": [ - { - "podSelector": { - "matchLabels": { - "app.kubernetes.io/name": "argocd-server" - } - } - } - ] - }, - { - "ports": [ - { - "protocol": "TCP", - "port": 5558 - } - ], - "from": [ - { - "namespaceSelector": {} - } - ] - } - ], - "policyTypes": [ - "Ingress" - ] - } - } \ No newline at end of file diff --git a/utils/testdata/node.json b/utils/testdata/node.json deleted file mode 100644 index a6084db..0000000 --- a/utils/testdata/node.json +++ /dev/null @@ -1,435 +0,0 @@ -{ - "apiVersion": "v1", - "kind": "Node", - "metadata": { - "annotations": { - "alpha.kubernetes.io/provided-node-ip": "10.1.17.10", - "csi.volume.kubernetes.io/nodeid": "{\"ebs.csi.aws.com\":\"i-099ef91944855a3fe\"}", - "node.alpha.kubernetes.io/ttl": "0", - "volumes.kubernetes.io/controller-managed-attach-detach": "true" - }, - "creationTimestamp": "2024-02-22T15:34:14Z", - "labels": { - "beta.kubernetes.io/arch": "amd64", - "beta.kubernetes.io/instance-type": "m5.large", - "beta.kubernetes.io/os": "linux", - "eks.amazonaws.com/capacityType": "ON_DEMAND", - "eks.amazonaws.com/nodegroup": "dev-general-purpose", - "eks.amazonaws.com/nodegroup-image": "ami-01e9ddd1133df4709", - "env": "dev", - "failure-domain.beta.kubernetes.io/region": "eu-west-1", - "failure-domain.beta.kubernetes.io/zone": "eu-west-1a", - "k8s.io/cloud-provider-aws": "4f9e76a978be69f0320476d8299e6345", - "kubernetes.io/arch": "amd64", - "kubernetes.io/hostname": "ip-10-1-17-10.eu-west-1.compute.internal", - "kubernetes.io/os": "linux", - "node.kubernetes.io/instance-type": "m5.large", - "provisioner.cast.ai/node-id": "d688acf0-ea8e-4ab0-8f4b-958f3c8145c4", - "subgroup": "gp", - "topology.ebs.csi.aws.com/zone": "eu-west-1a", - "topology.kubernetes.io/region": "eu-west-1", - "topology.kubernetes.io/zone": "eu-west-1a" - }, - "name": "ip-10-1-17-10.eu-west-1.compute.internal", - "resourceVersion": "748258858", - "uid": "820a5099-c22f-4826-82e9-a3596c778e90" - }, - "spec": { - "providerID": "aws:///eu-west-1a/i-099ef91944855a3fe" - }, - "status": { - "addresses": [ - { - "address": "10.1.17.10", - "type": "InternalIP" - }, - { - "address": "18.201.14.225", - "type": "ExternalIP" - }, - { - "address": "ip-10-1-17-10.eu-west-1.compute.internal", - "type": "Hostname" - }, - { - "address": "ip-10-1-17-10.eu-west-1.compute.internal", - "type": "InternalDNS" - }, - { - "address": "ec2-18-201-14-225.eu-west-1.compute.amazonaws.com", - "type": "ExternalDNS" - } - ], - "allocatable": { - "attachable-volumes-aws-ebs": "25", - "cpu": "1930m", - "ephemeral-storage": "18242267924", - "hugepages-1Gi": "0", - "hugepages-2Mi": "0", - "memory": "7220184Ki", - "pods": "29" - }, - "capacity": { - "attachable-volumes-aws-ebs": "25", - "cpu": "2", - "ephemeral-storage": "20959212Ki", - "hugepages-1Gi": "0", - "hugepages-2Mi": "0", - "memory": "7910360Ki", - "pods": "29" - }, - "conditions": [ - { - "lastHeartbeatTime": "2024-02-29T06:18:37Z", - "lastTransitionTime": "2024-02-22T15:34:13Z", - "message": "kubelet has sufficient memory available", - "reason": "KubeletHasSufficientMemory", - "status": "False", - "type": "MemoryPressure" - }, - { - "lastHeartbeatTime": "2024-02-29T06:18:37Z", - "lastTransitionTime": "2024-02-22T15:34:13Z", - "message": "kubelet has no disk pressure", - "reason": "KubeletHasNoDiskPressure", - "status": "False", - "type": "DiskPressure" - }, - { - "lastHeartbeatTime": "2024-02-29T06:18:37Z", - "lastTransitionTime": "2024-02-22T15:34:13Z", - "message": "kubelet has sufficient PID available", - "reason": "KubeletHasSufficientPID", - "status": "False", - "type": "PIDPressure" - }, - { - "lastHeartbeatTime": "2024-02-29T06:18:37Z", - "lastTransitionTime": "2024-02-22T15:34:30Z", - "message": "kubelet is posting ready status", - "reason": "KubeletReady", - "status": "True", - "type": "Ready" - } - ], - "daemonEndpoints": { - "kubeletEndpoint": { - "Port": 10250 - } - }, - "images": [ - { - "names": [ - "docker.io/apachepulsar/pulsar-all@sha256:fd3e027771f08eb224a3a9e8874514f0f258a0356059120d3f25f151f96506c8", - "docker.io/apachepulsar/pulsar-all:2.10.2" - ], - "sizeBytes": 2648867873 - }, - { - "names": [ - "dreg.armo.cloud:443/portal-backend@sha256:5454525ff0550ef9ccce3db57feabec68183f57f945c69a9634dd7e032084786", - "dreg.armo.cloud:443/portal-backend:1318" - ], - "sizeBytes": 178896658 - }, - { - "names": [ - "docker.io/bitnami/mongodb@sha256:d8c93cb3ab205e9d144ec00ef04d9d8ca733e7b4dd9bc5b4bea5866f47b73bc5", - "docker.io/bitnami/mongodb:4.2.8-debian-10-r33" - ], - "sizeBytes": 174546726 - }, - { - "names": [ - "quay.io/argoproj/argocd@sha256:5f1de1b4d959868c1e006e08d46361c8f019d9730e74bc1feeab8c7b413f1187", - "quay.io/argoproj/argocd:v2.10.1" - ], - "sizeBytes": 169935379 - }, - { - "names": [ - "quay.io/argoproj/argocd@sha256:6a5d0e909b6ad106cef2b7ce73df509b09dc33da9c27e69775c8777084554c52", - "quay.io/argoproj/argocd:v2.7.7" - ], - "sizeBytes": 147277137 - }, - { - "names": [ - "registry.k8s.io/ingress-nginx/controller@sha256:e5c4824e7375fcf2a393e1c03c293b69759af37a9ca6abdb91b13d78a93da8bd" - ], - "sizeBytes": 113903192 - }, - { - "names": [ - "docker.io/grafana/agent@sha256:df177cf6e405258fe78a73d164526a57d5239c9e912ec48cd549bb1a533a9344", - "docker.io/grafana/agent:v0.35.2" - ], - "sizeBytes": 88247981 - }, - { - "names": [ - "quay.io/armosec/event-ingester-service@sha256:8d98f7234432e06e11f66857ca6ed434d668171408b84368e77b9a6eaa2a1f86", - "quay.io/armosec/event-ingester-service:rc-v0.0.237-279" - ], - "sizeBytes": 83685504 - }, - { - "names": [ - "quay.io/armosec/event-ingester-service@sha256:e51dde89d01de86614e9b26bc32f05e6803ed968653ad573979bb1e227f96948", - "quay.io/armosec/event-ingester-service:rc-v0.0.236-277" - ], - "sizeBytes": 83684676 - }, - { - "names": [ - "quay.io/armosec/event-ingester-service@sha256:023ec24f24a348f36dea5a02327a864457bfc18f1361167c1a13e56faa7ee5a6", - "quay.io/armosec/event-ingester-service:v0.0.236" - ], - "sizeBytes": 83684647 - }, - { - "names": [ - "dreg.armo.cloud:443/backend-conf-reloader@sha256:c70d7d38f48f50bbf3bcee701c0e7f79a883ea648083847b5be01389ffed4063", - "dreg.armo.cloud:443/backend-conf-reloader:v1.0" - ], - "sizeBytes": 71840316 - }, - { - "names": [ - "quay.io/armosec/backend-conf-reloader@sha256:c2ecba824467482e802c61e80d01220808eeaa5181dba385d4836075b961a574", - "quay.io/armosec/backend-conf-reloader:v1.0" - ], - "sizeBytes": 71838291 - }, - { - "names": [ - "docker.io/grafana/promtail@sha256:626900031c4ea955ef9094bf49386eb4b6928609b5d8aa27df8172342edf1136", - "docker.io/grafana/promtail:2.4.2" - ], - "sizeBytes": 67329843 - }, - { - "names": [ - "602401143452.dkr.ecr-fips.us-east-1.amazonaws.com/amazon-k8s-cni-init:v1.13.2", - "602401143452.dkr.ecr-fips.us-east-1.amazonaws.com/amazon-k8s-cni-init:v1.13.2-eksbuild.1", - "602401143452.dkr.ecr-fips.us-east-2.amazonaws.com/amazon-k8s-cni-init:v1.13.2", - "602401143452.dkr.ecr-fips.us-east-2.amazonaws.com/amazon-k8s-cni-init:v1.13.2-eksbuild.1", - "602401143452.dkr.ecr-fips.us-west-1.amazonaws.com/amazon-k8s-cni-init:v1.13.2" - ], - "sizeBytes": 59663187 - }, - { - "names": [ - "dreg.armo.cloud:443/armo-ui-sonar-predev@sha256:9ad0f7d7526659506c2ece707dda50b0a0d275a8993ab942fdac43be00601e2b", - "dreg.armo.cloud:443/armo-ui-sonar-predev:86" - ], - "sizeBytes": 58791251 - }, - { - "names": [ - "docker.io/bitnami/mongodb-exporter@sha256:2cb375c08d9a7d4d9b4e8f937a2abae05d7daebab19cf699196d47406b905c1c", - "docker.io/bitnami/mongodb-exporter:0.11.0-debian-10-r82" - ], - "sizeBytes": 44347800 - }, - { - "names": [ - "602401143452.dkr.ecr-fips.us-east-1.amazonaws.com/amazon-k8s-cni:v1.13.2", - "602401143452.dkr.ecr-fips.us-east-1.amazonaws.com/amazon-k8s-cni:v1.13.2-eksbuild.1", - "602401143452.dkr.ecr-fips.us-east-2.amazonaws.com/amazon-k8s-cni:v1.13.2", - "602401143452.dkr.ecr-fips.us-east-2.amazonaws.com/amazon-k8s-cni:v1.13.2-eksbuild.1", - "602401143452.dkr.ecr-fips.us-west-1.amazonaws.com/amazon-k8s-cni:v1.13.2" - ], - "sizeBytes": 44059679 - }, - { - "names": [ - "docker.io/grafana/tempo@sha256:4bcaa474c47869039b738395dec656eaa87a4916a9cef69604c6d82cde63b073", - "docker.io/grafana/tempo:2.2.1" - ], - "sizeBytes": 43225658 - }, - { - "names": [ - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/kube-proxy@sha256:60be4699c5a0baa0867490358acad8041f1c981ecfe4d95d7aa35c1a5184cc9b", - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/kube-proxy:v1.24.10-eksbuild.2" - ], - "sizeBytes": 39742300 - }, - { - "names": [ - "quay.io/matthiasb_1/node-agent@sha256:3f17cd9fb5f6aee97a049288117972fb15f5734c85a0d0f5dddac781022e8587" - ], - "sizeBytes": 38353990 - }, - { - "names": [ - "quay.io/armosec/kubecop@sha256:0dac6dc01d12adb917c909a0dae267da0ee06cb4fc85644f50752c972deb38a4", - "quay.io/armosec/kubecop:v0.0.36" - ], - "sizeBytes": 36922588 - }, - { - "names": [ - "ghcr.io/dexidp/dex@sha256:f579d00721b0d842328c43a562f50343c54b0048ef2d58d6b54e750c21fc7938", - "ghcr.io/dexidp/dex:v2.37.0" - ], - "sizeBytes": 32502483 - }, - { - "names": [ - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/aws-ebs-csi-driver@sha256:71885dc32a4a1d7c9a1911589f44dcb92a28551fb60da05b6f2b246e59dac90e", - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/aws-ebs-csi-driver:v1.20.0" - ], - "sizeBytes": 30363212 - }, - { - "names": [ - "quay.io/armosec/dashboard-backend@sha256:ac2825e3cfb2ced4bff86469588dabe05c809ef42de59273122bdb2320955bcc", - "quay.io/armosec/dashboard-backend:rc-v0.0.52-1054" - ], - "sizeBytes": 28959368 - }, - { - "names": [ - "quay.io/armosec/dashboard-backend@sha256:1431c665da35889f497d3ef5742654fc1c50019be0cfc5fd98d97f89f0e61ac0", - "quay.io/armosec/dashboard-backend:rc-v0.0.51-1052", - "quay.io/armosec/dashboard-backend:v0.0.51" - ], - "sizeBytes": 28958156 - }, - { - "names": [ - "quay.io/armosec/dashboard-backend@sha256:47f1e7d95c1e671f2c817ac71581d433c6c44b7963a87b5a2431afee1d49833c", - "quay.io/armosec/dashboard-backend:v0.0.50" - ], - "sizeBytes": 28904211 - }, - { - "names": [ - "docker.io/fission/fission-bundle@sha256:3c50884b04ca48a1f0f8afcc8d107037fb9079af2421294d4aba1370832c6b3d", - "docker.io/fission/fission-bundle:v1.15.1" - ], - "sizeBytes": 21561920 - }, - { - "names": [ - "dreg.armo.cloud:443/dashboard-event-receiver@sha256:f68a1d2ad46f564ae553bf52ce67f0676437aed25298d537f77dcf12b4c3dbe0", - "dreg.armo.cloud:443/dashboard-event-receiver:284" - ], - "sizeBytes": 16393386 - }, - { - "names": [ - "quay.io/armosec/kubescape-config-service@sha256:4a7574ecfe0ae0431fed6f25431c5e8dac1480a3a70192cf4c6450b1788a7914", - "quay.io/armosec/kubescape-config-service:rc-v0.0.102-109" - ], - "sizeBytes": 15650719 - }, - { - "names": [ - "quay.io/armosec/kubescape-config-service@sha256:c9f4d1e46b2c20e887440306d0fbde3032aed41c4d413329aafc9abb77d4c8b3", - "quay.io/armosec/kubescape-config-service:rc-v0.0.102-110" - ], - "sizeBytes": 15650567 - }, - { - "names": [ - "quay.io/armosec/kubescape-config-service@sha256:f5268c58ce29220623e58f37ce2f44bf56659102f1d5703b9d1cbf06d3653a14", - "quay.io/armosec/kubescape-config-service:v0.0.101" - ], - "sizeBytes": 15648171 - }, - { - "names": [ - "quay.io/prometheus/node-exporter@sha256:d2e48098c364e61ee62d9016eed863b66331d87cf67146f2068b70ed9d9b4f98", - "quay.io/prometheus/node-exporter:v1.6.0" - ], - "sizeBytes": 11728452 - }, - { - "names": [ - "quay.io/armosec/users-notification-service@sha256:d90dd66c73eddbcb8720f092e18e2b2e8ce7cf1526a99e5881d388c6c99d441e", - "quay.io/armosec/users-notification-service:v0.0.127" - ], - "sizeBytes": 10896270 - }, - { - "names": [ - "dreg.armo.cloud:443/notification-server@sha256:338c659982df5722c6880bcec91ceb34d3391358a0df41a0b9d22e15d3ece19a", - "dreg.armo.cloud:443/notification-server:92" - ], - "sizeBytes": 6959386 - }, - { - "names": [ - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/csi-node-driver-registrar@sha256:74e13dfff1d73b0e39ae5883b5843d1672258b34f7d4757995c72d92a26bed1e", - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/csi-node-driver-registrar:v2.8.0-eks-1-27-3" - ], - "sizeBytes": 6651094 - }, - { - "names": [ - "quay.io/kubescape/host-scanner@sha256:89fe7df48898769110dc6fb96050c3a8f58dd8d8dbc795b21471bb68148516f2", - "quay.io/kubescape/host-scanner:v1.0.66" - ], - "sizeBytes": 6472151 - }, - { - "names": [ - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/livenessprobe@sha256:25b4d3f9cf686ac464a742ead16e705da3adcfe574296dd75c5c05ec7473a513", - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/livenessprobe:v2.10.0-eks-1-27-3" - ], - "sizeBytes": 6178396 - }, - { - "names": [ - "docker.io/library/busybox@sha256:6d9ac9237a84afe1516540f40a0fafdc86859b2141954b4d643af7066d598b74", - "docker.io/library/busybox:latest" - ], - "sizeBytes": 2231050 - }, - { - "names": [ - "602401143452.dkr.ecr-fips.us-east-1.amazonaws.com/eks/pause:3.5", - "602401143452.dkr.ecr-fips.us-east-2.amazonaws.com/eks/pause:3.5", - "602401143452.dkr.ecr-fips.us-west-1.amazonaws.com/eks/pause:3.5", - "602401143452.dkr.ecr-fips.us-west-2.amazonaws.com/eks/pause:3.5", - "602401143452.dkr.ecr.af-south-1.amazonaws.com/eks/pause:3.5" - ], - "sizeBytes": 298689 - } - ], - "nodeInfo": { - "architecture": "amd64", - "bootID": "735e07e4-2d03-4374-b81f-dc194db90a92", - "containerRuntimeVersion": "containerd://1.6.19", - "kernelVersion": "5.10.184-175.731.amzn2.x86_64", - "kubeProxyVersion": "v1.24.13-eks-0a21954", - "kubeletVersion": "v1.24.13-eks-0a21954", - "machineID": "ec280c68e1518670527543983845f958", - "operatingSystem": "linux", - "osImage": "Amazon Linux 2", - "systemUUID": "ec280c68-e151-8670-5275-43983845f958" - }, - "volumesAttached": [ - { - "devicePath": "", - "name": "kubernetes.io/csi/ebs.csi.aws.com^vol-04274721dcf507828" - }, - { - "devicePath": "", - "name": "kubernetes.io/csi/ebs.csi.aws.com^vol-002f3eb275d4677e9" - }, - { - "devicePath": "", - "name": "kubernetes.io/csi/ebs.csi.aws.com^vol-0431d2091bea4aff6" - } - ], - "volumesInUse": [ - "kubernetes.io/csi/ebs.csi.aws.com^vol-002f3eb275d4677e9", - "kubernetes.io/csi/ebs.csi.aws.com^vol-04274721dcf507828", - "kubernetes.io/csi/ebs.csi.aws.com^vol-0431d2091bea4aff6" - ] - } -} diff --git a/utils/testdata/nodeCleaned.json b/utils/testdata/nodeCleaned.json deleted file mode 100644 index c90d385..0000000 --- a/utils/testdata/nodeCleaned.json +++ /dev/null @@ -1,402 +0,0 @@ -{ - "apiVersion": "v1", - "kind": "Node", - "metadata": { - "annotations": { - "alpha.kubernetes.io/provided-node-ip": "10.1.17.10", - "csi.volume.kubernetes.io/nodeid": "{\"ebs.csi.aws.com\":\"i-099ef91944855a3fe\"}", - "node.alpha.kubernetes.io/ttl": "0", - "volumes.kubernetes.io/controller-managed-attach-detach": "true" - }, - "creationTimestamp": "2024-02-22T15:34:14Z", - "labels": { - "beta.kubernetes.io/arch": "amd64", - "beta.kubernetes.io/instance-type": "m5.large", - "beta.kubernetes.io/os": "linux", - "eks.amazonaws.com/capacityType": "ON_DEMAND", - "eks.amazonaws.com/nodegroup": "dev-general-purpose", - "eks.amazonaws.com/nodegroup-image": "ami-01e9ddd1133df4709", - "env": "dev", - "failure-domain.beta.kubernetes.io/region": "eu-west-1", - "failure-domain.beta.kubernetes.io/zone": "eu-west-1a", - "k8s.io/cloud-provider-aws": "4f9e76a978be69f0320476d8299e6345", - "kubernetes.io/arch": "amd64", - "kubernetes.io/hostname": "ip-10-1-17-10.eu-west-1.compute.internal", - "kubernetes.io/os": "linux", - "node.kubernetes.io/instance-type": "m5.large", - "provisioner.cast.ai/node-id": "d688acf0-ea8e-4ab0-8f4b-958f3c8145c4", - "subgroup": "gp", - "topology.ebs.csi.aws.com/zone": "eu-west-1a", - "topology.kubernetes.io/region": "eu-west-1", - "topology.kubernetes.io/zone": "eu-west-1a" - }, - "name": "ip-10-1-17-10.eu-west-1.compute.internal", - "resourceVersion": "748258858", - "uid": "820a5099-c22f-4826-82e9-a3596c778e90" - }, - "spec": { - "providerID": "aws:///eu-west-1a/i-099ef91944855a3fe" - }, - "status": { - "addresses": [ - { - "address": "10.1.17.10", - "type": "InternalIP" - }, - { - "address": "18.201.14.225", - "type": "ExternalIP" - }, - { - "address": "ip-10-1-17-10.eu-west-1.compute.internal", - "type": "Hostname" - }, - { - "address": "ip-10-1-17-10.eu-west-1.compute.internal", - "type": "InternalDNS" - }, - { - "address": "ec2-18-201-14-225.eu-west-1.compute.amazonaws.com", - "type": "ExternalDNS" - } - ], - "allocatable": { - "attachable-volumes-aws-ebs": "25", - "cpu": "1930m", - "ephemeral-storage": "18242267924", - "hugepages-1Gi": "0", - "hugepages-2Mi": "0", - "memory": "7220184Ki", - "pods": "29" - }, - "capacity": { - "attachable-volumes-aws-ebs": "25", - "cpu": "2", - "ephemeral-storage": "20959212Ki", - "hugepages-1Gi": "0", - "hugepages-2Mi": "0", - "memory": "7910360Ki", - "pods": "29" - }, - "conditions": null, - "daemonEndpoints": { - "kubeletEndpoint": { - "Port": 10250 - } - }, - "images": [ - { - "names": [ - "docker.io/apachepulsar/pulsar-all@sha256:fd3e027771f08eb224a3a9e8874514f0f258a0356059120d3f25f151f96506c8", - "docker.io/apachepulsar/pulsar-all:2.10.2" - ], - "sizeBytes": 2648867873 - }, - { - "names": [ - "dreg.armo.cloud:443/portal-backend@sha256:5454525ff0550ef9ccce3db57feabec68183f57f945c69a9634dd7e032084786", - "dreg.armo.cloud:443/portal-backend:1318" - ], - "sizeBytes": 178896658 - }, - { - "names": [ - "docker.io/bitnami/mongodb@sha256:d8c93cb3ab205e9d144ec00ef04d9d8ca733e7b4dd9bc5b4bea5866f47b73bc5", - "docker.io/bitnami/mongodb:4.2.8-debian-10-r33" - ], - "sizeBytes": 174546726 - }, - { - "names": [ - "quay.io/argoproj/argocd@sha256:5f1de1b4d959868c1e006e08d46361c8f019d9730e74bc1feeab8c7b413f1187", - "quay.io/argoproj/argocd:v2.10.1" - ], - "sizeBytes": 169935379 - }, - { - "names": [ - "quay.io/argoproj/argocd@sha256:6a5d0e909b6ad106cef2b7ce73df509b09dc33da9c27e69775c8777084554c52", - "quay.io/argoproj/argocd:v2.7.7" - ], - "sizeBytes": 147277137 - }, - { - "names": [ - "registry.k8s.io/ingress-nginx/controller@sha256:e5c4824e7375fcf2a393e1c03c293b69759af37a9ca6abdb91b13d78a93da8bd" - ], - "sizeBytes": 113903192 - }, - { - "names": [ - "docker.io/grafana/agent@sha256:df177cf6e405258fe78a73d164526a57d5239c9e912ec48cd549bb1a533a9344", - "docker.io/grafana/agent:v0.35.2" - ], - "sizeBytes": 88247981 - }, - { - "names": [ - "quay.io/armosec/event-ingester-service@sha256:8d98f7234432e06e11f66857ca6ed434d668171408b84368e77b9a6eaa2a1f86", - "quay.io/armosec/event-ingester-service:rc-v0.0.237-279" - ], - "sizeBytes": 83685504 - }, - { - "names": [ - "quay.io/armosec/event-ingester-service@sha256:e51dde89d01de86614e9b26bc32f05e6803ed968653ad573979bb1e227f96948", - "quay.io/armosec/event-ingester-service:rc-v0.0.236-277" - ], - "sizeBytes": 83684676 - }, - { - "names": [ - "quay.io/armosec/event-ingester-service@sha256:023ec24f24a348f36dea5a02327a864457bfc18f1361167c1a13e56faa7ee5a6", - "quay.io/armosec/event-ingester-service:v0.0.236" - ], - "sizeBytes": 83684647 - }, - { - "names": [ - "dreg.armo.cloud:443/backend-conf-reloader@sha256:c70d7d38f48f50bbf3bcee701c0e7f79a883ea648083847b5be01389ffed4063", - "dreg.armo.cloud:443/backend-conf-reloader:v1.0" - ], - "sizeBytes": 71840316 - }, - { - "names": [ - "quay.io/armosec/backend-conf-reloader@sha256:c2ecba824467482e802c61e80d01220808eeaa5181dba385d4836075b961a574", - "quay.io/armosec/backend-conf-reloader:v1.0" - ], - "sizeBytes": 71838291 - }, - { - "names": [ - "docker.io/grafana/promtail@sha256:626900031c4ea955ef9094bf49386eb4b6928609b5d8aa27df8172342edf1136", - "docker.io/grafana/promtail:2.4.2" - ], - "sizeBytes": 67329843 - }, - { - "names": [ - "602401143452.dkr.ecr-fips.us-east-1.amazonaws.com/amazon-k8s-cni-init:v1.13.2", - "602401143452.dkr.ecr-fips.us-east-1.amazonaws.com/amazon-k8s-cni-init:v1.13.2-eksbuild.1", - "602401143452.dkr.ecr-fips.us-east-2.amazonaws.com/amazon-k8s-cni-init:v1.13.2", - "602401143452.dkr.ecr-fips.us-east-2.amazonaws.com/amazon-k8s-cni-init:v1.13.2-eksbuild.1", - "602401143452.dkr.ecr-fips.us-west-1.amazonaws.com/amazon-k8s-cni-init:v1.13.2" - ], - "sizeBytes": 59663187 - }, - { - "names": [ - "dreg.armo.cloud:443/armo-ui-sonar-predev@sha256:9ad0f7d7526659506c2ece707dda50b0a0d275a8993ab942fdac43be00601e2b", - "dreg.armo.cloud:443/armo-ui-sonar-predev:86" - ], - "sizeBytes": 58791251 - }, - { - "names": [ - "docker.io/bitnami/mongodb-exporter@sha256:2cb375c08d9a7d4d9b4e8f937a2abae05d7daebab19cf699196d47406b905c1c", - "docker.io/bitnami/mongodb-exporter:0.11.0-debian-10-r82" - ], - "sizeBytes": 44347800 - }, - { - "names": [ - "602401143452.dkr.ecr-fips.us-east-1.amazonaws.com/amazon-k8s-cni:v1.13.2", - "602401143452.dkr.ecr-fips.us-east-1.amazonaws.com/amazon-k8s-cni:v1.13.2-eksbuild.1", - "602401143452.dkr.ecr-fips.us-east-2.amazonaws.com/amazon-k8s-cni:v1.13.2", - "602401143452.dkr.ecr-fips.us-east-2.amazonaws.com/amazon-k8s-cni:v1.13.2-eksbuild.1", - "602401143452.dkr.ecr-fips.us-west-1.amazonaws.com/amazon-k8s-cni:v1.13.2" - ], - "sizeBytes": 44059679 - }, - { - "names": [ - "docker.io/grafana/tempo@sha256:4bcaa474c47869039b738395dec656eaa87a4916a9cef69604c6d82cde63b073", - "docker.io/grafana/tempo:2.2.1" - ], - "sizeBytes": 43225658 - }, - { - "names": [ - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/kube-proxy@sha256:60be4699c5a0baa0867490358acad8041f1c981ecfe4d95d7aa35c1a5184cc9b", - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/kube-proxy:v1.24.10-eksbuild.2" - ], - "sizeBytes": 39742300 - }, - { - "names": [ - "quay.io/matthiasb_1/node-agent@sha256:3f17cd9fb5f6aee97a049288117972fb15f5734c85a0d0f5dddac781022e8587" - ], - "sizeBytes": 38353990 - }, - { - "names": [ - "quay.io/armosec/kubecop@sha256:0dac6dc01d12adb917c909a0dae267da0ee06cb4fc85644f50752c972deb38a4", - "quay.io/armosec/kubecop:v0.0.36" - ], - "sizeBytes": 36922588 - }, - { - "names": [ - "ghcr.io/dexidp/dex@sha256:f579d00721b0d842328c43a562f50343c54b0048ef2d58d6b54e750c21fc7938", - "ghcr.io/dexidp/dex:v2.37.0" - ], - "sizeBytes": 32502483 - }, - { - "names": [ - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/aws-ebs-csi-driver@sha256:71885dc32a4a1d7c9a1911589f44dcb92a28551fb60da05b6f2b246e59dac90e", - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/aws-ebs-csi-driver:v1.20.0" - ], - "sizeBytes": 30363212 - }, - { - "names": [ - "quay.io/armosec/dashboard-backend@sha256:ac2825e3cfb2ced4bff86469588dabe05c809ef42de59273122bdb2320955bcc", - "quay.io/armosec/dashboard-backend:rc-v0.0.52-1054" - ], - "sizeBytes": 28959368 - }, - { - "names": [ - "quay.io/armosec/dashboard-backend@sha256:1431c665da35889f497d3ef5742654fc1c50019be0cfc5fd98d97f89f0e61ac0", - "quay.io/armosec/dashboard-backend:rc-v0.0.51-1052", - "quay.io/armosec/dashboard-backend:v0.0.51" - ], - "sizeBytes": 28958156 - }, - { - "names": [ - "quay.io/armosec/dashboard-backend@sha256:47f1e7d95c1e671f2c817ac71581d433c6c44b7963a87b5a2431afee1d49833c", - "quay.io/armosec/dashboard-backend:v0.0.50" - ], - "sizeBytes": 28904211 - }, - { - "names": [ - "docker.io/fission/fission-bundle@sha256:3c50884b04ca48a1f0f8afcc8d107037fb9079af2421294d4aba1370832c6b3d", - "docker.io/fission/fission-bundle:v1.15.1" - ], - "sizeBytes": 21561920 - }, - { - "names": [ - "dreg.armo.cloud:443/dashboard-event-receiver@sha256:f68a1d2ad46f564ae553bf52ce67f0676437aed25298d537f77dcf12b4c3dbe0", - "dreg.armo.cloud:443/dashboard-event-receiver:284" - ], - "sizeBytes": 16393386 - }, - { - "names": [ - "quay.io/armosec/kubescape-config-service@sha256:4a7574ecfe0ae0431fed6f25431c5e8dac1480a3a70192cf4c6450b1788a7914", - "quay.io/armosec/kubescape-config-service:rc-v0.0.102-109" - ], - "sizeBytes": 15650719 - }, - { - "names": [ - "quay.io/armosec/kubescape-config-service@sha256:c9f4d1e46b2c20e887440306d0fbde3032aed41c4d413329aafc9abb77d4c8b3", - "quay.io/armosec/kubescape-config-service:rc-v0.0.102-110" - ], - "sizeBytes": 15650567 - }, - { - "names": [ - "quay.io/armosec/kubescape-config-service@sha256:f5268c58ce29220623e58f37ce2f44bf56659102f1d5703b9d1cbf06d3653a14", - "quay.io/armosec/kubescape-config-service:v0.0.101" - ], - "sizeBytes": 15648171 - }, - { - "names": [ - "quay.io/prometheus/node-exporter@sha256:d2e48098c364e61ee62d9016eed863b66331d87cf67146f2068b70ed9d9b4f98", - "quay.io/prometheus/node-exporter:v1.6.0" - ], - "sizeBytes": 11728452 - }, - { - "names": [ - "quay.io/armosec/users-notification-service@sha256:d90dd66c73eddbcb8720f092e18e2b2e8ce7cf1526a99e5881d388c6c99d441e", - "quay.io/armosec/users-notification-service:v0.0.127" - ], - "sizeBytes": 10896270 - }, - { - "names": [ - "dreg.armo.cloud:443/notification-server@sha256:338c659982df5722c6880bcec91ceb34d3391358a0df41a0b9d22e15d3ece19a", - "dreg.armo.cloud:443/notification-server:92" - ], - "sizeBytes": 6959386 - }, - { - "names": [ - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/csi-node-driver-registrar@sha256:74e13dfff1d73b0e39ae5883b5843d1672258b34f7d4757995c72d92a26bed1e", - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/csi-node-driver-registrar:v2.8.0-eks-1-27-3" - ], - "sizeBytes": 6651094 - }, - { - "names": [ - "quay.io/kubescape/host-scanner@sha256:89fe7df48898769110dc6fb96050c3a8f58dd8d8dbc795b21471bb68148516f2", - "quay.io/kubescape/host-scanner:v1.0.66" - ], - "sizeBytes": 6472151 - }, - { - "names": [ - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/livenessprobe@sha256:25b4d3f9cf686ac464a742ead16e705da3adcfe574296dd75c5c05ec7473a513", - "602401143452.dkr.ecr.eu-west-1.amazonaws.com/eks/livenessprobe:v2.10.0-eks-1-27-3" - ], - "sizeBytes": 6178396 - }, - { - "names": [ - "docker.io/library/busybox@sha256:6d9ac9237a84afe1516540f40a0fafdc86859b2141954b4d643af7066d598b74", - "docker.io/library/busybox:latest" - ], - "sizeBytes": 2231050 - }, - { - "names": [ - "602401143452.dkr.ecr-fips.us-east-1.amazonaws.com/eks/pause:3.5", - "602401143452.dkr.ecr-fips.us-east-2.amazonaws.com/eks/pause:3.5", - "602401143452.dkr.ecr-fips.us-west-1.amazonaws.com/eks/pause:3.5", - "602401143452.dkr.ecr-fips.us-west-2.amazonaws.com/eks/pause:3.5", - "602401143452.dkr.ecr.af-south-1.amazonaws.com/eks/pause:3.5" - ], - "sizeBytes": 298689 - } - ], - "nodeInfo": { - "architecture": "amd64", - "bootID": "735e07e4-2d03-4374-b81f-dc194db90a92", - "containerRuntimeVersion": "containerd://1.6.19", - "kernelVersion": "5.10.184-175.731.amzn2.x86_64", - "kubeProxyVersion": "v1.24.13-eks-0a21954", - "kubeletVersion": "v1.24.13-eks-0a21954", - "machineID": "ec280c68e1518670527543983845f958", - "operatingSystem": "linux", - "osImage": "Amazon Linux 2", - "systemUUID": "ec280c68-e151-8670-5275-43983845f958" - }, - "volumesAttached": [ - { - "devicePath": "", - "name": "kubernetes.io/csi/ebs.csi.aws.com^vol-04274721dcf507828" - }, - { - "devicePath": "", - "name": "kubernetes.io/csi/ebs.csi.aws.com^vol-002f3eb275d4677e9" - }, - { - "devicePath": "", - "name": "kubernetes.io/csi/ebs.csi.aws.com^vol-0431d2091bea4aff6" - } - ], - "volumesInUse": [ - "kubernetes.io/csi/ebs.csi.aws.com^vol-002f3eb275d4677e9", - "kubernetes.io/csi/ebs.csi.aws.com^vol-04274721dcf507828", - "kubernetes.io/csi/ebs.csi.aws.com^vol-0431d2091bea4aff6" - ] - } -} diff --git a/utils/testdata/pod.json b/utils/testdata/pod.json deleted file mode 100644 index 936fe1d..0000000 --- a/utils/testdata/pod.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "apiVersion": "v1", - "kind": "Pod", - "metadata": { - "creationTimestamp": "2023-11-15T15:19:53Z", - "generateName": "nginx-748c667d99-", - "labels": { - "app": "nginx", - "pod-template-hash": "748c667d99" - }, - "name": "nginx-748c667d99-6cw4b", - "namespace": "default", - "ownerReferences": [ - { - "apiVersion": "apps/v1", - "blockOwnerDeletion": true, - "controller": true, - "kind": "ReplicaSet", - "name": "nginx-748c667d99", - "uid": "43aeb5db-771f-4483-9998-9ef1e2eed2ee" - } - ], - "resourceVersion": "129152", - "uid": "aa5e3e8f-2da5-4c38-93c0-210d3280d10f" - }, - "spec": { - "containers": [ - { - "image": "nginx", - "imagePullPolicy": "Always", - "name": "nginx", - "resources": {}, - "terminationMessagePath": "/dev/termination-log", - "terminationMessagePolicy": "File", - "volumeMounts": [ - { - "mountPath": "/var/run/secrets/kubernetes.io/serviceaccount", - "name": "kube-api-access-fszp8", - "readOnly": true - } - ] - } - ], - "dnsPolicy": "ClusterFirst", - "enableServiceLinks": true, - "nodeName": "kind-control-plane", - "preemptionPolicy": "PreemptLowerPriority", - "priority": 0, - "restartPolicy": "Always", - "schedulerName": "default-scheduler", - "securityContext": {}, - "serviceAccount": "default", - "serviceAccountName": "default", - "terminationGracePeriodSeconds": 30, - "tolerations": [ - { - "effect": "NoExecute", - "key": "node.kubernetes.io/not-ready", - "operator": "Exists", - "tolerationSeconds": 300 - }, - { - "effect": "NoExecute", - "key": "node.kubernetes.io/unreachable", - "operator": "Exists", - "tolerationSeconds": 300 - } - ], - "volumes": [ - { - "name": "kube-api-access-fszp8", - "projected": { - "defaultMode": 420, - "sources": [ - { - "serviceAccountToken": { - "expirationSeconds": 3607, - "path": "token" - } - }, - { - "configMap": { - "items": [ - { - "key": "ca.crt", - "path": "ca.crt" - } - ], - "name": "kube-root-ca.crt" - } - }, - { - "downwardAPI": { - "items": [ - { - "fieldRef": { - "apiVersion": "v1", - "fieldPath": "metadata.namespace" - }, - "path": "namespace" - } - ] - } - } - ] - } - } - ] - }, - "status": { - "conditions": [ - { - "lastProbeTime": null, - "lastTransitionTime": "2023-11-15T15:19:53Z", - "status": "True", - "type": "Initialized" - }, - { - "lastProbeTime": null, - "lastTransitionTime": "2023-11-15T15:19:55Z", - "status": "True", - "type": "Ready" - }, - { - "lastProbeTime": null, - "lastTransitionTime": "2023-11-15T15:19:55Z", - "status": "True", - "type": "ContainersReady" - }, - { - "lastProbeTime": null, - "lastTransitionTime": "2023-11-15T15:19:53Z", - "status": "True", - "type": "PodScheduled" - } - ], - "containerStatuses": [ - { - "containerID": "containerd://1bc63d7b22a02c347be84adb772c6991eaa25d56c252d21c8553a1b79ad515c1", - "image": "docker.io/library/nginx:latest", - "imageID": "docker.io/library/nginx@sha256:86e53c4c16a6a276b204b0fd3a8143d86547c967dc8258b3d47c3a21bb68d3c6", - "lastState": {}, - "name": "nginx", - "ready": true, - "restartCount": 0, - "started": true, - "state": { - "running": { - "startedAt": "2023-11-15T15:19:55Z" - } - } - } - ], - "hostIP": "172.18.0.2", - "phase": "Running", - "podIP": "10.244.0.41", - "podIPs": [ - { - "ip": "10.244.0.41" - } - ], - "qosClass": "BestEffort", - "startTime": "2023-11-15T15:19:53Z" - } -} diff --git a/utils/utils.go b/utils/utils.go index 575c59e..ac1a9a0 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -2,10 +2,8 @@ package utils import ( "context" - "encoding/hex" "encoding/json" "errors" - "flag" "fmt" "net/http" "net/http/pprof" @@ -15,7 +13,6 @@ import ( "strconv" "time" - "github.com/SergJa/jsonhash" "github.com/apache/pulsar-client-go/pulsar" "github.com/cenkalti/backoff/v4" "github.com/davecgh/go-spew/spew" @@ -26,9 +23,7 @@ import ( "github.com/kubescape/synchronizer/domain" "github.com/pmezard/go-difflib/difflib" "github.com/stretchr/testify/assert" - "go.uber.org/multierr" "golang.org/x/mod/semver" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/client-go/dynamic" "k8s.io/client-go/rest" @@ -36,16 +31,6 @@ import ( "k8s.io/client-go/util/homedir" ) -func CanonicalHash(in []byte) (string, error) { - hash, err := jsonhash.CalculateJsonHash(in, []string{ - ".status.conditions", // avoid Pod.status.conditions.lastProbeTime: null - }) - if err != nil { - return "", err - } - return hex.EncodeToString(hash[:]), nil -} - func NewMsgId() string { return uuid.NewString() } @@ -193,17 +178,12 @@ func getConfig() (*rest.Config, error) { if err == nil { return clusterConfig, nil } - // fallback to kubeconfig - var kubeconfig *string + // fallback to local kubeconfig if home := homedir.HomeDir(); home != "" { - kubeconfig = flag.String("kubeconfig", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file") - } else { - kubeconfig = flag.String("kubeconfig", "", "absolute path to the kubeconfig file") - } - flag.Parse() - clusterConfig, err = clientcmd.BuildConfigFromFlags("", *kubeconfig) - if err == nil { - return clusterConfig, nil + clusterConfig, err = clientcmd.BuildConfigFromFlags("", filepath.Join(home, ".kube", "config")) + if err == nil { + return clusterConfig, nil + } } // nothing works return nil, errors.New("unable to find config") @@ -261,26 +241,6 @@ func StringValueBigger(s1, s2 string) bool { return i1 > i2 } -func RemoveManagedFields(d metav1.Object) { - // Remove managed fields - d.SetManagedFields(nil) - // Remove last-applied-configuration annotation - ann := d.GetAnnotations() - delete(ann, "kubectl.kubernetes.io/last-applied-configuration") - d.SetAnnotations(ann) -} - -func RemoveSpecificFields(d *unstructured.Unstructured, fields [][]string) error { - var errs error - for _, f := range fields { - err := unstructured.SetNestedField(d.Object, nil, f...) - if err != nil { - errs = multierr.Append(errs, fmt.Errorf("failed to remove field %s: %w", f, err)) - } - } - return errs -} - func NewBackOff() backoff.BackOff { b := backoff.NewExponentialBackOff() // never stop retrying (unless PermanentError is returned) diff --git a/utils/utils_test.go b/utils/utils_test.go index 948bc40..4f5426a 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -2,55 +2,12 @@ package utils import ( "context" - "encoding/json" "testing" - "github.com/kinbiko/jsonassert" "github.com/kubescape/synchronizer/domain" "github.com/stretchr/testify/assert" - "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) -func TestCanonicalHash(t *testing.T) { - tests := []struct { - name string - in []byte - want string - wantErr bool - }{ - { - name: "error", - in: []byte("test"), - wantErr: true, - }, - { - name: "empty", - in: []byte("{}"), - want: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - }, - { - name: "simple", - in: []byte(`{"a":"b"}`), - want: "baf4fd048ca2e8f75d531af13c5869eaa8e38c3020e1dfcebe3c3ac019a3bab2", - }, - { - name: "pod", - in: FileContent("testdata/pod.json"), - want: "1ae52b23166388144c602360fb73dd68736e88943f6e16fab1bf07347484f8e8", - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := CanonicalHash(tt.in) - if (err != nil) != tt.wantErr { - t.Errorf("CanonicalHash() error = %v, wantErr %v", err, tt.wantErr) - return - } - assert.Equal(t, tt.want, got) - }) - } -} - func TestContextFromGeneric(t *testing.T) { got := ContextFromGeneric(context.TODO(), domain.Generic{}) assert.Equal(t, 0, got.Value(domain.ContextKeyDepth)) @@ -95,66 +52,6 @@ func TestClientIdentifier_RoundTrip(t *testing.T) { } } -func TestRemoveManagedFields(t *testing.T) { - tests := []struct { - name string - obj *unstructured.Unstructured - want []byte - }{ - { - name: "Remove fields from networkPolicy", - obj: FileToUnstructured("testdata/networkPolicy.json"), - want: FileContent("testdata/networkPolicyCleaned.json"), - }, - { - name: "Do nothing if no managedFields", - obj: FileToUnstructured("testdata/pod.json"), - want: FileContent("testdata/pod.json"), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - RemoveManagedFields(tt.obj) - ja := jsonassert.New(t) - b, err := json.Marshal(tt.obj.Object) - assert.NoError(t, err) - ja.Assertf(string(b), string(tt.want)) - }) - } -} - -func TestRemoveSpecificFields(t *testing.T) { - tests := []struct { - name string - fields [][]string - obj *unstructured.Unstructured - want []byte - }{ - { - name: "remove fields from node", - fields: [][]string{{"status", "conditions"}}, - obj: FileToUnstructured("testdata/node.json"), - want: FileContent("testdata/nodeCleaned.json"), - }, - { - name: "remove no fields from pod", - fields: [][]string{}, - obj: FileToUnstructured("testdata/pod.json"), - want: FileContent("testdata/pod.json"), - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := RemoveSpecificFields(tt.obj, tt.fields) - assert.NoError(t, err) - ja := jsonassert.New(t) - b, err := json.Marshal(tt.obj.Object) - assert.NoError(t, err) - ja.Assertf(string(b), string(tt.want)) - }) - } -} - func TestGreaterOrEqualVersion(t *testing.T) { testCases := []struct { a string