Open tcdowney opened 3 years ago
After discussion, @tcdowney and I have decided not to consider resource matching or making this component independently scalable for this work.
CF Package response is missing Package.State
info that needs to be derived based on the status conditions
From @Birdrock : Should state be a separate status? Or do we derive state from the other statuses directly? Output:
States
are derived from Conditions
Helper functions that take the Conditions
and return a State
string
A dedicated Condition
should be avoided since it is a calculated value from other Conditions
State
is not a useful construct to a kubectl power user.
Miro link for Package Conditions to State mapping table : https://miro.com/app/board/o9J_lFiI8CU=/?moveToWidget=3074457361338757508&cot=14
We were able to verify that the acceptance criteria were met.
During implementation of this Spike, few open questions popped up about image registries and how access information for these registries would stored and shared. We are capturing those questions here.
blobstore
. In Kubernetes world there is no such restriction when it comes to image registries
. This opens a question whether we confine to a single registry with our implementation or do we support multiple registries? (Note - current spike implementation has 2 image registries - a package registry
and kpack registry
)secret
object. How to make this secret available on arbitrary namespaces?
secrets
- read issue/59 for more info.
Background
CF for VMs context
During
cf push
the CLI will package up the local app source code into a zip file (referred to as appbits
) and send it to the Cloud Controller API. The Cloud Controller API will do some additional processing (a big portion of this is a feature called resource matching which we can ignore for now) and send the app bits to the packages bucket in the blobstore. The associated CF Package for these bits will be updated to have the stateREADY
to indicate that the source code has been fully uploaded.CF for K8s context
In CF for K8s we use
kpack
for application staging and provide the app source code as an OCI image. In this flow the CLI will still package the local app source code as a zip file and sent it to the Cloud Controller API. Instead of sending it to a blobstore, though, Cloud Controller will pass the zip off to another component calledregistry-buddy
which converts the zip file into a single-layer OCI image that contains the app source. It then pushes that image to an image registry. Once this is done the associated CF Package is updated to have the stateREADY
and Cloud Controller implicitly knows where the image was pushed to based on the configured image registry / package guid.What to do
The CF API shim will be performing the roles of Cloud Controller and
registry-buddy
in this case. Implement thePOST /v3/packages/:guid/upload
endpoint (see docs) on the shim and have it convert the zip file into an OCI Image thatkpack
can use as a source. Then update the associated Package to refer to it (see https://github.com/cloudfoundry/cf-crd-explorations/issues/6 for how this looks and is used).Acceptance Criteria
GIVEN I have the shim deployed to a cluster WHEN I run the following curl
AND It finished uploading / conversion THEN I can
kubectl get packages [guid] -o yaml
to see where the app source image was pushed to AND I candocker pull
the image to verify that it contains the app source code**Alternatively based on #6 you may be able to use the CF Package with CF Build to get kpack to stage it.
Dev Notes
registry-buddy
code copy pasted some code from the https://github.com/buildpacks/pack (see https://github.com/buildpacks/pack/issues/814). They've updated that code to be public so we may be able to just consume it directly.