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

Add a DomainValidations field in Certificate status #29

Merged
merged 1 commit into from
Feb 9, 2024
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
8 changes: 4 additions & 4 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ack_generate_info:
build_date: "2024-01-29T07:08:03Z"
build_date: "2024-02-09T14:53:45Z"
build_hash: 92f531cde5631865cfc3dfa778cbc9611f3a64c3
go_version: go1.21.5
go_version: go1.21.6
version: v0.29.2
api_directory_checksum: 202e02932e71256f27a9cd0f6454e508c5b7e9b6
api_directory_checksum: eabe0fe64d57edf571ba0eb0217fc376f1185cc0
api_version: v1alpha1
aws_sdk_go_version: v1.49.0
generator_config_info:
file_checksum: 5394dff577561d72517cec97192a6d2ea88f4244
file_checksum: 229489e50bc34730f31e2e0578bec6f9ea7d7215
original_file_name: generator.yaml
last_modification:
reason: API generation
5 changes: 5 additions & 0 deletions apis/v1alpha1/certificate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ resources:
# now deleted from the aws-sdk-go private/model/api.Shape object,
# setting `override_values` above does not work :(
code: input.SetValidationMethod("DNS")
sdk_read_one_pre_set_output:
template_path: hooks/certificate/sdk_read_one_pre_set_output.go.tpl
exceptions:
terminal_codes:
- InvalidParameter
Expand Down Expand Up @@ -59,6 +61,11 @@ resources:
from:
operation: DescribeCertificate
path: Certificate.CreatedAt
DomainValidations:
is_read_only: true
from:
operation: DescribeCertificate
path: Certificate.DomainValidationOptions
ExtendedKeyUsages:
is_read_only: true
from:
Expand Down
11 changes: 11 additions & 0 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions config/crd/bases/acm.services.k8s.aws_certificates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,41 @@ spec:
description: The time at which the certificate was requested.
format: date-time
type: string
domainValidations:
description: |-
Contains information about the initial validation of each domain name that
occurs as a result of the RequestCertificate request. This field exists only
when the certificate type is AMAZON_ISSUED.
items:
description: Contains information about the validation of each domain
name in the certificate.
properties:
domainName:
type: string
resourceRecord:
description: |-
Contains a DNS record value that you can use to validate ownership or control
of a domain. This is used by the DescribeCertificate action.
properties:
name:
type: string
type_:
type: string
value:
type: string
type: object
validationDomain:
type: string
validationEmails:
items:
type: string
type: array
validationMethod:
type: string
validationStatus:
type: string
type: object
type: array
extendedKeyUsages:
description: Contains a list of Extended Key Usage X.509 v3 extension
objects. Each object specifies a purpose for which the certificate
Expand Down
7 changes: 7 additions & 0 deletions generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ resources:
# now deleted from the aws-sdk-go private/model/api.Shape object,
# setting `override_values` above does not work :(
code: input.SetValidationMethod("DNS")
sdk_read_one_pre_set_output:
template_path: hooks/certificate/sdk_read_one_pre_set_output.go.tpl
exceptions:
terminal_codes:
- InvalidParameter
Expand Down Expand Up @@ -59,6 +61,11 @@ resources:
from:
operation: DescribeCertificate
path: Certificate.CreatedAt
DomainValidations:
is_read_only: true
from:
operation: DescribeCertificate
path: Certificate.DomainValidationOptions
Comment on lines +64 to +68
Copy link
Member

Choose a reason for hiding this comment

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

Note: we need to extend the code generator to automatically set this fields on Create/ReadOne using something like:

        set:
        - from: Certificate.DomainValidationOptions
          method: ReadOne

Copy link
Member

Choose a reason for hiding this comment

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

ExtendedKeyUsages:
is_read_only: true
from:
Expand Down
35 changes: 35 additions & 0 deletions helm/crds/acm.services.k8s.aws_certificates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,41 @@ spec:
description: The time at which the certificate was requested.
format: date-time
type: string
domainValidations:
description: |-
Contains information about the initial validation of each domain name that
occurs as a result of the RequestCertificate request. This field exists only
when the certificate type is AMAZON_ISSUED.
items:
description: Contains information about the validation of each domain
name in the certificate.
properties:
domainName:
type: string
resourceRecord:
description: |-
Contains a DNS record value that you can use to validate ownership or control
of a domain. This is used by the DescribeCertificate action.
properties:
name:
type: string
type_:
type: string
value:
type: string
type: object
validationDomain:
type: string
validationEmails:
items:
type: string
type: array
validationMethod:
type: string
validationStatus:
type: string
type: object
type: array
extendedKeyUsages:
description: Contains a list of Extended Key Usage X.509 v3 extension
objects. Each object specifies a purpose for which the certificate
Expand Down
37 changes: 37 additions & 0 deletions pkg/resource/certificate/sdk.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions templates/hooks/certificate/sdk_read_one_pre_set_output.go.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
if resp.Certificate.DomainValidationOptions != nil {
dvs := []*svcapitypes.DomainValidation{}
for _, dvsiter := range resp.Certificate.DomainValidationOptions {
dvselem := &svcapitypes.DomainValidation{}
if dvsiter.DomainName != nil {
dvselem.DomainName = dvsiter.DomainName
}
if dvsiter.ResourceRecord != nil {
dvselem.ResourceRecord = &svcapitypes.ResourceRecord{}
if dvsiter.ResourceRecord.Name != nil {
dvselem.ResourceRecord.Name = dvsiter.ResourceRecord.Name
}
if dvsiter.ResourceRecord.Type != nil {
dvselem.ResourceRecord.Type = dvsiter.ResourceRecord.Type
}
if dvsiter.ResourceRecord.Value != nil {
dvselem.ResourceRecord.Value = dvsiter.ResourceRecord.Value
}
}
if dvsiter.ValidationDomain != nil {
dvselem.ValidationDomain = dvsiter.ValidationDomain
}
if dvsiter.ValidationEmails != nil {
dvselem.ValidationEmails = dvsiter.ValidationEmails
}
if dvsiter.ValidationMethod != nil {
dvselem.ValidationMethod = dvsiter.ValidationMethod
}
if dvsiter.ValidationStatus != nil {
dvselem.ValidationStatus = dvsiter.ValidationStatus
}
dvs = append(dvs, dvselem)
}
ko.Status.DomainValidations = dvs
} else {
ko.Status.DomainValidations = nil
}