diff --git a/package-lock.json b/package-lock.json index df1b058a..17e08383 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "vscode-gitops-tools", - "version": "0.24.4-edge.1", + "version": "0.24.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vscode-gitops-tools", - "version": "0.24.4-edge.1", + "version": "0.24.3", "license": "MPL-2.0", "dependencies": { "@kubernetes/client-node": "^0.18.1", diff --git a/package.json b/package.json index 6a4c2f48..1477645d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-gitops-tools", "displayName": "GitOps Tools for Flux", "description": "GitOps automation tools for continuous delivery of Kubernetes and Cloud Native applications", - "version": "0.24.4-edge.1", + "version": "0.24.3", "author": "Kingdon Barrett ", "contributors": [ "Kingdon Barrett ", diff --git a/src/ui/webviews/configureGitOps/actions.ts b/src/ui/webviews/configureGitOps/actions.ts index 50ae8290..0696e0fd 100644 --- a/src/ui/webviews/configureGitOps/actions.ts +++ b/src/ui/webviews/configureGitOps/actions.ts @@ -4,7 +4,7 @@ import { createConfigurationGeneric } from './lib/createGeneric'; import { exportConfigurationGeneric } from './lib/exportGeneric'; -const isAzure = (data: ParamsDictionary) => data.clusterInfo.isAzure && data.source?.createFluxConfig; +const isAzure = (data: ParamsDictionary) => data.clusterInfo.isAzure && (data.source?.createFluxConfig || !data.source); function removeAzureData(data: any) { if(data.source) { diff --git a/src/ui/webviews/configureGitOps/lib/createAzure.ts b/src/ui/webviews/configureGitOps/lib/createAzure.ts index 5e76775d..5ac9e233 100644 --- a/src/ui/webviews/configureGitOps/lib/createAzure.ts +++ b/src/ui/webviews/configureGitOps/lib/createAzure.ts @@ -7,6 +7,7 @@ import { ParamsDictionary } from 'utils/typeUtils'; import { refreshSourcesTreeView, refreshWorkloadsTreeView } from 'ui/treeviews/treeViews'; import { ClusterInfo } from 'types/kubernetes/clusterProvider'; import { kubeConfig } from 'cli/kubernetes/kubernetesConfig'; +import { splitNamespacedFluxObject } from 'utils/namespacedFluxObject'; export async function createConfigurationAzure(data: ParamsDictionary) { const clusterInfo = data.clusterInfo as ClusterInfo; @@ -22,7 +23,8 @@ export async function createConfigurationAzure(data: ParamsDictionary) { } } else if(kustomization) { - azureTools.createKustomization(kustomization.name, kustomization.source, kustomization.path, + const gitRepositoryName = splitNamespacedFluxObject(kustomization.source).name; + azureTools.createKustomization(kustomization.name, gitRepositoryName, kustomization.path, contextName, clusterInfo.clusterProvider as AzureClusterProvider, kustomization.dependsOn, kustomization.prune); } } diff --git a/src/utils/namespacedFluxObject.ts b/src/utils/namespacedFluxObject.ts index 882698f3..998f03c6 100644 --- a/src/utils/namespacedFluxObject.ts +++ b/src/utils/namespacedFluxObject.ts @@ -1,9 +1,13 @@ import { FluxSourceObject, FluxWorkloadObject } from '../types/flux/object'; - - export function namespacedFluxObject(resource?: FluxSourceObject | FluxWorkloadObject): string | undefined { if (resource) { return `${resource.kind}/${resource.metadata?.name}.${resource.metadata?.namespace}`; } } + +export function splitNamespacedFluxObject(fullname: string) { + const [kind, nameNs] = fullname.split('/'); + const [name, namespace] = nameNs.split('.'); + return { kind, name, namespace }; +} diff --git a/webview-ui/configureGitOps/src/lib/model.ts b/webview-ui/configureGitOps/src/lib/model.ts index aa4f56a6..b081752e 100644 --- a/webview-ui/configureGitOps/src/lib/model.ts +++ b/webview-ui/configureGitOps/src/lib/model.ts @@ -85,7 +85,7 @@ export const [createWorkload, setCreateWorkload] = createSignal(false); export const [kustomization, setKustomization] = createStore({ name: 'podinfo', namespace: 'flux-system', - source: '', // Ex: GitRepo/podinfo.flux-system + source: '', // Ex: GitRepository/podinfo.flux-system path: '/kustomize', targetNamespace: 'default', serviceAccount: '', @@ -135,12 +135,7 @@ createEffect(() => { if(params.selectSourceTab) { setCreateWorkload(true); - - if(params.selectedSource && params.selectedSource !== '') { - setKustomization('source', params.selectedSource); - } else if(params.sources?.length > 0) { - setKustomization('source', namespacedSource(params.sources[0])); - } + updateSelectedSource(); } if(params.set) { @@ -162,8 +157,7 @@ createEffect(() => { if(createSource()) { setKustomization('source', `${source.kind}/${source.name}.${source.namespace}`); } else { - const s = params.sources[0]; - setKustomization('source', `${s.kind}/${s.name}.${s.namespace}`); + updateSelectedSource(); } }); @@ -201,6 +195,14 @@ const setters: StoreMap = { setKustomization, }; +export function updateSelectedSource() { + if (params.selectedSource && params.selectedSource !== '') { + setKustomization('source', params.selectedSource); + } else if (params.sources?.length > 0) { + setKustomization('source', namespacedSource(params.sources[0])); + } +} + export function storeAccessors(props: any) { let get: ()=> any; let set: (v: any)=> any;