When try to start workspace form some devfiles it fails to start with error message:
Failure executing: POST at: https://172.30.0.1/apis/apps/v1/namespaces/eclipse-che/deployments. Message: Deployment.apps \"workspacet0so790bumywjht3.workspace\" is invalid: spec.template.annotations: Invalid value: \"org.eclipse.che.container.eclipse-che-theia-dev-nightly.machine_name\": name part must be no more than 63 characters. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=spec.template.annotations, message=Invalid value: \"org.eclipse.che.container.eclipse-che-theia-dev-nightly.machine_name\": name part must be no more than 63 characters, reason=FieldValueInvalid, additionalProperties={})], group=apps, kind=Deployment, name=workspacet0so790bumywjht3.workspace, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Deployment.apps \"workspacet0so790bumywjht3.workspace\" is invalid: spec.template.annotations: Invalid value: \"org.eclipse.che.container.eclipse-che-theia-dev-nightly.machine_name\": name part must be no more than 63 characters, metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).
POST /workspace/devfile API method{
"specVersion": "0.0.1",
"name": "multiple-dockerimages",
"projects": [
{
"name": "nodejs-mongo-app",
"source": {
"type": "git",
"location": "https://github.com/ijason/NodeJS-Sample-App.git"
}
}
],
"components": [
{
"name": "theia-editor",
"type": "cheEditor",
"id": "eclipse/che-theia/next"
},
{
"name": "exec-plugin",
"type": "chePlugin",
"id": "eclipse/che-machine-exec-plugin/0.0.1"
},
{
"name": "mongodb",
"type": "dockerimage",
"image": "eclipse/che-theia-dev:nightly",
"endpoints": [
{
"name": "mongo",
"port": 27017,
"attributes": {
"public": "false",
"discoverable": "true"
}
}
],
"mountSources": true,
"volumes": [
{
"name": "mongo-storage",
"containerPath": "/data/db"
}
],
"memoryLimit": "2500Mi"
},
{
"name": "nodejs-app",
"type": "openshift",
"reference": "node-js.yaml",
"referenceContent": "apiVersion: v1\nkind: List\nitems:\n-\n apiVersion: apps/v1\n kind: Deployment\n metadata:\n name: web\n labels:\n app: nodejs\n spec:\n replicas: 2\n selector:\n name: web\n template:\n metadata:\n labels:\n app: nodejs\n name: web-controller\n spec:\n containers:\n - image: node:0.10.40\n command: ['tail', '-f', '/dev/null']\n args: []\n name: web\n ports:\n - containerPort: 3000\n name: http-server\n volumeMounts:\n - mountPath: /projects\n name: projects\n volumes:\n - name: projects\n persistentVolumeClaim:\n claimName: projects\n- apiVersion: v1\n kind: PersistentVolumeClaim\n metadata:\n name: projects\n spec:\n accessModes:\n - ReadWriteOnce\n resources:\n requests:\n storage: 2Gi\n-\n apiVersion: v1\n kind: Service\n metadata:\n name: web\n labels:\n name: web\n spec:\n type: LoadBalancer\n ports:\n - name: web\n port: 80\n targetPort: 3000\n protocol: TCP\n selector:\n app: nodejs\n- apiVersion: v1\n kind: Route\n metadata:\n name: che\n spec:\n to:\n kind: Service\n name: web\n port:\n targetPort: web\n"
}
],
"commands": [
{
"name": "run",
"actions": [
{
"type": "exec",
"component": "nodejs-app",
"command": "cd ${CHE_PROJECTS_ROOT}/nodejs-mongo-app/EmployeeDB/ && npm install && node app.js"
}
]
}
]
}
Note, that this problem occurs when replace mongo with something longer, say eclipse/che-theia-dev:nightly.
It tries to use org.eclipse.che.container.eclipse-che-theia-dev-nightly.machine_name for the name. To workaround this problem one may add alias field into the image description in devfile. The Che will use it as a name and it will not exceed the 64 characters limit.
The only 2 viable solutions I see here is to:
org.eclipse.che.container.eclipse-che-theia-dev-nightly.machine_name we could do with che.container.name.eclipse-che-theia-dev-nightly for example.I don't think we should bother Che users with internal stuff like length of generated name. I would try to use full form and if it fails, make it shorter.
So what about:
che.container.1.component=eclipse-che-theia-dev-nightly
che.container.1.machine=ws/dev
che.container.2.component=...
che.container.2.machine=...
e.g. split the annotation in 2 with predictable names and free-form values.
This is the piece of code that adds these annotations. Notice that the machine name is always already contained in the key of the annotation. I don't think this piece of info gives any useful information.
I hit the same issue while trying the new vscode kubernetes plugin support, so I tried to use a shorter alias but it does not seems to be picked up (using nightly)
- type: chePlugin
alias: kubernetes-tools
id: 'ms-kubernetes-tools/vscode-kubernetes-tools/0.1.17'
metadata.annotations: Invalid value: "org.eclipse.che.container.vscode-kubernetes-toolsu3f.machine_name": name part must be no more than 63 characters, spec.template.annotations: Invalid value: "org.eclipse.che.container.vscode-kubernetes-toolsu3f.machine_name": name part must be no more than 63 characters]
@lehmanju Thanks for sharing your case. I believe you're right and workaround with short alias work only with dockerimage component type.
@sleshchenko, thanks for confirming. I believe that there is no workaround then and because of that it's not possible to use the latest che with vscode plugins currently (and potentially other plugins with long name)
Another quick fix would be to use annotation prefix which allows 253 characters (but my following comment still applies).
About the root cause of the issue, I think using raw information for annotation key is a fragile design. It should be stored in the annotation value, and the key should be generated as a short fixed-length unique retrievable value (e.g. hash).
My 2 cents :)
hitting same issue with OpenShift Connector extension:
spec.template.annotations: Invalid value: "org.eclipse.che.container.vscode-openshift-connector2ph.machine_name": name part must be no more than 63 characters.
I don't understand this issue: I don't see spec.template.annotations anywhere in the devfile. If it is something that is generated by our own tooling, we need to insure that we can translate values in the input to valid values in the output.
Putting the burden for this on the user seems wrong to me.
it seems to be something generated by Che itself internally.
Currently, there is not even a "burden" to the user as the initially proposed workaround is reported as not working for VS Code extension, working only for dockerfile see https://github.com/eclipse/che/issues/13303#issuecomment-505836401
My current understanding is that there is no way to use some of the VS Code Extensions proposed by the default registry.
@skabashnyuk can you confirm that some of the plugins in che-plugin-registry do not work currently? That would mean it's a 7.0.0 issue, IMO. If it's only a problem for 3rd party plugins, I would tent towards 7.1.0.
it is a problem for:
Ok, that's a 7.0 for me then. What we ship should at least start up out of the box.
Finally closed :tada:
Most helpful comment
Finally closed :tada: