-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kubernetes provider can't create a namespace with a name attribute #170
Comments
Thanks for reporting this bug. I can confirm this is a bug, it's due to this line of code - when deactivating this line, the interface is being rendered correctly: export interface NamespaceMetadata {
/** An unstructured key value map stored with the namespace that may be used to store arbitrary metadata. More info: http://kubernetes.io/docs/user-guide/annotations */
readonly annotations?: { [key: string]: string };
/** Prefix, used by the server, to generate a unique name ONLY IF the `name` field has not been provided. This value will also be combined with a unique suffix. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#idempotency */
readonly generateName?: string;
/** A sequence number representing a specific generation of the desired state. */
readonly generation: number;
/** Map of string keys and values that can be used to organize and categorize (scope and select) the namespace. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels */
readonly labels?: { [key: string]: string };
/** Name of the namespace, must be unique. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names */
readonly name?: string;
/** An opaque value that represents the internal version of this namespace that can be used by clients to determine when namespace has changed. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency */
readonly resourceVersion: string;
/** A URL representing this namespace. */
readonly selfLink: string;
/** The unique in time and space value for this namespace. More info: http://kubernetes.io/docs/user-guide/identifiers#uids */
readonly uid: string;
} I'll investigate what the original intent of this line was (can't remember off the top of my head) |
That's essentially the quickfix for #29. When disabling this, there will be invalid interfaces generated. We could think about being more specific for the guard clause or doing the check at a later stage in the code generation phase. |
When looking at the schema "metadata": {
"nesting_mode": "list",
"block": {
"attributes": {
"annotations": {
"type": [
"map",
"string"
],
"description": "An unstructured key value map stored with the namespace that may be used to store arbitrary metadata. More info: http://kubernetes.io/docs/user-guide/annotations",
"optional": true
},
"generate_name": {
"type": "string",
"description": "Prefix, used by the server, to generate a unique name ONLY IF the `name` field has not been provided. This value will also be combined with a unique suffix. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#idempotency",
"optional": true
},
"generation": {
"type": "number",
"description": "A sequence number representing a specific generation of the desired state.",
"computed": true
},
"labels": {
"type": [
"map",
"string"
],
"description": "Map of string keys and values that can be used to organize and categorize (scope and select) the namespace. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels",
"optional": true
},
"name": {
"type": "string",
"description": "Name of the namespace, must be unique. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
"optional": true,
"computed": true
},
"resource_version": {
"type": "string",
"description": "An opaque value that represents the internal version of this namespace that can be used by clients to determine when namespace has changed. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
"computed": true
},
"self_link": {
"type": "string",
"description": "A URL representing this namespace.",
"computed": true
},
"uid": {
"type": "string",
"description": "The unique in time and space value for this namespace. More info: http://kubernetes.io/docs/user-guide/identifiers#uids",
"computed": true
}
}
},
"min_items": 1,
"max_items": 1
}, And comparing it to the docs it looks like we could just guard it by Besides from that, what we certainly don't support at the moment are attribute references for nested types e.g. |
@redeux FYI: the fix for |
I confirmed that it works as expected now. Thanks! |
I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Community Note
cdktf & Language Versions
Affected Resource(s)
Debug Output
Expected Behavior
Actual Behavior
Steps to Reproduce
Try to create a namespace with a name attribute using the Kubernetes provider
Important Factoids
Name is a valid input for the kubernetes_namespace resource.
In the CDK schema doc in
namespace.ts
it shows as optional and computed.It's absent from the
NamespaceMetadata
interfaceReferences
None
The text was updated successfully, but these errors were encountered: