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

feat(model): support labels in manifest #254

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

brooksmtownsend
Copy link
Member

@brooksmtownsend brooksmtownsend commented Apr 4, 2024

Feature or Problem

This PR adds supports for serializing the labels in a manifest and validating that they are correct according to the kubernetes label specification, which also matches the OAM specification.

Related Issues

Fixes #249

Release Information

Next wadm

Consumer Impact

Testing

Unit Test(s)

Added unit test to sanity check validation rules.

Acceptance or Integration

Manual Verification

With a manifest:

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: kvcounter-rust
  annotations:
    version: v0.0.1
    description: "Kvcounter demo in Rust, using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)"
  labels:
    app.kubernetes.io/name: kvcounter-rust
spec:

The requested spec comes back as (including the label):

➜ nats req "wadm.api.default.model.get.kvcounter-rust" '{}'
17:15:21 Sending request on "wadm.api.default.model.get.kvcounter-rust"
17:15:21 Received with rtt 2.827708ms
{"result":"success","message":"Successfully fetched model kvcounter-rust","manifest":{"apiVersion":"core.oam.dev/v1beta1","kind":"Application","metadata":{"name":"kvcounter-rust","annotations":{"description":"Kvcounter demo in Rust, using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)","version":"v0.0.1"},"labels":{"app.kubernetes.io/name":"kvcounter-rust"}}

src/server/handlers.rs Outdated Show resolved Hide resolved
Copy link
Member

@joonas joonas left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Contributor

@thomastaylor312 thomastaylor312 left a comment

Choose a reason for hiding this comment

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

One blocking comment around things to test for. Others are optional

src/server/handlers.rs Outdated Show resolved Hide resolved
src/server/handlers.rs Show resolved Hide resolved
src/server/handlers.rs Show resolved Hide resolved
@brooksmtownsend brooksmtownsend force-pushed the feat/1.0-updates branch 2 times, most recently from 335f020 to 274aa4b Compare April 8, 2024 19:53
Base automatically changed from feat/1.0-updates to main April 8, 2024 20:12
// ends with an alphanumeric character, and contains only alphanumeric characters or hyphens
!part.is_empty()
&& part.len() <= 63
&& part.starts_with(|c: char| c.is_ascii_alphabetic())
Copy link
Contributor

Choose a reason for hiding this comment

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

Super nit: you could just do part.starts_with(char::is_ascii_alphabetic)

@brooksmtownsend brooksmtownsend merged commit 404523f into main Apr 8, 2024
3 checks passed
@brooksmtownsend brooksmtownsend deleted the feat/enable-manifest-labels branch April 8, 2024 23:11
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] Manifests do not support labels
3 participants