Skip to content
This repository was archived by the owner on Oct 10, 2023. It is now read-only.

Commit e32cab8

Browse files
authored
update secret registry readme (#1034)
* update secret registry README Signed-off-by: Marjan Alavi <malavi@vmware.com>
1 parent 76042d0 commit e32cab8

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

cmd/cli/plugin/secret/README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,123 @@ the "secret registry" can be used to:
171171
Updated registry secret 'test-secret' in namespace 'test-ns'
172172
Unexported registry secret 'test-secret' from all namespaces
173173
```
174+
175+
## Workflow for adding a private package repository and installation of a private package
176+
177+
You can add a private package repository and install a private package using the following procedure:
178+
179+
1. First, create the namespace in which the secret is getting added to:
180+
181+
```sh
182+
kubectl create namespace <NAMESPACE>
183+
```
184+
185+
2. Before adding a private package repository, registry secret should be added to the cluster. If you are planning to add the private repository in the same namespace as the registry secret, it suffices to run the following command. Otherwise, please use step '3.a'.
186+
187+
```sh
188+
tanzu secret registry add <SECRET-NAME> --server <PRIVATE-REGISTRY> --username <USERNAME> --namespace <SECRET-NAMESPACE> --password <PASSWORD>
189+
```
190+
191+
The output would be as follows:
192+
193+
```sh
194+
- Adding registry secret '<SECRET-NAME>'...
195+
Added registry secret '<SECRET-NAME>' into namespace '<SECRET-NAMESPACE>'
196+
```
197+
198+
3. In case you want to add the private repository in a different namespace than the namespace in which the secret was added to, you need to export the secret to all other namespaces. Please be aware that by doing so, the given secret contents will be available to ALL users in ALL namespaces. Please ensure that included registry credentials allow only read-only access to the registry with minimal necessary scope. You can export the secret to other namespaces using one of the following options:
199+
200+
a. You can export the secret to all other namespaces at the time of adding the secret:
201+
202+
```sh
203+
tanzu secret registry add <SECRET-NAME> --server <PRIVATE-REGISTRY> --username <USERNAME> --namespace <SECRET-NAMESPACE> --password <PASSWORD> --export-to-all-namespaces=true -y
204+
```
205+
206+
The output would be as follows:
207+
208+
```sh
209+
- Adding registry secret '<SECRET-NAME>'...
210+
Added registry secret '<SECRET-NAME>' into namespace '<SECRET-NAMESPACE>'
211+
Exported registry secret '<SECRET-NAME>' to all namespaces
212+
```
213+
214+
b. Alternatively, you can update an existing secret to export it to all other namespaces:
215+
216+
```sh
217+
tanzu secret registry update <SECRET-NAME> --namespace <SECRET-NAMESPACE> --export-to-all-namespaces=true -y
218+
```
219+
220+
The output would be as follows:
221+
222+
```sh
223+
\ Updating registry secret '<SECRET-NAME>'...
224+
Updated registry secret '<SECRET-NAME>' in namespace '<SECRET-NAMESPACE>'
225+
Exported registry secret '<SECRET-NAME>' to all namespaces
226+
```
227+
228+
4. Add the private package repository to the target namespace in which you want to install the private package by running:
229+
230+
```sh
231+
tanzu package repository add <REPOSITORY-NAME> --url <REPOSITORY-URL> --namespace <TARGET-NAMESPACE> --create-namespace
232+
```
233+
234+
The output of the command would be as follows:
235+
236+
```sh
237+
- Adding package repository '<REPOSITORY-NAME>'
238+
| Validating provided settings for the package repository
239+
\ Creating namespace '<TARGET-NAMESPACE>'
240+
| Creating package repository resource
241+
\ Waiting for 'PackageRepository' reconciliation for '<REPOSITORY-NAME>'
242+
/ 'PackageRepository' resource install status: Reconciling
243+
244+
Added package repository '<REPOSITORY-NAME>' in namespace '<TARGET-NAMESPACE>'
245+
```
246+
247+
5. Verify that the private package repository has been successfully added to the target namespace by running. You should ensure that the status field be 'Reconcile succeeded':
248+
249+
```sh
250+
tanzu package repository get <REPOSITORY-NAME> --namespace <TARGET-NAMESPACE>
251+
```
252+
253+
6. List the available packages by running:
254+
255+
```sh
256+
tanzu package available list --namespace <TARGET-NAMESPACE>
257+
```
258+
259+
7. List version information for the package by running:
260+
261+
```sh
262+
tanzu package available list <PACKAGE-NAME> --namespace <TARGET-NAMESPACE>
263+
```
264+
265+
8. Install the private package with a specific version:
266+
267+
```sh
268+
tanzu package installed create <INSTALLED-PACKAGE-NAME> --package-name <PACKAGE-NAME> --version <PACKAGE-VERSION> --namespace <TARGET-NAMESPACE>
269+
```
270+
271+
Please follow the specific installation instructions for the package in case additional configuration parameters are needed
272+
273+
The output of the command would be as follows:
274+
275+
```sh
276+
- Installing package '<PACKAGE-NAME>'
277+
| Getting package metadata for '<PACKAGE-NAME>'
278+
| Creating namespace '<TARGET-NAMESPACE>'
279+
| Creating service account '<INSTALLED-PACKAGE-NAME>-<TARGET-NAMESPACE>-sa'
280+
| Creating cluster admin role '<INSTALLED-PACKAGE-NAME>-<TARGET-NAMESPACE>-cluster-role'
281+
| Creating cluster role binding '<INSTALLED-PACKAGE-NAME>-<TARGET-NAMESPACE>-cluster-rolebinding'
282+
| Creating package resource
283+
- Waiting for 'PackageInstall' reconciliation for '<INSTALLED-PACKAGE-NAME>'
284+
- 'PackageInstall' resource install status: Reconciling
285+
286+
Added installed package '<INSTALLED-PACKAGE-NAME>'
287+
```
288+
289+
9. Verify the successful package installation by running:
290+
291+
```sh
292+
tanzu package installed get <INSTALLED-PACKAGE-NAME> --namespace <TARGET-NAMESPAC>
293+
```

0 commit comments

Comments
 (0)