Skip to content
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

Update CertificateAuthority customSetDefaults method #54

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ack_generate_info:
build_date: "2024-05-02T20:44:28Z"
build_date: "2024-06-26T15:57:25Z"
build_hash: 14cef51778d471698018b6c38b604181a6948248
go_version: go1.22.0
version: v0.34.0
Expand Down
11 changes: 2 additions & 9 deletions pkg/resource/certificate_authority/custom_delta.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,18 @@ package certificate_authority
import (
svcapitypes "github.com/aws-controllers-k8s/acmpca-controller/apis/v1alpha1"
ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
"github.com/aws/aws-sdk-go/aws"
)

func customSetDefaults(
a *resource,
b *resource,
Comment on lines 22 to 23
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you update these names to be more descriptive?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are just going to leave this the same as this is the standard naming scheme across all ACK controllers.

) {
// Default value of UsageMode is GENERAL_PURPOSE
defaultUsageMode := aws.String("GENERAL_PURPOSE")

if ackcompare.IsNil(a.ko.Spec.UsageMode) && ackcompare.IsNotNil(b.ko.Spec.UsageMode) {
a.ko.Spec.UsageMode = defaultUsageMode
a.ko.Spec.UsageMode = b.ko.Spec.UsageMode
}

// Default value of KeyStorageSecurityStandard is FIPS_140_2_LEVEL_3_OR_HIGHER
defaultKeyStorageSecurityStandard := aws.String("FIPS_140_2_LEVEL_3_OR_HIGHER")

if ackcompare.IsNil(a.ko.Spec.KeyStorageSecurityStandard) && ackcompare.IsNotNil(b.ko.Spec.KeyStorageSecurityStandard) {
a.ko.Spec.KeyStorageSecurityStandard = defaultKeyStorageSecurityStandard
a.ko.Spec.KeyStorageSecurityStandard = b.ko.Spec.KeyStorageSecurityStandard
}

if ackcompare.IsNil(a.ko.Spec.RevocationConfiguration) && ackcompare.IsNotNil(b.ko.Spec.RevocationConfiguration) {
Expand Down