Skip to content

Commit

Permalink
fix: the image type can not be saved when saving cluster as a template
Browse files Browse the repository at this point in the history
Signed-off-by: liuying <liu.ying@99cloud.net>
  • Loading branch information
lysign committed Aug 16, 2022
1 parent ff89e95 commit dea4242
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export default class Create extends StepAction {
containerdRootDir,
containerdVersionOnline,
containerdVersionOffline,
backupPoint,
// backupPoint,
// network
dnsDomain,
Expand All @@ -214,8 +215,8 @@ export default class Create extends StepAction {
serviceSubnetV6,
mtu,
// cluster
// description,
// externalIP,
description,
externalIP,
// labels,
} = values;

Expand All @@ -225,8 +226,22 @@ export default class Create extends StepAction {
const { IPv4AutoDetection, IPv6AutoDetection } =
computeAutoDetection(values);

const offlineAnnotations = offline ? { 'kubeclipper.io/offline': '' } : {};
const externalIPLabel = externalIP
? { 'kubeclipper.io/externalIP': externalIP }
: {};

const config = {
offline,
metadata: {
labels: {
'kubeclipper.io/backupPoint': backupPoint,
...externalIPLabel,
},
annotations: {
'kubeclipper.io/description': description,
...offlineAnnotations,
},
},
certSANs: arrayInputValue(certSANs),
localRegistry,
workerNodeVip,
Expand Down
17 changes: 16 additions & 1 deletion src/utils/object.mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,21 @@ const ClusterTemplateMapper = (item) => {
config,
'networking.services.cidrBlocks'
);
const isDualStack = get(item, 'networking.ipFamily') === 'IPv4+IPv6';
const isDualStack = get(config, 'networking.ipFamily') === 'IPv4+IPv6';

const offline = has(config.metadata, 'annotations["kubeclipper.io/offline"]');
const description = get(
config.metadata,
'annotations["kubeclipper.io/description"]'
);
const externalIP = get(
config.metadata,
'labels["kubeclipper.io/externalIP"]'
);
const backupPoint = get(
config.metadata,
'labels["kubeclipper.io/backupPoint"]'
);

const kubernetesVersion = get(config, 'kubernetesVersion');
const kubernetesVersionOnline = !offline && kubernetesVersion;
Expand All @@ -163,6 +175,9 @@ const ClusterTemplateMapper = (item) => {

return {
offline,
description,
externalIP,
backupPoint,
certSANs: get(config, 'certSANs'),
localRegistry: get(config, 'localRegistry'),
workerNodeVip: get(config, 'workerNodeVip'),
Expand Down

0 comments on commit dea4242

Please sign in to comment.