Skip to content

Commit

Permalink
chore: Remove watched-by label from manifest resources (#1945)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-pius authored Oct 10, 2024
1 parent 1618c51 commit e508ff7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
5 changes: 2 additions & 3 deletions internal/declarative/v2/default_transforms.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ func KymaComponentTransform(_ context.Context, obj Object, resources []*unstruct
return nil
}

func WatchedByManagedByOwnedBy(_ context.Context, obj Object, resources []*unstructured.Unstructured) error {
func ManagedByOwnedBy(_ context.Context, obj Object, resources []*unstructured.Unstructured) error {
for _, resource := range resources {
resource.SetLabels(collections.MergeMaps(resource.GetLabels(), map[string]string{
shared.WatchedByLabel: shared.WatchedByLabelValue,
shared.ManagedBy: shared.ManagedByLabelValue,
shared.ManagedBy: shared.ManagedByLabelValue,
}))

resource.SetAnnotations(collections.MergeMaps(resource.GetAnnotations(), map[string]string{
Expand Down
7 changes: 2 additions & 5 deletions internal/declarative/v2/default_transforms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func Test_defaultTransforms(t *testing.T) {
},
{
"empty WatchedByManagedByOwnedBy",
declarativev2.WatchedByManagedByOwnedBy,
declarativev2.ManagedByOwnedBy,
[]*unstructured.Unstructured{},
func(testingT assert.TestingT, err error, i ...interface{}) bool {
require.NoError(t, err)
Expand Down Expand Up @@ -88,7 +88,7 @@ func Test_defaultTransforms(t *testing.T) {
},
{
"simple WatchedByManagedByOwnedBy",
declarativev2.WatchedByManagedByOwnedBy,
declarativev2.ManagedByOwnedBy,
[]*unstructured.Unstructured{{Object: map[string]any{}}},
func(testingT assert.TestingT, err error, i ...interface{}) bool {
require.NoError(t, err)
Expand All @@ -99,12 +99,9 @@ func Test_defaultTransforms(t *testing.T) {
assert.NotNil(testingT, unstruct.GetLabels())
assert.NotNil(testingT, unstruct.GetAnnotations())
assert.Contains(testingT, unstruct.GetLabels(), shared.ManagedBy)
assert.Contains(testingT, unstruct.GetLabels(), shared.WatchedByLabel)
assert.Contains(testingT, unstruct.GetAnnotations(), shared.OwnedByAnnotation)
assert.Equal(testingT, shared.ManagedByLabelValue,
unstruct.GetLabels()[shared.ManagedBy])
assert.Equal(testingT, shared.WatchedByLabelValue,
unstruct.GetLabels()[shared.WatchedByLabel])
return true
},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/declarative/v2/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
func DefaultOptions() *Options {
return (&Options{}).Apply(
WithPostRenderTransform(
WatchedByManagedByOwnedBy,
ManagedByOwnedBy,
KymaComponentTransform,
DisclaimerTransform,
),
Expand Down

0 comments on commit e508ff7

Please sign in to comment.