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

Honour the WEBHOOK_TLS_CERT_DIR env. variable for finding the Webhook TLS certificate #1157

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

ulucinar
Copy link
Collaborator

@ulucinar ulucinar commented Feb 15, 2024

Description of your changes

Fixes #1147

Crosslane versions before v1.14 mount the Webhook TLS certificate and key at a path other than the current default /tls/certs and make that location available via the environment variable WEBHOOK_TLS_CERT_DIR. provider-aws currently relies on the default path and the CERTS_DIR environment variable, breaking installations prior to v1.14. This PR implements the following protocol for configuring the conversion Webhook TLS certificate & key configuration:

  1. If the --certs-dir command-line option is supplied, it's used.
  2. If the --certs-dir command-line option is not supplied, the following environment variables are used in the given order: CERTS_DIR (for backwards-compatibility reasons), TLS_SERVER_CERTS_DIR (the new environment variable, which has replaced the WEBHOOK_TLS_CERT_DIR env. variable in Crossplane), and WEBHOOK_TLS_CERT_DIR (for backwards-compatibility).

This PR also fixes the example manifest examples/ec2/v1beta2/route.yaml, where a non-existent version of RouteTable.ec2 is referenced.

I have:

  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Successfully provisioned a Route.ec2/v1beta2 resource using examples/ec2/v1beta2/route.yaml with the following setup:

  • UXP version: v1.13.2-up.3
  • Provider package: index.docker.io/ulucinar/provider-aws-ec2:v0.48.0-ecf7ae9ad372b96dad94e52f6e7aae9b6db44063 (built from this PR's feature branch)

Also validated using:

  • UXP version: v1.14.5-up.1
  • Provider package: index.docker.io/ulucinar/provider-aws-ec2:v0.48.0-ecf7ae9ad372b96dad94e52f6e7aae9b6db44063

Uptest run for the modified example manifest examples/ec2/v1beta2/route.yaml: https://github.com/upbound/provider-aws/actions/runs/7917023305/

…bhook TLS certificate

- Crosslane versions before v1.14 mount the Webhook TLS certificate and key at a path
  other than the current default /tls/certs and make the location available via the
  environment variable WEBHOOK_TLS_CERT_DIR.

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
@ulucinar
Copy link
Collaborator Author

/test-examples="examples/ec2/v1beta1/vpc.yaml"

Copy link
Collaborator

@sergenyalcin sergenyalcin left a comment

Choose a reason for hiding this comment

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

Thanks @ulucinar LGTM! Left a nit comment for documentation.

hack/main.go.tmpl Outdated Show resolved Hide resolved
@ulucinar ulucinar changed the title Also honour the WEBHOOK_TLS_CERT_DIR env. variable for finding the Webhook TLS certificate Honour the WEBHOOK_TLS_CERT_DIR env. variable for finding the Webhook TLS certificate Feb 15, 2024
@ulucinar
Copy link
Collaborator Author

/test-examples="examples/ec2/v1beta2/route.yaml"

…s/ec2/v1beta2/route.yaml

Add the uptest.upbound.io/disable-import annotation for Route.ec2 due to an uptest
limitation.

- Document the PreAction usage for the command-line flag "--certs-dir"

Signed-off-by: Alper Rifat Ulucinar <[email protected]>
@ulucinar
Copy link
Collaborator Author

/test-examples="examples/ec2/v1beta2/route.yaml"

@ulucinar ulucinar merged commit 6137bed into crossplane-contrib:main Feb 15, 2024
9 of 10 checks passed
@ulucinar ulucinar deleted the fix-1147 branch February 15, 2024 14:15
Copy link

Backport failed for release-0.47, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin release-0.47
git worktree add -d .worktree/backport-1157-to-release-0.47 origin/release-0.47
cd .worktree/backport-1157-to-release-0.47
git checkout -b backport-1157-to-release-0.47
ancref=$(git merge-base 81d43d08e42c7cdc8a3f73199c8707300f3480cb 6279a766d3dce638e5e2d52274f2629d34063843)
git cherry-pick -x $ancref..6279a766d3dce638e5e2d52274f2629d34063843

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Can't install provider-aws 1.0.0 on crossplane versions before 1.14
2 participants