Coder Social home page Coder Social logo

Comments (2)

pablochacin avatar pablochacin commented on June 17, 2024

With the changes introduced in #70 it should be relatively easy to support custom resources as the API now works on generic resources (instead of been segregated by resource type). However, it implementation of this API requires to know the mapping between the resource Kind and the resource.

For custom resources, two mappings are needed: one for supporting the creation of CustomResourceDefinition objects, which can be trivially added to the mapping described above, and one introduced by the custom resource definition itself. This second mapping is now know until the resource CurstomResourceDefinition and must be somehow provided.

The example below helps to clarify this distinction. The yaml describes a CustomResoruceDefinition that introduces a new custom resource of kind CronTab that is mapped to the resource crontabs in the resource group crontabs.stable.example.com with version v1. This resource should therefore be added to the list of known kinds as

"CronTab":  {Group: "crontabs.stable.example.com`", Version: "v1", Resource: "crontabs"},

How This mapping can be dynamically introduced is the main issue for implementing the support for CRDs. Some options are:

  • Dynamically retrieve the supported api resources from the api server (in a similar way that the kubectl api-resources command does)
  • Create a function in the API for registering CRDs. This function would create the CRD and register the resource in the list of known kinds.

Example of a Custom Resource Definition

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: crontabs.stable.example.com
spec:
  # group name to use for REST API: /apis/<group>/<version>
  group: stable.example.com
  # list of versions supported by this CustomResourceDefinition
  versions:
    - name: v1
      # Each version can be enabled/disabled by Served flag.
      served: true
      # One and only one version must be marked as the storage version.
      storage: true
  # either Namespaced or Cluster
  scope: Namespaced
  names:
    # plural name to be used in the URL: /apis/<group>/<version>/<plural>
    plural: crontabs
    # singular name to be used as an alias on the CLI and for display
    singular: crontab
    # kind is normally the CamelCased singular type. Your resource manifests use this.
    kind: CronTab
    # shortNames allow shorter string to match your resource on the CLI
    shortNames:
    - ct

from xk6-kubernetes.

pablochacin avatar pablochacin commented on June 17, 2024

#85 should make it possible to manipulate CRDs with this extension, but until #86 is completed we cannot ensure this.

from xk6-kubernetes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.