Skip to content

feature: better namespacing for types and functions #9

@Anmol1696

Description

@Anmol1696

Overview

Currently since we have a single file we have alot of issues with overlapping names, for example: kantive has Service conflicts with actual Service.

Problem Statement

Currently example of 2 overlapping definations:

/* dev.knative.serving.v1.Service */
export interface Service {
  // ...
}

/* io.k8s.api.core.v1.Service */
export interface Service {
  // ...
}

There is a conflict, which we can currently solve with renameMap, but this is not ideal.

Possible solutions

Somehow we should ba able to isolate for different types of backends

Option 1: Namespace based

Maybe have a way in which we can have namespace based imports:

import { Service as KnativeService } from `kubernetesjs/dev/knative/serving/v1`
import { Service } from `kubernetesjs/io/k8s/api/core/v1`

We should also then have a registry of sorts to keep track of the components and the actual implementations

Option 2: Seperate clients

import { Service } from `knativejs`
import { Service as CoreService} from `kubernetesjs`

Option 3: Use group-version-kind

In swagger we also have group version defination, which can be used for a better mapping:
For core Service

      "x-kubernetes-group-version-kind": [
        {
          "group": "",
          "kind": "Service",
          "version": "v1"
        }
      ]

Other knative service:

      "x-kubernetes-group-version-kind": [
        {
          "group": "serving.knative.dev",
          "kind": "Service",
          "version": "v1"
        }

Then maybe we can use groups as some sort of mapping for distinguishing between similar definations.

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