Skip to content

Document that providers MUST validate references are in the same namespace #2318

@detiber

Description

@detiber

Goals

  1. Replace current uses of corev1.ObjectReference with more appropriate types

Non-Goals/Future Work

  1. Modify other types used

User Story

As a consumer of Cluster API I would like to have fields that are currently using corev1.ObjectReference to use more appropriate data types so that it is clear which fields are used (all of them) vs having to guess which fields are in use.

Detailed Description

Upstream documentation discourages the use of corev1.ObjectReference: https://godoc.org/k8s.io/api/core/v1#ObjectReference. In order to align better with upstream convention we should adopt types that are more fitting for their purpose.

When the referenced type is constant and in the same namespace, we should likely use corev1.LocalObjectReference instead.

When we also need type information for the referenced resource and that resource is in the same namespace, we should likely use corev1.TypedLocalReference

If for some reason we need to cross namespaces with a reference, we should likely create our own type that is a subset of corev1.ObjectReference

To ease this transition, we should gracefully handle the conversions within the conversion webhooks.

Contract changes [optional]

Any type that is currently using corev1.ObjectReference would be updated to a more appropriate type.

Data model changes [optional]

Any type that is currently using corev1.ObjectReference would be updated to a more appropriate type.

/kind proposal

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/apiIssues or PRs related to the APIshelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/api-changeCategorizes issue or PR as related to adding, removing, or otherwise changing an APIkind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.priority/backlogHigher priority than priority/awaiting-more-evidence.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions