-
Notifications
You must be signed in to change notification settings - Fork 559
Open
Labels
lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.Indicates that an issue or PR should not be auto-closed due to staleness.
Description
When creating a LimitRange I found out that this wouldn't work as expected
const lr_config = {
apiVersion: 'v1',
kind: 'LimitRange',
metadata: {
name: 'default',
},
spec: {
limits: [
{
type: 'Container',
default: {
cpu: '200m',
memory: '800Mi',
},
defaultRequest: {
cpu: '200m',
memory: '800Mi',
},
},
],
},
};
k8sApi_core.createNamespacedLimitRange("default", lr_config);In fact the resource was deployed in the cluster without the field "default"
apiVersion: v1
kind: LimitRange
metadata:
creationTimestamp: ***
name: default
namespace: default
resourceVersion: ***
uid: ***
spec:
limits:
- defaultRequest:
cpu: 200m
memory: 800Mi
type: Container
Digging the source code I managed to track the issue to this file
The solution for me was to replace "deafult" with "_default" as follows:
const lr_config = {
apiVersion: 'v1',
kind: 'LimitRange',
...
spec: {
limits: [
{
type: 'Container',
_default: {
cpu: '200m',
memory: '800Mi',
},
...
},
],
},
};
k8sApi_core.createNamespacedLimitRange("default", lr_config);If not possible to use the expected field name I think we should make it clear in the documentation for clarity sake
Metadata
Metadata
Assignees
Labels
lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.Indicates that an issue or PR should not be auto-closed due to staleness.