Skip to content

Commit f90ab55

Browse files
authored
vscode-extension - migrating vscode-extension from ocm-io org to lab repo (#30)
Signed-off-by: Mike Ng <[email protected]>
1 parent c861bc9 commit f90ab55

File tree

105 files changed

+5531
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+5531
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ For new add-on projects, please use the
2929

3030
- [dashboard](./dashboard/README.md): OCM UI Dashboard.
3131
- [fleetconfig-controller](./fleetconfig-controller/README.md): Declarative orchestrator for OCM multi-clusters.
32+
- [vscode-extension](./vscode-extension/README.md): OCM VScode extension.
3233

3334
## Onboarding a New Project
3435

vscode-extension/.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_size = 4
9+
indent_style = tab
10+
max_line_length = 100
11+
12+
[**.{yaml,yml}]
13+
indent_size = 2
14+
indent_style = space
15+
16+
[**.md]
17+
indent_size = 2
18+
indent_style = space
19+
max_line_length = 120

vscode-extension/.eslintrc.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"root": true,
3+
"extends": "eslint:recommended",
4+
"parser": "@typescript-eslint/parser",
5+
"parserOptions": {
6+
"project": "./tsconfig.json"
7+
},
8+
"plugins": [
9+
"@typescript-eslint"
10+
],
11+
"rules": {
12+
"@typescript-eslint/adjacent-overload-signatures": "error",
13+
"@typescript-eslint/await-thenable": "error",
14+
//"@typescript-eslint/ban-ts-comment": "warn",
15+
"@typescript-eslint/no-empty-interface": "error",
16+
"@typescript-eslint/no-extra-non-null-assertion": "error",
17+
"@typescript-eslint/no-for-in-array": "error",
18+
"@typescript-eslint/no-misused-new": "error",
19+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
20+
"@typescript-eslint/no-non-null-assertion": "warn",
21+
"@typescript-eslint/no-this-alias": "error",
22+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
23+
"@typescript-eslint/no-unnecessary-type-constraint": "error",
24+
"@typescript-eslint/no-var-requires": "error",
25+
"@typescript-eslint/prefer-as-const": "error",
26+
"@typescript-eslint/prefer-namespace-keyword": "error",
27+
"@typescript-eslint/restrict-plus-operands": "error",
28+
"@typescript-eslint/restrict-template-expressions": "error",
29+
"@typescript-eslint/triple-slash-reference": "error",
30+
"@typescript-eslint/unbound-method": "error",
31+
"@typescript-eslint/explicit-function-return-type": "warn",
32+
"@typescript-eslint/naming-convention": "warn",
33+
"@typescript-eslint/semi": "warn",
34+
"curly": "warn",
35+
"eqeqeq": "warn",
36+
"no-async-promise-executor": "off",
37+
"no-throw-literal": "warn",
38+
"no-undef":"off",
39+
"no-unused-vars": "off",
40+
"sort-imports":"warn"
41+
},
42+
"ignorePatterns": [
43+
"out",
44+
"dist",
45+
"**/*.d.ts"
46+
]
47+
}

vscode-extension/OWNERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
approvers:
2+
- ilan-pinto
3+
- TomerFi
4+
- vbelouso
5+
6+
reviewers:
7+
- ilan-pinto
8+
- TomerFi
9+
- vbelouso

