我正在尝试在 aks 中添加 customresourcedeployment。早些时候我们使用了我认为已弃用的 V1beta1 版本。现在我正在尝试使用抛出架构验证错误的 v1 版本。V1beta1版本如下。
{
'apiVersion': 'apiextensions.k8s.io/v1beta1',
'kind': 'CustomResourceDefinition',
'metadata': {
'name': 'azureassignedidentities.aadpodidentity.k8s.io'
},
'spec': {
'group': 'aadpodidentity.k8s.io',
'version': 'v1',
'names': {
'kind': 'AzureAssignedIdentity',
'plural': 'azureassignedidentities'
},
'scope': 'Namespaced'
}
}
现在我正在尝试使用以下模板。
let collection = {
'apiVersion': 'apiextensions.k8s.io/v1',
'kind': 'CustomResourceDefinition',
'metadata': {
"annotations": {
"api-approved.kubernetes.io": "unapproved",
"controller-gen.kubebuilder.io/version": "v0.5.0"
},
'name': 'azureassignedidentities.aadpodidentity.k8s.io'
},
'spec': {
'group': 'aadpodidentity.k8s.io',
'names': {
'kind': 'AzureAssignedIdentity',
'listKind': 'AzureAssignedIdentityList',
'plural': 'azureassignedidentities',
'singular': 'azureassignedidentity'
},
'scope': 'Namespaced',
'versions': {
'name': 'v1',
'schema': {
'openAPIV3Schema': {
'description': 'AzureAssignedIdentity contains the identity <-> pod mapping which is matched.',
'properties': {
'apiVersion': {
'description': 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources',
'type': 'string'
},
'kind': {
'description': 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds',
'type': 'string'
},
'metadata': {
'type': 'object'
},
'spec': {
'description': 'AzureAssignedIdentitySpec contains the relationship between an AzureIdentity and an AzureIdentityBinding.',
'properties': {
'azureBindingRef': {
'description': 'AzureBindingRef is an embedded resource referencing the AzureIdentityBinding used by the AzureAssignedIdentity, which requires x-kubernetes-embedded-resource fields to be true',
'properties': {
'apiVersion': {
'description': 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources',
'type': 'string'
},
'kind': {
'description': 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds',
'type': 'string'
},
'metadata': {
'type': 'object'
},
'spec': {
'description': 'AzureIdentityBindingSpec matches the pod with the Identity. Used to indicate the potential matches to look for between the pod/deployment and the identities present.',
'properties': {
'azureIdentity': {
'type': 'string'
},
'metadata': {
'type': 'object'
},
'selector': {
'type': 'string'
},
'weight': {
'description': 'Weight is used to figure out which of the matching identities would be selected.',
'type': 'integer'
}
},
'type': 'object'
},
'status': {
'description': 'AzureIdentityBindingStatus contains the status of an AzureIdentityBinding.',
'properties': {
'availableReplicas': {
'format': 'int32',
'type': 'integer'
},
'metadata': {
'type': 'object'
}
},
'type': 'object'
}
},
'type': 'object',
'x-kubernetes-embedded-resource': 'true'
},
'azureIdentityRef': {
'description': 'AzureIdentityRef is an embedded resource referencing the AzureIdentity used by the AzureAssignedIdentity, which requires x-kubernetes-embedded-resource fields to be true',
'properties': {
'apiVersion': {
'description': 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources',
'type': 'string'
},
'kind': {
'description': 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds',
'type': 'string'
},
'metadata': {
'type': 'object'
},
'spec': {
'description': 'AzureIdentitySpec describes the credential specifications of an identity on Azure.',
'properties': {
'adEndpoint': {
'type': 'string'
},
'adResourceID': {
'description': 'For service principal. Option param for specifying the AD details.',
'type': 'string'
},
'auxiliaryTenantIDs': {
'description': 'Service principal auxiliary tenant ids',
'items': {
'type': 'string'
},
'nullable': 'true',
'type': 'array'
},
'clientID': {
'description': 'Both User Assigned MSI and SP can use this field.',
'type': 'string'
},
'clientPassword': {
'description': 'Used for service principal',
'properties': {
'name': {
'description': 'Name is unique within a namespace to reference a secret resource.',
"type": "string"
},
'namespace': {
'description': 'Namespace defines the space within which the secret name must be unique.',
'type': 'string'
}
},
'type': 'object'
},
'metadata': {
'type': 'object'
},
'replicas': {
'format': 'int32',
'nullable': 'true',
'type': 'integer'
},
'resourceID': {
'description': 'User assigned MSI resource id.',
'type': 'string'
},
'tenantID': {
'description': 'Service principal primary tenant id.',
'type': 'string'
},
'type': {
'description': 'UserAssignedMSI or Service Principal',
'type': 'integer'
}
},
'type': 'object'
},
'status': {
'description': 'AzureIdentityStatus contains the replica status of the resource.',
'properties': {
'availableReplicas': {
'format': 'int32',
'type': 'integer'
},
'metadata': {
'type': 'object'
}
},
'type': 'object'
}
},
'type': 'object',
'x-kubernetes-embedded-resource': 'true'
},
'metadata': {
'type': 'object'
},
'nodename': {
'type': 'string'
},
'pod': {
'type': 'string'
},
'podNamespace': {
'type': 'string'
},
'replicas': {
'format': 'int32',
'nullable': 'true',
'type': 'integer'
}
},
'type': 'object'
},
'status': {
'description': 'AzureAssignedIdentityStatus contains the replica status of the resource.',
'properties': {
'availableReplicas': {
'format': 'int32',
'type': 'integer'
},
'metadata': {
'type': 'object'
},
'status': {
'type': 'string'
}
},
'type': 'object'
}
},
'type': 'object'
}
},
'served': 'true',
'storage': 'true',
}
},
'status': {
'acceptedNames': {
'kind': "",
'plural': ""
},
'conditions': [],
'storedVersions': []
}
}
我正在尝试使用以下代码进行部署。
const client = this.kubeConfig.makeApiClient(k8s.ApiextensionsV1Api);
return new Promise<string>((resolve, reject) => {
client.createCustomResourceDefinition(collection).then(
(response) => {
resolve(response);
},
(err) => {
reject(err.response && err.response.body ? err.response.body : err);
},
);
});
错误如下。
*{ "message": "CustomResourceDefinition.apiextensions.k8s.io "azureassignedidentities.aadpodidentity.k8s.io" 无效:[spec.versions[0].schema.openAPIV3Schema:必需值:需要架构,spec.versions[1 ].schema.openAPIV3Schema:必需值:需要模式,spec.versions[2].schema.openAPIV3Schema:必需值:需要模式,spec.versions[3].schema.openAPIV3Schema:必需值:需要模式,规范.versions[0].name:无效值:“”:DNS-1035 标签必须由小写字母数字字符或“-”组成,以字母字符开头,并以字母数字字符结尾(例如“my-name” , 或 'abc-123', 用于验证的正则表达式是 'az?'), spec.versions[1].name: 无效值: "":DNS-1035 标签必须由小写字母数字字符或“-”组成,以字母字符开头,并以字母数字字符结尾(例如“my-name”或“abc-123”,用于验证的正则表达式为“ az?'), spec.versions[2].name: 无效值: "": DNS-1035 标签必须由小写字母数字字符或“-”组成,以字母字符开头,以字母数字字符 (例如 'my-name' 或 'abc-123',用于验证的正则表达式是 'az?'),spec.versions[3].name:无效值:“”:DNS-1035 标签必须由小写字母组成字母数字字符或“-”,以字母字符开头,以字母数字字符结尾(例如“my-name”或“abc-123”,用于验证的正则表达式为“az?'), spec.versions: 无效值: []apiextensions.CustomResourceDefinitionVersion{apiextensions.CustomResourceDefinitionVersion{Name:"", Served:false, Storage:false, Deprecated:false, DeprecationWarning:(*string)(nil), Schema :(*apiextensions.CustomResourceValidation)(nil), Subresources:(*apiextensions.CustomResourceSubresources)(nil), AdditionalPrinterColumns:[]apiextensions.CustomResourceColumnDefinition(nil)}, apiextensions.CustomResourceDefinitionVersion{Name:"", Served:false, Storage:假,弃用:假,弃用警告:(*string)(nil),架构:(*apiextensions.CustomResourceValidation)(nil),子资源:(*apiextensions.CustomResourceSubresources)(nil),AdditionalPrinterColumns:[]apiextensions.CustomResourceColumnDefinition(nil) },apiextensions.CustomResourceDefinitionVersion{名称:“”,服务:假,Storage:false, Deprecated:false, DeprecationWarning:(*string)(nil), Schema:(*apiextensions.CustomResourceValidation)(nil), Subresources:(*apiextensions.CustomResourceSubresources)(nil), AdditionalPrinterColumns:[]apiextensions.CustomResourceColumnDefinition( nil)}, apiextensions.CustomResourceDefinitionVersion{Name:"", Served:false, Storage:false, Deprecated:false, DeprecationWarning:(*string)(nil), Schema:(*apiextensions.CustomResourceValidation)(nil), Subresources:( *apiextensions.CustomResourceSubresources)(nil), AdditionalPrinterColumns:[]apiextensions.CustomResourceColumnDefinition(nil)}}:必须包含唯一的版本名称,spec.versions:无效值:[]apiextensions.CustomResourceDefinitionVersion{apiextensions.CustomResourceDefinitionVersion{Name:"",服务:假,存储:假,弃用:假,弃用警告:(*string)(nil), Schema:(*apiextensions.CustomResourceValidation)(nil), Subresources:(*apiextensions.CustomResourceSubresources)(nil), AdditionalPrinterColumns:[]apiextensions.CustomResourceColumnDefinition(nil)}, apiextensions.CustomResourceDefinitionVersion{Name: "", Served:false, Storage:false, Deprecated:false, DeprecationWarning:(*string)(nil), Schema:(*apiextensions.CustomResourceValidation)(nil), Subresources:(*apiextensions.CustomResourceSubresources)(nil), AdditionalPrinterColumns :[]apiextensions.CustomResourceColumnDefinition(nil)}, apiextensions.CustomResourceDefinitionVersion{Name:"", Served:false, Storage:false, Deprecated:false, DeprecationWarning:(*string)(nil), Schema:(*apiextensions.CustomResourceValidation) (nil),子资源:(*apiextensions.CustomResourceSubresources)(nil),AdditionalPrinterColumns:[]apiextensions.CustomResourceColumnDefinition(nil)}, apiextensions.CustomResourceDefinitionVersion{Name:"", Served:false, Storage:false, Deprecated:false, DeprecationWarning:(*string)(nil), Schema:(*apiextensions.CustomResourceValidation)(无),子资源:(apiextensions.CustomResourceSubresources)(nil), AdditionalPrinterColumns:[]apiextensions.CustomResourceColumnDefinition(nil)}}: 必须有一个版本被标记为存储版本,status.storedVersions: 无效值: []string(nil): 必须至少有一个存储版本]" }
请帮我解决这个问题