If you have plug-ins stored in a private registry that you want to include in your customized Tanzu Developer Portal, you can configure Configurator in the tdp-config.yaml
file.
CautionThis feature is in the alpha stage. Do not use this feature in a production environment.
Use one of two methods to configure Configurator:
tpb
configurationIn your tdp-config.yaml
file, add a registry.uplinks
section to include your private registry. Add the auth
property to the registry.uplinks
section, as seen in the Verdaccio documentation.
Use an authentication token with the uplink by using one of three methods:
You cannot create an uplink with the name tpb
or npmjs
because these packages are reserved and cannot be overridden.
In your tdp-config.yaml
file, add a registry.packages
section. This section lists access rules for different packages. For more information about this section, see the Verdaccio documentation. You cannot create a package with the name @tpb/*
because these packages are reserved and cannot be overridden.
Here is a full example that directly specifies the authentication token in the configuration file:
registry:
uplinks:
private-registry:
url: PRIVATE-REGISTRY-ENDPOINT
auth:
type: bearer
token: VALID-TOKEN-FOR-PRIVATE-REGISTRY
packages:
'@company/*':
access: $all
proxy: private-registry
app:
plugins:
- name: '@tpb/plugin-hello-world'
backend:
plugins:
- name: '@tpb/plugin-hello-world-backend'
This configuration instructs to download any package with the scope @company
from the private-registry
registry with the specified credentials.
Create a secret resource that will contain the private registry token. For example:
apiVersion: v1
kind: Secret
metadata:
namespace: DEVELOPER-NAMESPACE
name: private-registry
data:
registry_token: A-TOKEN
Where A-TOKEN
is the token value encoded in Base64.
In your tdp-config.yaml
file, add a registry.uplinks
section to include your private registry. Add the auth
property to the registry.uplinks
section, as seen in the Verdaccio documentation, to use an authentication token with an uplink.
You cannot create an uplink with the name tpb
or npmjs
because these uplinks are reserved and cannot be overridden.
In your tdp-config.yaml
file, add a registry.packages
section. This section lists access rules for different packages. For more information about this section, see the Verdaccio documentation.
You cannot create a package with the name @tpb/*
because these packages are reserved and cannot be overridden.
Here is the full example that uses an NPM_TOKEN
environment variable:
registry:
uplinks:
private:
url: PRIVATE-REGISTRY-ENDPOINT
auth:
type: bearer
token_env: NPM_TOKEN
packages:
'@company/*':
access: $all
proxy: private
app:
plugins:
- name: '@company/company-plugin'
backend:
plugins:
- name: '@company/company-plugin-backend'
This configuration instructs to download any package with the scope @company
from the private-registry
registry with the specified credentials.
Populate the environment variable value with the secret value in the workload file:
apiVersion: carto.run/v1alpha1
kind: Workload
# ... remaining of the workload file
spec:
build:
env:
- name: NPM_TOKEN
valueFrom:
secretKeyRef:
key: registry_token
name: private-registry
# ... remaining of the workload file
By default, Configurator redirects all the external requests to npmjs
. If, for some reason, you need to redirect those requests to your private registry, edit the registry.packages
section as follows:
registry:
uplinks:
private:
url: PRIVATE-REGISTRY-ENDPOINT
auth:
type: bearer
token_env: NPM_TOKEN
packages:
'**':
access: $all
proxy: private