Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
],
"scripts": {
"clean": "rm -rf ./public/dist",
"dev": "yarn clean && yarn plugin-stats && ts-node -O '{\"module\":\"commonjs\"}' ./node_modules/.bin/webpack --mode development --watch --progress",
"build": "yarn clean && yarn plugin-stats && NODE_ENV=production ts-node -O '{\"module\":\"commonjs\"}' ./node_modules/.bin/webpack --mode=production",
"dev": "yarn clean && ts-node -O '{\"module\":\"commonjs\"}' ./node_modules/.bin/webpack --mode development --watch --progress",
"build": "yarn clean && NODE_ENV=production ts-node -O '{\"module\":\"commonjs\"}' ./node_modules/.bin/webpack --mode=production",
"coverage": "jest --coverage .",
"lint": "eslint --ext .js,.jsx,.ts,.tsx --color .",
"test": "jest",
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/console-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"dependencies": {
"@console/dev-console": "0.0.0-fixed",
"@console/internal": "0.0.0-fixed",
"@console/knative-plugin": "0.0.0-fixed",
"@console/metal3-plugin": "0.0.0-fixed",
"@console/plugin-sdk": "0.0.0-fixed",
"@console/shared": "0.0.0-fixed"
Expand Down
1 change: 1 addition & 0 deletions frontend/packages/dev-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "OpenShift Developer Perspective",
"private": true,
"dependencies": {
"@console/knative-plugin": "0.0.0-fixed",
"@console/plugin-sdk": "0.0.0-fixed"
},
"consolePlugin": {
Expand Down
1 change: 0 additions & 1 deletion frontend/packages/dev-console/src/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './pipelines';
export * from './knative';
14 changes: 0 additions & 14 deletions frontend/packages/dev-console/src/models/knative.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { k8sCreate, K8sResourceKind } from '@console/internal/module/k8s';
import { KsServiceModel } from '../models';
import { ServiceModel } from '@console/knative-plugin';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we move this util as well under knative-plugin, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could. Since the util isn't being used yet and after our discussion I wasn't sure if it was going to be updated to align more closely with the forms apis or not.
For now I'll leave it here and you can move it when you get to completing the work on the import forms.


export const createKnativeService = (
name: string,
Expand Down Expand Up @@ -37,5 +37,5 @@ export const createKnativeService = (
},
};

return k8sCreate(KsServiceModel, knativeDeployResource);
return k8sCreate(ServiceModel, knativeDeployResource);
};
15 changes: 15 additions & 0 deletions frontend/packages/knative-plugin/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
reviewers:
- abhinandan13jan
- debsmita1
- divyanshiGupta
- christianvogt
- joshuawilson
- invincibleJai
- karthikjeeyar
- rohitkrai03
- sahil143
- vikram-raj
approvers:
- christianvogt
- joshuawilson
- rohitkrai03
13 changes: 13 additions & 0 deletions frontend/packages/knative-plugin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@console/knative-plugin",
"version": "0.0.0-fixed",
"description": "Knative - Kubernetes-based platform to build, deploy, and manage modern serverless workloads",
"private": true,
"main": "src/index.ts",
"dependencies": {
"@console/plugin-sdk": "0.0.0-fixed"
},
"consolePlugin": {
"entry": "src/plugin.tsx"
}
}
1 change: 1 addition & 0 deletions frontend/packages/knative-plugin/src/const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const FLAG_KNATIVE_SERVING = 'KNATIVE_SERVING';
2 changes: 2 additions & 0 deletions frontend/packages/knative-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './const';
export * from './models';
66 changes: 66 additions & 0 deletions frontend/packages/knative-plugin/src/models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { K8sKind } from '@console/internal/module/k8s';

export const ConfigurationModel: K8sKind = {
apiGroup: 'serving.knative.dev',
apiVersion: 'v1alpha1',
kind: 'Configuration',
plural: 'configurations',
label: 'Configuration',
labelPlural: 'Configurations',
id: 'configuration',
abbr: 'C',
namespaced: true,
crd: true,
};

export const KnativeServingModel: K8sKind = {
apiGroup: 'serving.knative.dev',
apiVersion: 'v1alpha1',
kind: 'KnativeServing',
label: 'Knative Serving',
labelPlural: 'Knative Servings',
plural: 'knativeservings',
id: 'knativeserving',
abbr: 'KS',
namespaced: true,
crd: true,
};

export const RevisionModel: K8sKind = {
apiGroup: 'serving.knative.dev',
apiVersion: 'v1alpha1',
kind: 'Revision',
label: 'Revision',
labelPlural: 'Revisions',
plural: 'revisions',
id: 'revision',
abbr: 'R',
namespaced: true,
crd: true,
};

export const RouteModel: K8sKind = {
apiGroup: 'serving.knative.dev',
apiVersion: 'v1alpha1',
kind: 'Route',
label: 'Route',
labelPlural: 'Routes',
plural: 'routes',
id: 'route',
abbr: 'R',
namespaced: true,
crd: true,
};

export const ServiceModel: K8sKind = {
apiGroup: 'serving.knative.dev',
apiVersion: 'v1alpha1',
kind: 'Service',
label: 'Service',
labelPlural: 'Services',
plural: 'services',
id: 'service',
abbr: 'S',
namespaced: true,
crd: true,
};
58 changes: 58 additions & 0 deletions frontend/packages/knative-plugin/src/plugin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import * as _ from 'lodash';
import { Plugin, ResourceNSNavItem, ModelFeatureFlag, ModelDefinition } from '@console/plugin-sdk';
import { referenceForModel } from '@console/internal/module/k8s';
import * as models from './models';
import { FLAG_KNATIVE_SERVING } from './const';

type ConsumedExtensions = ResourceNSNavItem | ModelFeatureFlag | ModelDefinition;

const plugin: Plugin<ConsumedExtensions> = [
{
type: 'ModelDefinition',
properties: {
models: _.values(models),
},
},
{
type: 'FeatureFlag/Model',
properties: {
model: models.KnativeServingModel,
flag: FLAG_KNATIVE_SERVING,
},
},
{
type: 'NavItem/ResourceNS',
properties: {
section: 'Serverless',
componentProps: {
name: models.ServiceModel.labelPlural,
resource: referenceForModel(models.ServiceModel),
required: FLAG_KNATIVE_SERVING,
},
},
},
{
type: 'NavItem/ResourceNS',
properties: {
section: 'Serverless',
componentProps: {
name: models.RevisionModel.labelPlural,
resource: referenceForModel(models.RevisionModel),
required: FLAG_KNATIVE_SERVING,
},
},
},
{
type: 'NavItem/ResourceNS',
properties: {
section: 'Serverless',
componentProps: {
name: models.ConfigurationModel.labelPlural,
resource: referenceForModel(models.ConfigurationModel),
required: FLAG_KNATIVE_SERVING,
},
},
},
];

export default plugin;
4 changes: 4 additions & 0 deletions frontend/public/components/nav/admin-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ const AdminNav = () => (
<ResourceNSLink resource="horizontalpodautoscalers" name="Horizontal Pod Autoscalers" />
</NavSection>

{ /* Temporary addition of Knative Serverless section until extensibility allows for section ordering
and admin-nav gets contributed through extensions. */ }
<NavSection title="Serverless" />

<NavSection title="Networking">
<ResourceNSLink resource="services" name="Services" />
<ResourceNSLink resource="routes" name="Routes" required={FLAGS.OPENSHIFT} />
Expand Down