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 RFC for Stack metadata #78

Merged
merged 4 commits into from
Jul 29, 2020
Merged
Changes from 2 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
95 changes: 95 additions & 0 deletions text/0000-stack-metadata.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Meta
[meta]: #meta
- Name: Additional Stack Metadata
- Start Date: 2020-05-12
- Author(s): kvedurmu
- RFC Pull Request: (leave blank)
- CNB Pull Request: (leave blank)
- CNB Issue: (leave blank)
- Supersedes: N/A

# Summary
[summary]: #summary

We currently expose the Stack ID and Mixins via Labels on the build/run images. It would be great if we could leverage Labels to allow stack authors to specify additional image metadata (e.g OS Distro, Maintainer, Stack Version, etc.). The purpose of this RFC is to enumerate on additional metadata we want to expose in our stack images and standardize on these labels.

# Motivation
[motivation]: #motivation

- Why should we do this?
Exposing additional metadata in stack images will make it easier for end users to debug stack related issues. Also, by exposing this metadata, CNB platforms such as kpack can leverage this information to improve their UX.
hone marked this conversation as resolved.
Show resolved Hide resolved
- What is the expected outcome?
We converge on metadata we want to expose in stack images via labels, and all stack authors eventually support these.

# What it is
[what-it-is]: #what-it-is

This provides a high level overview of the feature.

- Define the target persona: stack author
- Explaining the feature largely in terms of examples.
The following labels will be added to stack images:
nebhale marked this conversation as resolved.
Show resolved Hide resolved
`io.buildpacks.stack.maintainer`: Name of Stack Maintainer
`io.buildpacks.stack.homepage`: URL for the stack (i.e repo link)
`io.buildpacks.stack.distro.name`: Name of OS Distribution
`io.buildpacks.stack.distro.version`: Version of OS Distribution
`io.buildpacks.stack.version`: Release Number
`io.buildpacks.stack.release_date`: Release date of image
`io.buildpacks.stack.description`: Description

Copy link
Member

Choose a reason for hiding this comment

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

Could we add a generic metadata field that is defined by the stack author?

E.g., io.buildpacks.stack.metadata could be defined by another out-of-spec RFC when the stack ID is io.buildpacks.stacks.bionic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that makes sense. I think that we should keep the other labels I proposed since we already use this pattern for the stack.id and stack.mixins and add this generic metadata label. How does that sound?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed on this. I quite like the pattern of top-level keys being wholly reserved for the spec (i.e. io.buildpacks.stack.*) and having a key that is wholly reserved for users that the spec will never use (io.buildpacks.stack.metadata). Top-level keys as they are described here look good.

Copy link
Member

Choose a reason for hiding this comment

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

E.g., io.buildpacks.stack.metadata could be defined by another out-of-spec RFC when the stack ID is io.buildpacks.stacks.bionic.

@sclevine can you elaborate on what you hope to have in there?

Copy link
Member

@ekcasey ekcasey May 20, 2020

Choose a reason for hiding this comment

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

I quite like the pattern of top-level keys being wholly reserved for the spec (i.e. io.buildpacks.stack.*) and having a key that is wholly reserved for users that the spec will never use (io.buildpacks.stack.metadata).

While I agree in theory, we currently use a lot of io.buildpacks.*.metadata for our own purposes, rather than reserving them for users. (e.g io.buildpacks.{lifecycle,build,builder}.metadata)

Copy link
Contributor

Choose a reason for hiding this comment

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

@ekcasey Well that's a kick in the shorts. We can pick another key (.user) that represents the same thing, but alas is a naming inconsistency. My priority stack is as follows:

  1. Designated area for all users data that we both agree to never spec inside of and that a user will never create outside of
  2. Naming consistency

Even if that means we have some exceptions (e.g. io.buildpacks{lifecycle,build,builder}.metadata), I don't think we should introduce new inconsistencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

@kvedurmu I don't think this one has been addressed yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nebhale oops just updated it.


# How it Works
[how-it-works]: #how-it-works

This is the technical portion of the RFC, where you explain the design in sufficient detail.
All labels listed above will be added as `Labels` in the stack's Dockerfile.

Example Dockerfile:
```
ARG cnb_uid=1000
ARG cnb_gid=1000
ARG stack_id="io.buildpacks.stacks.bionic"
ENV CNB_USER_ID=${cnb_uid}
ENV CNB_GROUP_ID=${cnb_gid}
ENV CNB_STACK_ID=${stack_id}
USER ${cnb_uid}:${cnb_gid}
LABEL io.buildpacks.stack.id=${stack_id}
LABEL io.buildpacks.stack.mixins="[\"ca-certificates\"............]"
LABEL io.buildpacks.stack.maintainer="Paketo Buildpacks"
nebhale marked this conversation as resolved.
Show resolved Hide resolved
LABEL io.buildpacks.stack.homepage="https://github.com/paketo-buildpacks/stacks/"
LABEL io.buildpacks.stack.distro.name="ubuntu"
LABEL io.buildpacks.stack.distro.version="18.04"
LABEL io.buildpacks.stack.version="25"
LABEL io.buildpacks.stack.release_date="2020-05-12T05:17:02.390472"
LABEL io.buildpacks.stack.description="Paketo Buildpacks base stack build image"
```

kvedurmu marked this conversation as resolved.
Show resolved Hide resolved
# Drawbacks
[drawbacks]: #drawbacks

This could make image rebasing slightly more complicated as labels like stack version will need to be updated.
Copy link
Member

Choose a reason for hiding this comment

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

How would rebase work with this RFC?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the io.buildpacks.stack.* labels would need to be updated on the app image.

Copy link
Member

Choose a reason for hiding this comment

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

That sounds good to me. Can get how this works into the RFC itself?


# Alternatives
[alternatives]: #alternatives

- What other designs have been considered?
It could be more consistent to have a single metadata label (io.buildpacks.stack.metadata) that is structured JSON, but a JSON object would be hard to create in a Dockerfile.
- Why is this proposal the best?
It is the simplest way to expose image metadata to users and follows existing conventions with label naming.
- What is the impact of not doing this?
Stack authors will define their own custom labels to surface the metadata above. By standardizing on the names and purpose of each of these labels, we make it easier for CNB platforms to consume this metadata.

# Prior Art
[prior-art]: #prior-art

- Upstream OS distros have an existing pattern of doing this. (e.g `registry.access.redhat.com/ubi8/ubi`)
- Buildpack Homepage field - https://github.com/buildpacks/rfcs/blob/master/text/0030-links-for-buildpacks.md

# Unresolved Questions
[unresolved-questions]: #unresolved-questions

- Any additional labels that we'd want to expose?

# Spec. Changes (OPTIONAL)
nebhale marked this conversation as resolved.
Show resolved Hide resolved
[spec-changes]: #spec-changes
None.
nebhale marked this conversation as resolved.
Show resolved Hide resolved