Skip to content

procedure or derive macro to define Kubernetes API #5

@sehz

Description

@sehz

Instead of manual trait implementation like below:

// Secret Object
const SECRET_API: Crd = Crd {
    group: "core",
    version: "v1",
    names: CrdNames {
        kind: "Secret",
        plural: "secrets",
        singular: "secret",
    },
};

impl Spec for SecretSpec {

    type Status = SecretStatus;
    type Header = SecretHeader;

    fn metadata() -> &'static Crd {
        &SECRET_API
    }
}

We can write procedure macro:

#[k8spec(group=core,status=SecretStatus)]
struct SecretSpec {
}

struct SecretStatus{}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions