Skip to content

Commit

Permalink
fix: override annotations of federated project
Browse files Browse the repository at this point in the history
Signed-off-by: leoliu <leoliu@yunify.com>
  • Loading branch information
leoliu committed Jul 28, 2020
1 parent 86c07ad commit effac3f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/utils/fed.templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const getNamespaceTemplate = data => {
const name = get(data, 'metadata.name')
const annotations = get(data, 'metadata.annotations')
const placement = get(data, 'spec.placement')
const clusters = get(data, 'spec.placement.clusters', [])

const workspace = get(data, 'metadata.labels["kubesphere.io/workspace"]')

Expand All @@ -32,6 +33,11 @@ const getNamespaceTemplate = data => {
unset(template, 'metadata.annotations')
unset(template, 'spec')

const overrides = clusters.map(cluster => ({
clusterName: cluster.name,
clusterOverrides: [{ path: '/metadata/annotations', value: annotations }],
}))

return {
apiVersion: 'types.kubefed.io/v1beta1',
kind: 'FederatedNamespace',
Expand All @@ -43,7 +49,7 @@ const getNamespaceTemplate = data => {
},
annotations,
},
spec: { placement, template },
spec: { placement, template, overrides },
}
}

Expand Down

0 comments on commit effac3f

Please sign in to comment.