Skip to content

Access secondary resources by ResourceID #1410

Closed
@grawinkel

Description

@grawinkel

Feature Idea

During a reconcile, I try to access a specific secondary resource. For example, I manage multiple config maps that are all owned by the same primary resource. In the reconcile I would like to access a specific resource that I can name by "namespace" + "name". In v2, there was a ResourceID, which was useable to access the event source cache.
The current possible solution would be:

<Optional>ConfigMap getConfigMap(Context<X> context, String name, String namespace) {
        return context.getSecondaryResources(ConfigMap.class).stream().filter(
        c -> namespace.equals(c.getMetadata().getNamespace()) &&
            namespace.equals(c.getMetadata().getName())).findFirst();
    }

But I'd rather have a more specific access method

<Optional>ConfigMap getConfigMap(Context<X> context, String name, String namespace) {
        return context.getSecondaryResource(ConfigMap.class).get(new ResourceID(namespace, name);
    }

Metadata

Metadata

Assignees

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