vscode-extension/README.md

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# OCM VScode Extension
2+
3+
In the process of migrating from https://github.com/open-cluster-management-io/ocm-vscode-extension
4+
5+
OCM VScode Extension is a UI tool for OCM related Kubernetes resources that has been built upon Visual Studio Code and offers additional OCM administrative and monitoring features in order to improve operational efficiency and accelerate development within engineering teams.
6+
7+
Get a full introduction to [OCM VScode Extension on YOUTUBE][youtube-ocm-vscode-ext-intro]
8+
9+
<br><div>
10+
<img src="images/ocm-vscode-ext-intro.gif" alt="Create Local Environment" style="margin: 0 auto; width: 1264px">
11+
</div><br>
12+
13+
- [OCM VScode Extension](#ocm-vscode-extension)
14+
- [Prerequisites](#prerequisites)
15+
- [Installation](#installation)
16+
- [Install Latest version](#install-latest-version)
17+
- [Install specific version](#install-specific-version)
18+
- [Features](#features)
19+
- [Resources Snippets](#resources-snippets)
20+
- [Bootstrap Project](#bootstrap-project)
21+
- [Create Local Environment](#create-local-environment)
22+
- [Manage Existing Resources](#manage-existing-resources)
23+
- [Recommendations](#recommendations)
24+
- [Contributing](#contributing)
25+
26+
<br>
27+
28+
## Prerequisites
29+
30+
You must meet the following prerequisites to install OCM VScode Extension:
31+
32+
* Ensure your [`Visual Studio Code`][install-vscode] release is at least `v1.71.0`.
33+
34+
You must meet some additional prerequisites to utilize OCM VScode Extension features:
35+
36+
| Feature | Prerequisites |
37+
| ------- | ------------ |
38+
| Resources Snippets | None |
39+
| Bootstrap Project | None |
40+
| Manage Existing Resources | [kubectl][install-kubectl] |
41+
| Create Local Environment | [kubectl][install-kubectl], [clusteradm][install-clusteradm], [kind][install-kind] |
42+
43+
<br>
44+
45+
## Installation
46+
47+
### Install Latest version
48+
In your VScode instance, go to the _Extensions Marketplace_ (by clicking on the _Extensions_ icon in the composite bar on the left hand side or simply pressing Ctrl+Shift+X on your keyboard).
49+
50+
Search for _OCM Extension_ and click install.
51+
52+
### Install specific version
53+
To download a specific version of VScode Extension visit the [releases page][releases], expand the _Assets_ section of the target version,
54+
and download the version for your operating system.
55+
56+
In your VScode instance, go to the _Extensions Marketplace_ (by clicking on the _Extensions_ icon in the composite bar on the left hand side or simply pressing Ctrl+Shift+X on your keyboard).
57+
58+
Click the **...** at the top right corner of the palette, select the _Install from VSIX..._ action, and browse for the specific _VSIX_ file you downloaded.
59+
60+
Select a _VSIX_ file and hit install.
61+
62+
<br>
63+
64+
## Features
65+
66+
### Resources Snippets
67+
68+
OCM VScode Extension allows users to load Custom Resource (CR) snippets from the command palette.
69+
70+
The resources available as snippets are:
71+
* Subscription
72+
* Placement
73+
* Channel
74+
* ManagedClusterSet
75+
* ManagedClusterSetBinding
76+
77+
Subscription snippets are available specifically tailored to either Git, Helm or ObjectBucket.
78+
79+
To exercise this feature you must take the following steps:
80+
1. Create a new yaml file in a desired path
81+
2. Open the file and press Ctrl+Shift+P on your keyboard
82+
3. In the search container at the top of your screen choose _Snippets: Insert Snippet_
83+
4. Choose a desired snippet from list
84+
85+
<br><div>
86+
<img src="images/snippets-from-palette.gif" alt="Resources Snippets">
87+
</div><br>
88+
89+
### Bootstrap Project
90+
91+
Another valuable feature of OCM VScode Extension is to create a Bootstrap project for the various channel types.
92+
93+
The Bootstrap project is basically a collection of snippets, customized to fit one of three channel types - Git, Helm or ObjectBucket, that form a project template for you to build upon.
94+
95+
To exercise this feature you must take the following steps:
96+
1. Press Ctrl+Shift+P on your keyboard
97+
2. In the search container at the top of your screen choose _OCM: Create an application-manager project_
98+
3. Choose a desired channel type
99+
4. Type in a project name and hit enter
100+
101+
<br><div>
102+
<img src="images/new-project.gif" alt="Bootstrap Project">
103+
</div><br>
104+
105+
106+
### Create Local Environment
107+
108+
The Create Local Environment feature allows you to create a quick OCM multi-cluster control plane on a local [kind][kind] environment with only a click of a button.
109+
110+
The feature does it all for you:
111+
- Verifies the existence of the required tools.
112+
- Creates as many [kind][kind] clusters as you need (customizable).
113+
- Initializes the _hub cluster_ by installing a [Cluster Manager][cluster-manager] using [clusteradm][clusteradm], and [kubectl][install-kubectl].
114+
- Installs a [Klusterlet][klusterlet] agent on the _managed clusters_ and sends join requests to the _hub cluster_ using [clusteradm][clusteradm], and [kubectl][install-kubectl].
115+
- Accepts the join requests from the _hub cluster_ using [clusteradm][clusteradm], and [kubectl][install-kubectl].
116+
117+
To exercise this feature you must take the following steps:
118+
1. Click on the _OCM_ icon in the composite bar on the left hand side to open OCM VScode Extension control pane
119+
2. Locate the _Create Local Environment_ button in the _Developers Tools_ section and give it a click
120+
3. Notice that at the top of your screen an action container will prompt you to choose between default or custom configuration
121+
4. After configuration was specified, a progress bar at the botom right of your screen will provide feadback on the build process
122+
123+
<br><div>
124+
<img src="images/create-local-env.gif" alt="Create Local Environment" style="margin: 0 auto; width: 1264px">
125+
</div><br>
126+
127+
### Manage Existing Resources
128+
129+
The Manage Existing Resources feature provides a wide and detailed overview of all the resources residing in any one cluster.
130+
131+
To exercise this feature you must take the following steps:
132+
1. Access the _Cluster Details_ tab either by:
133+
* Pressing Ctrl+Shift+P on your keyboard and choosing _OCM-View: Cluster Details_ in the search container at the top of your screen
134+
* Clicking on the _OCM_ icon in the composite bar on the left hand side to open OCM VScode Extension control pane, locating the _Connected Clusters_ section and selecting any cluster in the list
135+
2. Inside the _Cluster Details_ tab, use the dropdown to select any cluster from the list of availabe clusters in order to view the resources within it
136+
137+
<br><div>
138+
<img src="images/mng-existing-resources.gif" alt="Create Local Environment" style="margin: 0 auto; width: 1264px">
139+
</div><br>
140+
141+
## Recommendations
142+
143+
Take a look at some other great VScode extensions to improve your OCM experience!
144+
145+
* [Visual Studio Code Kubernetes Tools][ext-kubernetes]
146+
* [OpenShift Toolkit][ext-openshift-toolkit]
147+
* [YAML Language Support][ext-yaml]
148+
149+
To install the recommended VScode extensions, please visit the _Extensions Marketplace_ (by clicking on the _Extensions_ icon in the composite bar on the left hand side or simply pressing Ctrl+Shift+X on your keyboard).
150+
151+
<br>
152+
153+
## Contributing
154+
155+
See our [Contributing Guidelines][repo-contribute] for more information.
156+
157+
<br>
158+
159+
<!-- LINKS -->
160+
[ocm-io]: https://open-cluster-management.io/
161+
[install-vscode]: https://code.visualstudio.com/download
162+
[install-kubectl]: https://kubernetes.io/docs/tasks/tools/install-kubectl
163+
[install-kind]: https://kind.sigs.k8s.io/docs/user/quick-start/
164+
[install-clusteradm]:https://github.com/open-cluster-management-io/clusteradm
165+
[releases]: https://github.com/open-cluster-management-io/ocm-vscode-extension/releases
166+
[kind]: https://kind.sigs.k8s.io/
167+
[cluster-manager]: https://operatorhub.io/operator/cluster-manager
168+
[clusteradm]: https://github.com/open-cluster-management-io/clusteradm
169+
[klusterlet]: https://operatorhub.io/operator/klusterlet
170+
[repo-contribute]: https://github.com/open-cluster-management-io/ocm-vscode-extension/contribute
171+
[ext-yaml]:https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml
172+
[ext-openshift-toolkit]:https://marketplace.visualstudio.com/items?itemName=redhat.vscode-openshift-connector
173+
[ext-kubernetes]:https://marketplace.visualstudio.com/items?itemName=ms-kubernetes-tools.vscode-kubernetes-tools
174+
[youtube-ocm-vscode-ext-intro]:https://www.youtube.com/watch?v=3WATGbheqbQ

0 commit comments

Comments
 (0)