Skip to content

Fix InstanceSpec/CommonSpec json fields shadowing in remote components #582

@l0kix2

Description

@l0kix2

Currently remote components embed both: CommonSpec and InstanceSpec
https://github.com/ytsaurus/ytsaurus-k8s-operator/blob/main/api/v1/remoteexecnodes_types.go#L27-L28

and they have intersection in json field names (hostNetwork, nativeTransport) — that leads to conflicts/shadowing:

  • in case we serialize struct with 2 values being set — last one wins (I think)
  • in case we deserialize struct: value will be set for both embedded fields

We actually would have the compilation-level error if we embed InstanceSpec near to the CommonSpec, but since we embed indirectly (https://github.com/ytsaurus/ytsaurus-k8s-operator/blob/main/api/v1/remoteexecnodes_types.go#L28) — we somehow avoid this compillation error and mask it.

We need to think about this defaults/overrides and if we can change the code, so we don't embed both structures, because it smells bad design.
At least, it is not make sense to have common hostNetwork and component specific host-network (and any defaults) when we are talking about single component, so probably structures should be less granular here.

This issue should be a part of "Splitting CRD" epic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIAPI, CRD, User-facing Interfaces

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions