Skip to content

Commit

Permalink
fix: preserve dwoc
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Kurinnyi <[email protected]>
  • Loading branch information
akurinnoy committed Nov 10, 2023
1 parent 4e2738d commit 99f036a
Showing 1 changed file with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -458,23 +458,15 @@ export class DevWorkspaceClient {
const cheNamespace = config.cheNamespace;
let attributes = workspace.spec.template.attributes;
if (cheNamespace) {
const devworkspaceConfig = { name: 'devworkspace-config', namespace: cheNamespace };
const devworkspaceConfigPath = `/spec/template/attributes/${this.escape(
DEVWORKSPACE_CONFIG_ATTR,
)}`;
if (attributes) {
if (attributes[DEVWORKSPACE_CONFIG_ATTR]) {
if (attributes[DEVWORKSPACE_CONFIG_ATTR] !== devworkspaceConfig) {
patch.push({ op: 'replace', path: devworkspaceConfigPath, value: devworkspaceConfig });
}
} else {
patch.push({ op: 'add', path: devworkspaceConfigPath, value: devworkspaceConfig });
}
} else {
if (attributes?.[DEVWORKSPACE_CONFIG_ATTR] === undefined) {
const devworkspaceConfig = { name: 'devworkspace-config', namespace: cheNamespace };
const devworkspaceConfigPath = `/spec/template/attributes/${this.escape(
DEVWORKSPACE_CONFIG_ATTR,
)}`;
patch.push({
op: 'add',
path: '/spec/template/attributes',
value: { [DEVWORKSPACE_CONFIG_ATTR]: devworkspaceConfig },
path: devworkspaceConfigPath,
value: devworkspaceConfig,
});
attributes = {};
}
Expand Down

0 comments on commit 99f036a

Please sign in to comment.