Comments (2)
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.
#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)
- xk6-kubernetes extension can't be used in-cluster HOT 3
- Allow login with server host and token HOT 1
- Bump dependencies and CI
- Port forwarding feature is not available to expose service to local host
- Redesign scope of xk6-kubernetes API HOT 10
- Implement generic k8s interface
- Add helper function for creating random namespaces
- Add helper function for waiting a Deployment is ready
- Deleting namespace using the generic interface fails
- Re-implement generic Apply method using dynamic client's apply HOT 1
- Apply fails if the resources already exist HOT 1
- Add options parameter to Delete function in Generic API
- Ingresses missing from generic resource API
- Add examples for CRDs
- Remove Deprecated API
- Move helper functions to helpers package in new API
- TypeScript type definitions HOT 1
- Migrate example scripts from deprecated APIs
- Upgrade dependencies and CI to latest specs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xk6-kubernetes.