awslabs / crossplane-on-eks

Crossplane bespoke composition blueprints for AWS resources
Apache License 2.0
322 stars 111 forks source link

split composite example into db and app #72

Closed csantanapr closed 1 year ago

csantanapr commented 1 year ago

What does this PR do?

Split the composite example application into AWS resources and APP

Motivation

I was trying out the current example and was not working, app would come up and secret was not populated with values.

More

Note:

For Moderators

Additional Notes

The app is hidden inside the composition with what the app was suppose to do

This PR makes the app logic visible, also the deployment is a two stage deploy the AWS resources, wait for it do be ready then deploy the app.

I could add a init container to the app, or modify the composition to add a secret observe policy to fix the race condition, but still the problem of what is the app suppose to do is hidden.

csantanapr commented 1 year ago

@nabuskey

The point of this composition was to show how you can define your application (App and dependencies) as a composition in a single step. I am ok with making the documentation better but I don't think I want to separate the two.

The current example doesn't work, the Pod gets created before the secret example-application-secrets values are populated. The working example is not working.

Couple of options if keeping the app and db together in a single composition:

  1. Look into how to make the composition wait for the secrets to be populated before creating the Deployment object. I have not found a way to do this in crossplane docs.
  2. Add an init container that loops/waits for the secret values to be present, then exit and let the main container run

How do you propose we move forward?

nabuskey commented 1 year ago

If it is a timing issue then you can do soft dependencies with patches and policies. I still think there is a value in having example applications created by compositions. I also think a separate guide and example for deploying DB and app separately is a good idea. If you want to turn this into that, I am all for it :)

nabuskey commented 1 year ago

@csantanapr I am making a PR to address the issue you ran into. You should be able to see what I am doing to handle this kind of dependencies / timing issues.

csantanapr commented 1 year ago

I also think a separate guide and example for deploying DB and app separately is a good idea. If you want to turn this into that, I am all for it :)

That's a good idea. I can make this an example of deploying the app and the db claim, and then point as next step that they can use the kubernetes provider and have a claim that encapsulate both the app and the db with a single claim.

nabuskey commented 1 year ago

Closing this for now. Feel free to reopen.