Skip to content

Commit

Permalink
Merge branch 'main' into edge
Browse files Browse the repository at this point in the history
  • Loading branch information
Kingdon Barrett committed Jul 28, 2023
2 parents 827a264 + 85f1fd3 commit 6fb8d66
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <kingdon@weave.works>",
"contributors": [
"Kingdon Barrett <kingdon@weave.works>",
Expand Down
2 changes: 1 addition & 1 deletion src/ui/webviews/configureGitOps/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion src/ui/webviews/configureGitOps/lib/createAzure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/utils/namespacedFluxObject.ts
Original file line number Diff line number Diff line change
@@ -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 };
}
20 changes: 11 additions & 9 deletions webview-ui/configureGitOps/src/lib/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down Expand Up @@ -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) {
Expand All @@ -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();
}
});

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6fb8d66

Please sign in to comment.