Skip to content

Commit

Permalink
Adding a simple yaml viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
sebt3 committed Jan 20, 2024
1 parent 38a79cc commit 8adfb5a
Show file tree
Hide file tree
Showing 713 changed files with 2,717 additions and 1,491 deletions.
4 changes: 2 additions & 2 deletions back/resolvers/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const queries = {
if (gramoConfig.limitNamespaceValue!="" && ns.metadata?.labels != undefined && (ns.metadata?.labels as object)[gramoConfig.limitNamespaceKey] == gramoConfig.limitNamespaceValue) return true;
return false;
}).map((ns)=>{return{
metadata: getMetadata(ns.metadata),
metadata: getMetadata(ns.metadata, ns),
status: {
phase: ns.status?.phase
}
Expand All @@ -50,7 +50,7 @@ export const queries = {
if (gramoConfig.limitNamespaceKey!="" && gramoConfig.limitNamespaceValue!="" && (nsRes.body.metadata?.labels as object)[gramoConfig.limitNamespaceKey] != gramoConfig.limitNamespaceValue) return null;
if (gramoConfig.limitNamespaceKey!="" && gramoConfig.limitNamespaceHave!="" && !(nsRes.body.metadata?.labels as object)[gramoConfig.limitNamespaceKey].split(',').includes(gramoConfig.limitNamespaceHave)) return null;
return {
metadata: getMetadata(nsRes.body.metadata),
metadata: getMetadata(nsRes.body.metadata, nsRes.body),
status: {
phase: nsRes.body.status?.phase
}
Expand Down
4 changes: 3 additions & 1 deletion back/resolvers/core/libs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ kc.loadFromCluster();
export { default as k8s } from '@kubernetes/client-node';


export function getMetadata(meta: k8s.V1ObjectMeta | undefined) {
export function getMetadata(meta: k8s.V1ObjectMeta | undefined, obj: object|undefined = undefined) {
if (meta === undefined) {
return {
obj,
name: "",
annotations: [],
labels: []
}
} else {
return {
obj,
name: meta.name,
namespace: meta.namespace,
annotations: meta.annotations===undefined?[]:Object.entries(meta.annotations).map(([key, val]) => {return {name: key, value: val}}),
Expand Down
4 changes: 2 additions & 2 deletions back/resolvers/core/query.crds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const queries = {
try {
const extRes = await extApi.listCustomResourceDefinition();
return extRes.body.items.map((ext)=>{return{
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
group: ext.spec.group,
scope: ext.spec.scope,
names: ext.spec.names,
Expand All @@ -26,7 +26,7 @@ export const queries = {
try {
const extRes = await extApi.readCustomResourceDefinition(args["name"]);
return {
metadata: getMetadata(extRes.body.metadata),
metadata: getMetadata(extRes.body.metadata, extRes.body),
group: extRes.body.spec.group,
scope: extRes.body.spec.scope,
names: extRes.body.spec.names,
Expand Down
6 changes: 3 additions & 3 deletions back/resolvers/fluxcd/mutation.Alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const mutations = {
const res = await customApi.createNamespacedCustomObject('notification.toolkit.fluxcd.io','v1beta2',args['namespace'],'alerts', payload)
const ext = res.body as FluxcdAlert
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"eventMetadata": ext.spec['eventMetadata'],
"eventSeverity": ext.spec['eventSeverity'],
"eventSources": ext.spec['eventSources'],
Expand Down Expand Up @@ -76,7 +76,7 @@ export const mutations = {
const res = await customApi.patchNamespacedCustomObject('notification.toolkit.fluxcd.io','v1beta2',args['namespace'],'alerts', args['name'], payload, undefined, undefined, undefined, options)
const ext = res.body as FluxcdAlert
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"eventMetadata": ext.spec['eventMetadata'],
"eventSeverity": ext.spec['eventSeverity'],
"eventSources": ext.spec['eventSources'],
Expand All @@ -101,7 +101,7 @@ export const mutations = {
const res = await customApi.deleteNamespacedCustomObject('notification.toolkit.fluxcd.io','v1beta2',args['namespace'],'alerts', args['name'])
const ext = res.body as FluxcdAlert
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"eventMetadata": ext.spec['eventMetadata'],
"eventSeverity": ext.spec['eventSeverity'],
"eventSources": ext.spec['eventSources'],
Expand Down
6 changes: 3 additions & 3 deletions back/resolvers/fluxcd/mutation.Bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const mutations = {
const res = await customApi.createNamespacedCustomObject('source.toolkit.fluxcd.io','v1beta2',args['namespace'],'buckets', payload)
const ext = res.body as FluxcdBucket
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"bucketName": ext.spec['bucketName'],
"endpoint": ext.spec['endpoint'],
Expand Down Expand Up @@ -88,7 +88,7 @@ export const mutations = {
const res = await customApi.patchNamespacedCustomObject('source.toolkit.fluxcd.io','v1beta2',args['namespace'],'buckets', args['name'], payload, undefined, undefined, undefined, options)
const ext = res.body as FluxcdBucket
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"bucketName": ext.spec['bucketName'],
"endpoint": ext.spec['endpoint'],
Expand Down Expand Up @@ -119,7 +119,7 @@ export const mutations = {
const res = await customApi.deleteNamespacedCustomObject('source.toolkit.fluxcd.io','v1beta2',args['namespace'],'buckets', args['name'])
const ext = res.body as FluxcdBucket
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"bucketName": ext.spec['bucketName'],
"endpoint": ext.spec['endpoint'],
Expand Down
6 changes: 3 additions & 3 deletions back/resolvers/fluxcd/mutation.GitRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const mutations = {
const res = await customApi.createNamespacedCustomObject('source.toolkit.fluxcd.io','v1',args['namespace'],'gitrepositories', payload)
const ext = res.body as FluxcdGitRepository
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"ignore": ext.spec['ignore'],
"include": ext.spec['include'],
"interval": ext.spec['interval'],
Expand Down Expand Up @@ -87,7 +87,7 @@ export const mutations = {
const res = await customApi.patchNamespacedCustomObject('source.toolkit.fluxcd.io','v1',args['namespace'],'gitrepositories', args['name'], payload, undefined, undefined, undefined, options)
const ext = res.body as FluxcdGitRepository
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"ignore": ext.spec['ignore'],
"include": ext.spec['include'],
"interval": ext.spec['interval'],
Expand Down Expand Up @@ -119,7 +119,7 @@ export const mutations = {
const res = await customApi.deleteNamespacedCustomObject('source.toolkit.fluxcd.io','v1',args['namespace'],'gitrepositories', args['name'])
const ext = res.body as FluxcdGitRepository
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"ignore": ext.spec['ignore'],
"include": ext.spec['include'],
"interval": ext.spec['interval'],
Expand Down
6 changes: 3 additions & 3 deletions back/resolvers/fluxcd/mutation.HelmChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const mutations = {
const res = await customApi.createNamespacedCustomObject('source.toolkit.fluxcd.io','v1beta2',args['namespace'],'helmcharts', payload)
const ext = res.body as FluxcdHelmChart
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"chart": ext.spec['chart'],
"interval": ext.spec['interval'],
Expand Down Expand Up @@ -86,7 +86,7 @@ export const mutations = {
const res = await customApi.patchNamespacedCustomObject('source.toolkit.fluxcd.io','v1beta2',args['namespace'],'helmcharts', args['name'], payload, undefined, undefined, undefined, options)
const ext = res.body as FluxcdHelmChart
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"chart": ext.spec['chart'],
"interval": ext.spec['interval'],
Expand Down Expand Up @@ -117,7 +117,7 @@ export const mutations = {
const res = await customApi.deleteNamespacedCustomObject('source.toolkit.fluxcd.io','v1beta2',args['namespace'],'helmcharts', args['name'])
const ext = res.body as FluxcdHelmChart
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"chart": ext.spec['chart'],
"interval": ext.spec['interval'],
Expand Down
6 changes: 3 additions & 3 deletions back/resolvers/fluxcd/mutation.HelmRelease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const mutations = {
const res = await customApi.createNamespacedCustomObject('helm.toolkit.fluxcd.io','v2beta1',args['namespace'],'helmreleases', payload)
const ext = res.body as FluxcdHelmRelease
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"chart": ext.spec['chart'],
"dependsOn": ext.spec['dependsOn'],
"install": ext.spec['install'],
Expand Down Expand Up @@ -120,7 +120,7 @@ export const mutations = {
const res = await customApi.patchNamespacedCustomObject('helm.toolkit.fluxcd.io','v2beta1',args['namespace'],'helmreleases', args['name'], payload, undefined, undefined, undefined, options)
const ext = res.body as FluxcdHelmRelease
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"chart": ext.spec['chart'],
"dependsOn": ext.spec['dependsOn'],
"install": ext.spec['install'],
Expand Down Expand Up @@ -165,7 +165,7 @@ export const mutations = {
const res = await customApi.deleteNamespacedCustomObject('helm.toolkit.fluxcd.io','v2beta1',args['namespace'],'helmreleases', args['name'])
const ext = res.body as FluxcdHelmRelease
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"chart": ext.spec['chart'],
"dependsOn": ext.spec['dependsOn'],
"install": ext.spec['install'],
Expand Down
6 changes: 3 additions & 3 deletions back/resolvers/fluxcd/mutation.HelmRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const mutations = {
const res = await customApi.createNamespacedCustomObject('source.toolkit.fluxcd.io','v1beta2',args['namespace'],'helmrepositories', payload)
const ext = res.body as FluxcdHelmRepository
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"interval": ext.spec['interval'],
"passCredentials": ext.spec['passCredentials'],
Expand Down Expand Up @@ -81,7 +81,7 @@ export const mutations = {
const res = await customApi.patchNamespacedCustomObject('source.toolkit.fluxcd.io','v1beta2',args['namespace'],'helmrepositories', args['name'], payload, undefined, undefined, undefined, options)
const ext = res.body as FluxcdHelmRepository
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"interval": ext.spec['interval'],
"passCredentials": ext.spec['passCredentials'],
Expand Down Expand Up @@ -109,7 +109,7 @@ export const mutations = {
const res = await customApi.deleteNamespacedCustomObject('source.toolkit.fluxcd.io','v1beta2',args['namespace'],'helmrepositories', args['name'])
const ext = res.body as FluxcdHelmRepository
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"interval": ext.spec['interval'],
"passCredentials": ext.spec['passCredentials'],
Expand Down
6 changes: 3 additions & 3 deletions back/resolvers/fluxcd/mutation.ImagePolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const mutations = {
const res = await customApi.createNamespacedCustomObject('image.toolkit.fluxcd.io','v1beta2',args['namespace'],'imagepolicies', payload)
const ext = res.body as FluxcdImagePolicy
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"filterTags": ext.spec['filterTags'],
"imageRepositoryRef": ext.spec['imageRepositoryRef'],
"policy": ext.spec['policy'],
Expand Down Expand Up @@ -62,7 +62,7 @@ export const mutations = {
const res = await customApi.patchNamespacedCustomObject('image.toolkit.fluxcd.io','v1beta2',args['namespace'],'imagepolicies', args['name'], payload, undefined, undefined, undefined, options)
const ext = res.body as FluxcdImagePolicy
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"filterTags": ext.spec['filterTags'],
"imageRepositoryRef": ext.spec['imageRepositoryRef'],
"policy": ext.spec['policy'],
Expand All @@ -83,7 +83,7 @@ export const mutations = {
const res = await customApi.deleteNamespacedCustomObject('image.toolkit.fluxcd.io','v1beta2',args['namespace'],'imagepolicies', args['name'])
const ext = res.body as FluxcdImagePolicy
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"filterTags": ext.spec['filterTags'],
"imageRepositoryRef": ext.spec['imageRepositoryRef'],
"policy": ext.spec['policy'],
Expand Down
6 changes: 3 additions & 3 deletions back/resolvers/fluxcd/mutation.ImageRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const mutations = {
const res = await customApi.createNamespacedCustomObject('image.toolkit.fluxcd.io','v1beta2',args['namespace'],'imagerepositories', payload)
const ext = res.body as FluxcdImageRepository
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"certSecretRef": ext.spec['certSecretRef'],
"exclusionList": ext.spec['exclusionList'],
Expand Down Expand Up @@ -85,7 +85,7 @@ export const mutations = {
const res = await customApi.patchNamespacedCustomObject('image.toolkit.fluxcd.io','v1beta2',args['namespace'],'imagerepositories', args['name'], payload, undefined, undefined, undefined, options)
const ext = res.body as FluxcdImageRepository
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"certSecretRef": ext.spec['certSecretRef'],
"exclusionList": ext.spec['exclusionList'],
Expand Down Expand Up @@ -115,7 +115,7 @@ export const mutations = {
const res = await customApi.deleteNamespacedCustomObject('image.toolkit.fluxcd.io','v1beta2',args['namespace'],'imagerepositories', args['name'])
const ext = res.body as FluxcdImageRepository
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"accessFrom": ext.spec['accessFrom'],
"certSecretRef": ext.spec['certSecretRef'],
"exclusionList": ext.spec['exclusionList'],
Expand Down
6 changes: 3 additions & 3 deletions back/resolvers/fluxcd/mutation.ImageUpdateAutomation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const mutations = {
const res = await customApi.createNamespacedCustomObject('image.toolkit.fluxcd.io','v1beta1',args['namespace'],'imageupdateautomations', payload)
const ext = res.body as FluxcdImageUpdateAutomation
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"git": ext.spec['git'],
"interval": ext.spec['interval'],
"sourceRef": ext.spec['sourceRef'],
Expand Down Expand Up @@ -70,7 +70,7 @@ export const mutations = {
const res = await customApi.patchNamespacedCustomObject('image.toolkit.fluxcd.io','v1beta1',args['namespace'],'imageupdateautomations', args['name'], payload, undefined, undefined, undefined, options)
const ext = res.body as FluxcdImageUpdateAutomation
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"git": ext.spec['git'],
"interval": ext.spec['interval'],
"sourceRef": ext.spec['sourceRef'],
Expand All @@ -95,7 +95,7 @@ export const mutations = {
const res = await customApi.deleteNamespacedCustomObject('image.toolkit.fluxcd.io','v1beta1',args['namespace'],'imageupdateautomations', args['name'])
const ext = res.body as FluxcdImageUpdateAutomation
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"git": ext.spec['git'],
"interval": ext.spec['interval'],
"sourceRef": ext.spec['sourceRef'],
Expand Down
6 changes: 3 additions & 3 deletions back/resolvers/fluxcd/mutation.Kustomization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const mutations = {
const res = await customApi.createNamespacedCustomObject('kustomize.toolkit.fluxcd.io','v1',args['namespace'],'kustomizations', payload)
const ext = res.body as FluxcdKustomization
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"commonMetadata": ext.spec['commonMetadata'],
"components": ext.spec['components'],
"decryption": ext.spec['decryption'],
Expand Down Expand Up @@ -115,7 +115,7 @@ export const mutations = {
const res = await customApi.patchNamespacedCustomObject('kustomize.toolkit.fluxcd.io','v1',args['namespace'],'kustomizations', args['name'], payload, undefined, undefined, undefined, options)
const ext = res.body as FluxcdKustomization
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"commonMetadata": ext.spec['commonMetadata'],
"components": ext.spec['components'],
"decryption": ext.spec['decryption'],
Expand Down Expand Up @@ -155,7 +155,7 @@ export const mutations = {
const res = await customApi.deleteNamespacedCustomObject('kustomize.toolkit.fluxcd.io','v1',args['namespace'],'kustomizations', args['name'])
const ext = res.body as FluxcdKustomization
return {
metadata: getMetadata(ext.metadata),
metadata: getMetadata(ext.metadata, ext),
"commonMetadata": ext.spec['commonMetadata'],
"components": ext.spec['components'],
"decryption": ext.spec['decryption'],
Expand Down
Loading

0 comments on commit 8adfb5a

Please sign in to comment.