Skip to content

Commit

Permalink
added installation page
Browse files Browse the repository at this point in the history
  • Loading branch information
krisharyan117 committed Nov 9, 2024
1 parent 3dcf47a commit 908c02c
Show file tree
Hide file tree
Showing 35 changed files with 207 additions and 1,187 deletions.
Empty file modified .nvmrc
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kubearmor-rui",
"version": "0.1.1",
"version": "0.1.2",
"private": false,
"engines": {
"node": ">=12"
Expand Down
66 changes: 27 additions & 39 deletions pkg/kubearmor/Dashboard.vue
Original file line number Diff line number Diff line change
@@ -1,64 +1,52 @@
<template>
<Console v-if="hasKubearmor" :url="consoleUrl" />
<Install v-else />
</template>

<script>
import { WORKLOAD_TYPES } from "@shell/config/types";
import Install from "./components/Install.vue";
import Console from "./components/Console.vue";
export default {
name: "Dashboard",
layout: "single",
async beforeMount() {
this.operatorPresence = await this.$store.dispatch(`cluster/findMatching`, {
type: WORKLOAD_TYPES.DEPLOYMENT,
selector: "kubearmor-app=kubearmor-operator",
},{ root: true });
this.consoleUrl = "https://kubearmor.io/";
// type='networking.k8s.io.networkpolicies'
const type= 'security.kubearmor.com.kubearmorpolicy'
if ( this.$store.getters['cluster/canList'](type) ) {
const res1 = await this.$store.dispatch('cluster/findAll', { type });
}
else{
console.log("cannot list")
}
async beforeMount() {
try {
// Check for the KubeArmor operator by name and namespace
const operatorDeployment = await this.$store.dispatch("cluster/find", {
type: WORKLOAD_TYPES.DEPLOYMENT,
id: "kubearmor/kubearmor-operator"
});
// If found, set operatorPresence to true
this.operatorPresence = !!operatorDeployment;
this.consoleUrl = "https://kubearmor.io/";
} catch (error) {
// If not found, operatorPresence remains false
this.operatorPresence = false;
console.error("KubeArmor operator not found:", error);
}
},
components: {
Install,
Console,
},
data() {
return {
consoleUrl: "",
operatorPresence: null,
operatorPresence: false
};
},
computed: {
hasKubearmor() {
return this.operatorPresence;
},
async checkPolicies(){
var type='networking.k8s.io.networkpolicies'
console.log(type)
if ( this.$store.getters['cluster/canList'](type) ) {
const res1 = await this.$store.dispatch('cluster/findAll', { type });
console.log(res1)
}
else{
console.log("cannot list")
}
}
},
}
};
</script>
<template>

<Console v-if="hasKubearmor" :url="consoleUrl" />
<Install v-else />
</template>
2 changes: 1 addition & 1 deletion pkg/kubearmor/chart/kubearmor/_index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default {
<div>
<div class="row mb-20">
<Checkbox
v-model="value['kubewarden-defaults'].recommendedPolicies.enabled"
v-model="value['kubearmor-defaults'].recommendedPolicies.enabled"
label="Enable the Recommended Policies"
tooltip="The chart allows the user to install some recommended policies to enforce some best practice security checks."
/>
Expand Down
16 changes: 8 additions & 8 deletions pkg/kubearmor/chart/kubearmor/admission/General.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Banner } from '@components/Banner';
import { LabeledInput } from '@components/Form/LabeledInput';
import { RadioGroup } from '@components/Form/Radio';
import { KUBEWARDEN, KUBEWARDEN_APPS } from '../../../types';
import { KUBEARMOR} from '../../../types';
export default {
name: 'General',
Expand Down Expand Up @@ -47,8 +47,8 @@ export default {
},
async fetch() {
if ( this.$store.getters['cluster/canList'](KUBEWARDEN.POLICY_SERVER) ) {
await this.$store.dispatch('cluster/findAll', { type: KUBEWARDEN.POLICY_SERVER });
if ( this.$store.getters['cluster/canList'](KUBEARMOR.POLICY_SERVER) ) {
await this.$store.dispatch('cluster/findAll', { type: KUBEARMOR.POLICY_SERVER });
}
},
Expand All @@ -61,9 +61,9 @@ export default {
policy = this.value || {};
}
// fix for https://github.com/rancher/kubewarden-ui/issues/672
// fix for https://github.com/rancher/KUBEARMOR-ui/issues/672
// enforce `default` as namespace for creation of AP's
if ( this.mode === _CREATE && this.chartType === KUBEWARDEN.ADMISSION_POLICY ) {
if ( this.mode === _CREATE && this.chartType === KUBEARMOR.ADMISSION_POLICY ) {
set(policy.metadata, 'namespace', 'default');
}
Expand Down Expand Up @@ -114,11 +114,11 @@ export default {
},
isGlobal() {
return this.chartType === KUBEWARDEN.CLUSTER_ADMISSION_POLICY;
return this.chartType === KUBEARMOR.CLUSTER_ADMISSION_POLICY;
},
modeDisabled() {
// Kubewarden doesn't allow switching a policy from 'protect' to 'monitor'
// KUBEARMOR doesn't allow switching a policy from 'protect' to 'monitor'
if ( !this.isCreate ) {
return this.initialPolicyMode === 'protect';
}
Expand All @@ -131,7 +131,7 @@ export default {
},
policyServers() {
return this.$store.getters['cluster/all'](KUBEWARDEN.POLICY_SERVER);
return this.$store.getters['cluster/all'](KUBEARMOR.POLICY_SERVER);
},
policyServerOptions() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubearmor/chart/kubearmor/admission/SelectorMatch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
<h4>
Match Labels
<i
v-clean-tooltip="t('kubewarden.policyConfig.selector.matchLabels.tooltip')"
v-clean-tooltip="('MatchLabel for Kubearmor')"
class="icon icon-info icon-lg"
/>
</h4>
Expand Down
25 changes: 0 additions & 25 deletions pkg/kubearmor/chart/kubearmor/admission/artifacthubpackages.js

This file was deleted.

9 changes: 0 additions & 9 deletions pkg/kubearmor/chart/kubearmor/admission/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import FileMatch from './FileMatch.vue';
import TagsInput from './TagsInput'
import BasicConfig from './BasicConfig.vue';
import NetworkMatch from './NetworkMatch.vue';
import {artifactHubPackageNames } from './artifacthubpackages'
export default {
props: {
Expand Down Expand Up @@ -88,7 +87,6 @@ export default {
data() {
return {
artifactHubPackageNames,
activeTab: null,
chartValues: null }
;
Expand Down Expand Up @@ -118,16 +116,9 @@ export default {
isCustom() {
return this.customPolicy;
},
isGlobal() {
return this.chartType === KUBEWARDEN.ADMISSION_POLICY;
},
targetNamespace() {
return this.forceNamespace || this.chartValues?.metadata?.namespace || 'default';
},
disabledFile() {
const packageName = this.value.metadata?.name || '';
return this.artifactHubPackageNames.includes(packageName);
}
},
methods: {
Expand Down
83 changes: 83 additions & 0 deletions pkg/kubearmor/components/Console.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<script>
export default {
props: { url: String },
components: {},
data() {
return { computedUrl: `https://${ this.url }/ui` };
},
};
</script>

<template>
<div>
<h2>Overview</h2>
<p>Powered by: <a href="https://clastix.io/" target="_blank">Clastix</a></p>
<a class="card" :href="computedUrl" target="_blank">
<svg
class="open-link"
width="1.5rem"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"
/>
</svg>

<svg
id="E"
xmlns="http://www.w3.org/2000/svg"
width="60px"
viewBox="0 0 800 800"
>
<path
color="currentColor"
d="m400,56.72c-192.15,0-348.5,154.01-348.5,343.26s156.35,343.3,348.5,343.3,348.5-154.01,348.5-343.3S592.15,56.72,400,56.72ZM117.24,267.04c50.56-103.58,158.3-175.27,282.76-175.27s232.2,71.69,282.76,175.27c1.3,2.7-2.31,5.01-4.16,2.7-58.85-74.81-161.62-124.36-278.6-124.36s-219.75,49.55-278.6,124.36c-1.85,2.31-5.46,0-4.16-2.7Zm523.66,20.6c-5.2,5.71-16.79,3.63-25.89-4.65-9.1-8.28-12.26-19.63-7.05-25.34,5.2-5.71,16.79-3.63,25.89,4.65s12.26,19.63,7.05,25.34Zm-46.33-45.12c-5.78,11.64-23.35,14.67-39.24,6.77-15.89-7.9-24.08-23.73-18.3-35.37s23.35-14.67,39.24-6.77c15.89,7.9,24.08,23.73,18.3,35.37Zm-92.35,47.6c0,23.77-19.31,43.11-43.11,43.11s-43.11-19.34-43.11-43.11,19.34-43.11,43.11-43.11,43.11,19.34,43.11,43.11Zm-118.21,0c0,23.77-19.34,43.11-43.11,43.11s-43.14-19.34-43.14-43.11,19.34-43.11,43.14-43.11,43.11,19.34,43.11,43.11Zm217.8,345.57c-54.59,45.22-125.01,72.53-201.8,72.53s-147.21-27.31-201.8-72.53c-2.34-1.98.26-5.66,2.89-4.03,55.37,34.04,124.26,54.23,198.91,54.23s143.54-20.19,198.91-54.23c2.63-1.63,5.23,2.05,2.89,4.03Zm26.95-173.84c.1.03,10.27,3.87,21.62,13.26-4.45-.52-9.53-.94-14.01-.81l-10.01.29,8.03,6.01c.23.16,21.46,16.13,34.92,27.93-15.77-3.12-46.91-8.71-71.75-10.05l-9.2-.46,6.57,6.47c.19.2,19.96,19.9,30.11,42.07-6.4-3.48-15.18-8-21.82-10.34l-7.9-2.76,3.54,7.58c.06.13,5.59,11.9,9.92,21.62-8.75-4.23-22.82-11.02-30.5-14.24l-13.43-5.66,9.36,11.15s15.61,18.5,26.46,31.44c-20.55-7.15-65.77-24.29-82.03-41.68l-17.52-18.73,11.83,22.76c.13.23,11.77,22.53,22.21,39.57-11.18-8.36-26.33-20.29-34.5-29.29l-12.61-13.92,6.76,17.56c.03.13,4.45,11.57,9.56,22.99-21-20.22-62.65-62.23-101.6-112.69l-2.76-3.58-2.76,3.58c-38.95,50.46-80.6,92.46-101.6,112.69,5.1-11.41,9.53-22.86,9.56-22.99l6.76-17.56-12.62,13.92c-8.16,9.01-23.31,20.94-34.5,29.29,10.44-17.04,22.08-39.34,22.21-39.6l11.83-22.73-17.52,18.73c-16.26,17.39-61.48,34.53-82.03,41.68,10.89-12.94,26.47-31.44,26.47-31.44l9.36-11.15-13.43,5.66c-7.51,3.19-20.97,9.62-30.5,14.24,4.32-9.72,9.85-21.49,9.92-21.62l3.54-7.58-7.9,2.76c-6.63,2.34-15.41,6.86-21.82,10.34,10.14-22.17,29.88-41.88,30.11-42.07l6.57-6.47-9.23.46c-24.81,1.33-55.95,6.93-71.72,10.05,13.46-11.8,34.69-27.77,34.92-27.93l8.03-6.01-10.01-.29c-4.45-.13-9.56.29-14.01.81,11.35-9.4,21.52-13.23,21.62-13.26l12.16-4.49-12.75-2.24c-13.79-2.44-40.54-1.5-55.34-.91,17.82-13.56,47.92-28.68,48.22-28.81l6.27-3.15-6.27-3.12c-9.49-4.78-27.86-9.88-41.68-13.36,11.96-.98,23.57-1.11,23.7-1.11l12.39-.13-10.63-6.4c-14.99-8.97-30.79-15.22-41.71-18.95,31.67-4.06,67.24-1.85,67.63-1.82l17.62,1.14-15.87-7.8c-6.01-2.96-12.39-5.62-18.99-8,23.25-3.28,47.6-3.35,47.86-3.35h15.51l-13.98-6.66c-12.48-5.95-35.63-13.53-51.14-18.37,23.93-1.53,45.71-1.95,45.97-1.95l8.81-.16-6.5-5.95c-1.95-1.76-4.39-3.61-7.32-5.56,124.85,12.35,202.26,55.76,203.07,56.21l1.72.98,1.72-.98c.81-.45,78.22-43.86,203.07-56.21-2.93,1.95-5.36,3.8-7.32,5.56l-6.5,5.95,8.81.16c.23,0,22.04.42,45.97,1.95-15.51,4.84-38.66,12.42-51.14,18.37l-13.98,6.66h15.51c.26,0,24.61.07,47.89,3.35-5.2,1.85-11.96,4.52-19.02,8l-15.87,7.8,17.62-1.14c.39-.03,35.93-2.24,67.63,1.82-10.92,3.74-26.72,9.98-41.71,18.95l-10.63,6.4,12.39.13c.13,0,11.74.13,23.7,1.11-13.82,3.48-32.19,8.62-41.68,13.36l-6.27,3.12,6.27,3.15c.29.13,30.4,15.25,48.15,29-14.73-.78-41.49-1.72-55.27.72l-12.74,2.24,12.16,4.49Z"
/>
</svg>
<div>
<h3>Kamaji Console</h3>
<p>
Deploys and operates Kubernetes Control Plane at scale with a fraction
of the operational burden
</p>
</div>
</a>
</div>
</template>

<style lang="scss" scoped>
.card {
background-color: white;
color: black !important;
position: relative;
color: inherit;
text-decoration: none;
margin-top: 10px;
border: 1px solid #eee;
border-radius: 1rem;
padding: 1rem;
border-left: 1rem solid lightblue;
display: grid;
grid-template-columns: auto 1fr;
gap: 10px;
max-width: 30rem;
&:hover {
background-color: lightblue;
}
h3 {
color: black;
}
.open-link {
position: absolute;
top: 1rem;
right: 1rem;
}
}
</style>
2 changes: 1 addition & 1 deletion pkg/kubearmor/components/Policies/Configged.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default {
{{ shortDescription }}
</p>
<button v-if="policyReadme" class="btn btn-sm role-link banner__readme-button" @click="showReadme">
{{ t('kubewarden.policyConfig.description.showReadme') }}
{{ ('Show Readme') }}
</button>
</template>
</div>
Expand Down
4 changes: 2 additions & 2 deletions pkg/kubearmor/components/Policies/Created.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Wizard from '@shell/components/Wizard';
import { DATA_ANNOTATIONS } from '../../types/artifacthub';
import PolicyTable from '../../components/Policies/PolicyTable.vue';
import { handleGrowl } from '../../utils/handle-growl';
import { ARTIFACTHUB_ENDPOINT, ARTIFACTHUB_PKG_ANNOTATION, VALUES_STATE, KUBEARMOR_PRODUCT_NAME, KUBEWARDEN, DEFAULT_POLICY } from '../../types';
import { ARTIFACTHUB_ENDPOINT, VALUES_STATE, KUBEARMOR, DEFAULT_POLICY } from '../../types';
import PolicyReadmePanel from '../../components/Policies/PolicyReadmePanel.vue';
import Values from '../../components/Policies/Values.vue';
import { removeEmptyAttrs } from '../../utils/object';
Expand Down Expand Up @@ -362,7 +362,7 @@ export default {
} else {
merge(this.value, out);
}
if (this.chartType === KUBEWARDEN.ADMISSION_POLICY && this.chartValues?.isNamespaceNew) {
if (this.chartType === KUBEARMOR.ADMISSION_POLICY && this.chartValues?.isNamespaceNew) {
await this.createNamespace(this.value?.metadata?.namespace);
}
// Attempt to save the policy
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubearmor/components/Policies/PolicyList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default {
type="button"
@click="resetFilter"
>
{{ t('kubewarden.utils.resetFilter') }}
{{ ('Reset Filter') }}
</button>
</div>
Expand Down
4 changes: 2 additions & 2 deletions pkg/kubearmor/components/Policies/Values.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import ResourceCancelModal from '@shell/components/ResourceCancelModal';
import Tabbed from '@shell/components/Tabbed';
import YamlEditor, { EDITOR_MODES } from '@shell/components/YamlEditor';
import { ARTIFACTHUB_ENDPOINT, ARTIFACTHUB_PKG_ANNOTATION,KUBEWARDEN_CHARTS, VALUES_STATE, YAML_OPTIONS } from '../../types';
import { ARTIFACTHUB_ENDPOINT, ARTIFACTHUB_PKG_ANNOTATION,KUBEARMOR_CHARTS, VALUES_STATE, YAML_OPTIONS } from '../../types';
export default {
name: 'Values',
Expand Down Expand Up @@ -49,7 +49,7 @@ export default {
this.version = this.$store.getters['catalog/version']({
repoType: 'cluster',
repoName: 'kubearmor',
chartName: KUBEWARDEN_CHARTS.CONTROLLER,
chartName: KUBEARMOR_CHARTS.CONTROLLER,
});
await this.loadValuesComponent();
} catch (e) {
Expand Down
Loading

0 comments on commit 908c02c

Please sign in to comment.