Skip to content

remove getImmutableFieldChanges references from hooks #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions pkg/resource/instance_profile/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ package instance_profile

import (
"context"
"fmt"
"strings"

svcapitypes "github.com/aws-controllers-k8s/iam-controller/apis/v1alpha1"
commonutil "github.com/aws-controllers-k8s/iam-controller/pkg/util"
ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors"
ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log"
svcsdk "github.com/aws/aws-sdk-go-v2/service/iam"
svcsdktypes "github.com/aws/aws-sdk-go-v2/service/iam/types"
Expand All @@ -26,12 +23,6 @@ func (rm *resourceManager) customUpdateInstanceProfile(
exit := rlog.Trace("rm.customUpdateInstanceProfile")
defer func() { exit(err) }()

// Do not proceed with update if an immutable field was updated
if immutableFieldChanges := rm.getImmutableFieldChanges(delta); len(immutableFieldChanges) > 0 {
msg := fmt.Sprintf("Immutable Spec fields have been modified: %s", strings.Join(immutableFieldChanges, ","))
return nil, ackerr.NewTerminalError(fmt.Errorf(msg))
}

ko := desired.ko.DeepCopy()

if delta.DifferentAt("Spec.Tags") {
Expand Down
7 changes: 0 additions & 7 deletions pkg/resource/open_id_connect_provider/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ package open_id_connect_provider

import (
"context"
"fmt"
"strings"

ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
ackcondition "github.com/aws-controllers-k8s/runtime/pkg/condition"
ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors"
ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log"
svcsdk "github.com/aws/aws-sdk-go-v2/service/iam"
svcsdktypes "github.com/aws/aws-sdk-go-v2/service/iam/types"
Expand All @@ -40,11 +38,6 @@ func (rm *resourceManager) customUpdateOpenIDConnectProvider(
exit := rlog.Trace("rm.customUpdateOpenIDConnectProvider")
defer func() { exit(err) }()

if immutableFieldChanges := rm.getImmutableFieldChanges(delta); len(immutableFieldChanges) > 0 {
msg := fmt.Sprintf("Immutable Spec fields have been modified: %s", strings.Join(immutableFieldChanges, ","))
return nil, ackerr.NewTerminalError(fmt.Errorf(msg))
}

if delta.DifferentAt("Spec.Thumbprints") {
// Update the thumbprint list
thumbprintInput, err := rm.newUpdateThumbprintRequestPayload(ctx, desired)
Expand Down
13 changes: 0 additions & 13 deletions test/e2e/tests/test_open_id_connect_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,3 @@ def test_crud(self, oidc_provider):
after_update_expected_tags = [{"Key": "key2", "Value": "val2"}]
latest_tags = open_id_connect_provider.get_tags(oidc_provider_arn)
assert tag.cleaned(latest_tags) == after_update_expected_tags

# validate that changing the URL results in an advisory condition
update_url = {"spec": {"url": "https://other.example.com"}}
logging.debug(f"\n\n**** OIDCProvider update of URL intended to fail")
k8s.patch_custom_resource(ref, update_url)
time.sleep(MODIFY_WAIT_AFTER_SECONDS)

condition.assert_not_synced(ref)
condition.assert_type_status(
ref,
cond_type_match=condition.CONDITION_TYPE_TERMINAL,
cond_status_match=True,
)