Skip to content

Commit 85fc5f0

Browse files
authored
Fix export if Options is not set and update README (#83)
Fix export if `Options` is `nil` (`options` field not set on the `certificate` resource) and update `README`
1 parent 22a7f2b commit 85fc5f0

File tree

4 files changed

+41
-14
lines changed

4 files changed

+41
-14
lines changed

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@ Kubernetes Github project.
1111
## Getting Started
1212

1313
### Pricing
14-
The ACK service controller for AWS Certificate Manager is free of charge. If you issue an exportable public certificate with AWS Certificate Manager, there is a charge at certificate issuance and again when the certificate renews. Learn more about [AWS Certificate Manager Pricing](https://aws.amazon.com/certificate-manager/pricing/).
14+
The ACK service controller for AWS Certificate Manager is free of charge. If you issue an [exportable public certificate](https://docs.aws.amazon.com/acm/latest/userguide/acm-exportable-certificates.html) with AWS Certificate Manager, there is a charge at certificate issuance and again when the certificate renews. Learn more about [AWS Certificate Manager Pricing](https://aws.amazon.com/certificate-manager/pricing/).
1515

1616
[samples]: https://github.com/aws-controllers-k8s/acmpca-controller/tree/main/samples
1717

1818
### Kubernetes Secrets
19-
The ACK service controller for AWS Certificate Manager uses Kubernetes TLS Secrets to store the certificate chain and decrypted private key of [exportable public certificates](https://docs.aws.amazon.com/acm/latest/userguide/acm-exportable-certificates.html). Users are expected to create Secrets before creating Certificate resources. As these resources are created, the Secrets' `tls.crt` will be injected with the base64-encoded certificate and `tls.key` will be injected with the base64-encoded private key associated with the certificate. Users are responsible for deleting Secrets.
19+
The ACK service controller for AWS Certificate Manager uses Kubernetes TLS Secrets to store the certificate chain and decrypted private key of the exported ACM certificate. Users are expected to create Secrets before creating Certificate resources. As these resources are created, the Secrets' `tls.crt` will be injected with the base64-encoded certificate and `tls.key` will be injected with the base64-encoded private key associated with the certificate. Users are responsible for deleting Secrets.
2020

2121
In addition, after a certificate is successfully renewed by ACM, the ACK service controller for AWS Certificate Manager will automatically export the renewed certificate again so that the Kubernetes TLS Secret `exportTo` contains the certificate data and private key data of the renewed certificate.
2222

2323
#### Export Certificate
24-
To export an ACM exportable public certificate to a Kubernetes TLS Secret, users must specify the namespace and the name of the Secret using the `exportTo` field of the Certificate resource, as shown below.
24+
To export an ACM certificate to a Kubernetes TLS Secret, users must specify the namespace and the name of the Secret using the `exportTo` field of the Certificate resource, as shown below.
2525

26+
##### Exporting an exportable ACM public certificate
2627
```
2728
apiVersion: v1
2829
kind: Secret
@@ -50,6 +51,34 @@ spec:
5051
...
5152
```
5253

54+
##### Exporting an ACM private certificate
55+
```
56+
apiVersion: v1
57+
kind: Secret
58+
type: kubernetes.io/tls
59+
metadata:
60+
name: exported-cert-secret
61+
namespace: demo-app-2
62+
data:
63+
tls.crt: ""
64+
tls.key: ""
65+
---
66+
apiVersion: acm.services.k8s.aws/v1alpha1
67+
kind: Certificate
68+
metadata:
69+
name: exportable-private-cert
70+
namespace: demo-app-2
71+
spec:
72+
domainName: my.domain.com
73+
certificateAuthorityARN: arn:aws:acm-pca:{$REGION}:{$AWS_ACCOUNT}:certificate-authority/12345678-1234-1234-1234-123456789012
74+
keyAlgorithm: EC_secp384r1
75+
exportTo:
76+
namespace: demo-app-2
77+
name: exported-cert-secret
78+
key: tls.crt
79+
```
80+
If you are issuing a privately trusted certificate, please also consider using this cert-manager plugin: https://github.com/cert-manager/aws-privateca-issuer/.
81+
5382
## Contributing
5483

5584
We welcome community contributions and pull requests.

apis/v1alpha1/ack-generate-metadata.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ack_generate_info:
2-
build_date: "2025-12-01T23:41:16Z"
3-
build_hash: a3d580fb0f446539bbd1f4efa5a759e59c53cbfa
2+
build_date: "2025-12-02T17:33:45Z"
3+
build_hash: 06bffb95177cf873ee1b1a1c6f93cb30380c1e36
44
go_version: go1.25.1
5-
version: v0.56.0-1-ga3d580f
5+
version: v0.56.0-2-g06bffb9
66
api_directory_checksum: 5dc0b682f154f3479809e330d2760ff9575e9bea
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6

pkg/resource/certificate/sdk.go

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/hooks/certificate/sdk_create_post_build_request.go.tpl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ input.ValidationMethod = "DNS"
1313

1414
// NOTE: exportPreference can ONLY be set for public certificates
1515
if desired.ko.Spec.ExportTo != nil && desired.ko.Spec.CertificateAuthorityARN == nil && desired.ko.Spec.CertificateAuthorityRef == nil {
16-
options := input.Options
17-
if options == nil {
18-
options = &svcsdktypes.CertificateOptions{}
16+
if input.Options == nil {
17+
input.Options = &svcsdktypes.CertificateOptions{}
1918
}
20-
options.Export = "ENABLED"
19+
input.Options.Export = "ENABLED"
2120
}

0 commit comments

Comments
 (0)