Skip to content

Commit cee1aad

Browse files
authored
remove getImmutableFieldChanges references from hooks (#129)
fix aws-controllers-k8s/code-generator#565 Description of changes: Remove `getImmutableFieldChanges` from hooks to support cel immutability By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 90f0558 commit cee1aad

File tree

3 files changed

+0
-29
lines changed

3 files changed

+0
-29
lines changed

pkg/resource/instance_profile/hooks.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ package instance_profile
22

33
import (
44
"context"
5-
"fmt"
6-
"strings"
75

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

29-
// Do not proceed with update if an immutable field was updated
30-
if immutableFieldChanges := rm.getImmutableFieldChanges(delta); len(immutableFieldChanges) > 0 {
31-
msg := fmt.Sprintf("Immutable Spec fields have been modified: %s", strings.Join(immutableFieldChanges, ","))
32-
return nil, ackerr.NewTerminalError(fmt.Errorf(msg))
33-
}
34-
3526
ko := desired.ko.DeepCopy()
3627

3728
if delta.DifferentAt("Spec.Tags") {

pkg/resource/open_id_connect_provider/hooks.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ package open_id_connect_provider
1515

1616
import (
1717
"context"
18-
"fmt"
1918
"strings"
2019

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

43-
if immutableFieldChanges := rm.getImmutableFieldChanges(delta); len(immutableFieldChanges) > 0 {
44-
msg := fmt.Sprintf("Immutable Spec fields have been modified: %s", strings.Join(immutableFieldChanges, ","))
45-
return nil, ackerr.NewTerminalError(fmt.Errorf(msg))
46-
}
47-
4841
if delta.DifferentAt("Spec.Thumbprints") {
4942
// Update the thumbprint list
5043
thumbprintInput, err := rm.newUpdateThumbprintRequestPayload(ctx, desired)

test/e2e/tests/test_open_id_connect_provider.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,3 @@ def test_crud(self, oidc_provider):
138138
after_update_expected_tags = [{"Key": "key2", "Value": "val2"}]
139139
latest_tags = open_id_connect_provider.get_tags(oidc_provider_arn)
140140
assert tag.cleaned(latest_tags) == after_update_expected_tags
141-
142-
# validate that changing the URL results in an advisory condition
143-
update_url = {"spec": {"url": "https://other.example.com"}}
144-
logging.debug(f"\n\n**** OIDCProvider update of URL intended to fail")
145-
k8s.patch_custom_resource(ref, update_url)
146-
time.sleep(MODIFY_WAIT_AFTER_SECONDS)
147-
148-
condition.assert_not_synced(ref)
149-
condition.assert_type_status(
150-
ref,
151-
cond_type_match=condition.CONDITION_TYPE_TERMINAL,
152-
cond_status_match=True,
153-
)

0 commit comments

Comments
 (0)