Skip to content

Commit fbd81b0

Browse files
author
edge-katanomi-app2[bot]
committed
📚 Sync docs from alaudadevops/connectors-operator on 55ab7606030e95ec0991f8e7f364963466865202
Source: feat(connectors): add NPM connector support (#267) Author: kycheng Ref: refs/heads/main Commit: 55ab7606030e95ec0991f8e7f364963466865202 This commit automatically syncs documentation changes from the source-docs repository. 🔗 View source commit: https://github.com/alaudadevops/connectors-operator/commit/55ab7606030e95ec0991f8e7f364963466865202 🤖 Synced on 2025-11-04 01:39:45 UTC
1 parent 537ead8 commit fbd81b0

File tree

18 files changed

+1189
-13
lines changed

18 files changed

+1189
-13
lines changed

‎.github/SYNC_INFO.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Documentation Sync Information
22

3-
- **Last synced**: 2025-10-24 10:20:31 UTC
3+
- **Last synced**: 2025-11-04 01:39:45 UTC
44
- **Source repository**: alaudadevops/connectors-operator
5-
- **Source commit**: [dfe55c2a5de413ef5aec931197b06af3426004a1](https://github.com/alaudadevops/connectors-operator/commit/dfe55c2a5de413ef5aec931197b06af3426004a1)
5+
- **Source commit**: [55ab7606030e95ec0991f8e7f364963466865202](https://github.com/alaudadevops/connectors-operator/commit/55ab7606030e95ec0991f8e7f364963466865202)
66
- **Triggered by**: edge-katanomi-app2[bot]
7-
- **Workflow run**: [#44](https://github.com/alaudadevops/connectors-operator/actions/runs/18776845356)
7+
- **Workflow run**: [#45](https://github.com/alaudadevops/connectors-operator/actions/runs/19054977264)
88

99
## Files synced:
1010
- docs/

‎docs/en/connectors-npm/.gitkeep‎

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
development/**
2+
keps/**
3+
godocs/**
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
weight: 40
3+
i18n:
4+
title:
5+
en: Concepts
6+
title: Concepts
7+
---
8+
9+
# NPM Connector
10+
11+
<Overview />
Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
---
2+
weight: 20
3+
---
4+
5+
# NPM Connector
6+
7+
The NPM connector is a platform-agnostic connector that you can use to connect to any NPM registry.
8+
9+
You can use the NPM Connector to securely perform NPM operations in CICD pipelines, or use it in kubernetes workloads to perform NPM operations without credentials.
10+
11+
Additionally, you can centralize the management of NPM access configurations across namespaces, avoiding the need to repeat the NPM credentials in each namespace.
12+
13+
## Overview
14+
15+
This document covers:
16+
17+
- **Integration Requirements**: Prerequisites for target NPM registries
18+
- **Creating NPM connector**
19+
- **Advanced Features**: Proxy capabilities and configuration capabilities about NPM connector
20+
21+
## Integration Requirements
22+
23+
**NPM Registries Prerequisites**
24+
25+
- The NPM registry must be able to support [NPM Registry API](https://github.com/npm/registry/blob/main/docs/REGISTRY-API.md)
26+
27+
## Creating a simple NPM connector
28+
29+
Here's how to create a basic NPM Connector:
30+
31+
```yaml
32+
# NPM Connector
33+
apiVersion: connectors.alauda.io/v1alpha1
34+
kind: Connector
35+
metadata:
36+
name: npm-connector
37+
spec:
38+
connectorClassName: npm
39+
address: https://registry.npmjs.org
40+
```
41+
42+
## Fields Reference
43+
44+
**spec.connectorClassName**:
45+
46+
`npm` (constant), specifies the ConnectorClass name for NPM integration.
47+
48+
**spec.address**:
49+
50+
Target NPM registry address, for example: `https://registry.npmjs.org`.
51+
52+
When using Nexus as the npm registry, you need to configure the repository address, for example: `https://nexus.example.com/repository/npm-public`.
53+
54+
**spec.auth(optional)**:
55+
56+
specifies the authentication method of the NPM registry
57+
58+
- `spec.auth.name`: should be `basicAuth` for NPM connector.
59+
60+
- `spec.auth.secretRef`: specifies the secret that contains the authentication information of the NPM registry, the secret should be created in the same namespace as the connector. If your NPM registry does not require authentication, you can omit this field.
61+
62+
**Optional Metadata fields**:
63+
64+
- `cpaas.io/description`: Description information for the NPM connector, for example:
65+
66+
```yaml
67+
apiVersion: connectors.alauda.io/v1alpha1
68+
kind: Connector
69+
metadata:
70+
name: npm-connector
71+
annotations:
72+
cpaas.io/description: "Connect to team development NPM registry"
73+
```
74+
75+
## Capabilities of NPM Connector
76+
77+
### Authentication
78+
79+
The NPM connector supports the following authentication types:
80+
81+
- `basicAuth`: Username and password-based authentication, corresponding secret type: `kubernetes.io/basic-auth`
82+
83+
For example:
84+
85+
```yaml
86+
apiVersion: v1
87+
stringData:
88+
username: your-npm-registry-username
89+
password: your-npm-registry-password
90+
kind: Secret
91+
metadata:
92+
name: npm-secret
93+
type: kubernetes.io/basic-auth
94+
```
95+
96+
For comprehensive status information, see [Connector Status Documentation](../../connectors/concepts/connector.mdx#status-information).
97+
98+
If the NPM registry does not require authentication, you can omit the `secretRef` field:
99+
100+
```yaml
101+
apiVersion: connectors.alauda.io/v1alpha1
102+
kind: Connector
103+
metadata:
104+
name: npm-connector
105+
spec:
106+
connectorClassName: npm
107+
address: https://registry.npmjs.org
108+
auth:
109+
name: basicAuth
110+
```
111+
112+
#### Credential Permissions Required \{#credential_permissions_required}
113+
114+
The required permissions for the configured credential depend on how you intend to use it in your Pods/Pipelines.
115+
116+
For example:
117+
- **Package operations**: If you only need to download dependencies using `npm install`, the credential only require read permissions for the target NPM repository.
118+
- **Package and Deploy operations**: If you need to publish artifacts using `npm publish`, the credentials must have both read and write permissions for the target repository.
119+
120+
For security best practices, we recommend creating credentials with minimal required permissions. When additional privileges are needed, create separate Connectors with more privileged secret and use namespace isolation to control which users can access each Connector.
121+
122+
### NPM Connector Proxy and Configuration with npmrc and yarnrc.yml files
123+
124+
To provide clients with the ability to access NPM registry without credentials, the NPM connector provides a proxy server to automatically inject authentication information.
125+
126+
Clients can use this proxy server to access NPM registry without needing to configure credentials on the client side.
127+
128+
To simplify usage, the NPM connectorclass provides `.npmrc` and `.yarnrc.yml` files that can be mounted into Pods via CSI. In the Pod, when executing NPM operations, the proxy service can automatically inject authentication information.
129+
130+
:::warning
131+
The `.yarnrc.yml` file is only supported in the Yarn 2.x version.
132+
:::
133+
134+
#### Proxy Address
135+
136+
Upon Connector creation, the system automatically provisions a proxy service for the target NPM registry.
137+
138+
The proxy endpoint is recorded in `status.proxy.httpAddress`:
139+
140+
For example:
141+
142+
```yaml
143+
apiVersion: connectors.alauda.io/v1alpha1
144+
kind: Connector
145+
metadata:
146+
name: npm-connector
147+
spec:
148+
# connector spec fields
149+
status:
150+
conditions:
151+
# status conditions
152+
proxy:
153+
httpAddress:
154+
url: http://c-npm-connector.default.svc.cluster.local
155+
```
156+
157+
#### .npmrc configuration file \{#npmrc-configuration-file}
158+
159+
The NPM connector provides the following configuration:
160+
161+
**.npmrc**:
162+
163+
- Provides a `.npmrc` configuration file. Combined with the connector-csi-driver, this configuration file will be mounted into the Pod, allowing access to the NPM registry through the proxy without needing to configure credentials on the client side.
164+
165+
Example of the configuration file generated in the Pod:
166+
167+
```yaml
168+
# NPM Registry Configuration
169+
registry=http://npm-registry.example.com/
170+
171+
# The authentication token is fake, because the connector will not use it, it will be used for proxy requests.
172+
//npm-registry.example.com/:_auth=fAd326jYkI123456789xxx
173+
174+
# Set the connector proxy URL for npm registry access
175+
https-proxy=http://connector-ns%2Fconnector-name:[email protected]/
176+
proxy=http://connector-ns%2Fconnector-name:[email protected]/
177+
178+
# Disable strict SSL verification for internal registries
179+
strict-ssl=false
180+
181+
# Disable npm audit to avoid security warnings during CI/CD
182+
audit=false
183+
184+
# Disable funding messages to reduce output noise
185+
fund=false
186+
```
187+
188+
#### .yarnrc.yml configuration file \{#yarnrc-yml-configuration-file}
189+
190+
- Provides a `.yarnrc.yml` configuration file. Combined with the connector-csi-driver, this configuration file will be mounted into the Pod, allowing access to the NPM registry through the proxy without needing to configure credentials on the client side.
191+
192+
```ini
193+
# Set the NPM registry server URL for package resolution
194+
npmRegistryServer: "http://npm-registry.example.com/"
195+
196+
# The authentication token is fake, because the connector will not use it, it will be used for proxy requests.
197+
npmAuthIdent: "fAd326jYkI123456789xxx"
198+
199+
# Always authenticate to the registry
200+
# This is required for the connector to work correctly, if the npmAlwaysAuth is not set to true, the metadata request will not be authenticated.
201+
npmAlwaysAuth: true
202+
203+
# The unsafeHttpWhitelist is used to whitelist the host for proxy requests.
204+
unsafeHttpWhitelist:
205+
- npm-registry.example.com
206+
207+
# authentication for proxy requests
208+
httpProxy: "http://connector-ns%2Fconnector-name:[email protected]/"
209+
httpsProxy: "http://connector-ns%2Fconnector-name:[email protected]/"
210+
211+
# Disable strict SSL verification for internal registries
212+
enableStrictSsl: false
213+
214+
# Set the registry URL for package publishing
215+
# Ensures packages are published to the correct registry
216+
npmPublishRegistry: "http://npm-registry.example.com/"
217+
```
218+
219+
For detailed proxy mechanics, see [How It Works](../quick_start.mdx#what-happens-under-the-hood) in the Quick Start guide.
220+
221+
:::warning
222+
223+
When using yarn with `HTTPS` registry, you need to configure yarn with the Connector Proxy certificate trust through environment variables, otherwise certificate errors will occur.
224+
225+
The certificate configuration for yarn is as follows:
226+
227+
```sh
228+
export NODE_EXTRA_CA_CERTS=/opt/yarn/ca.cert # replace with the actual path where ca.cert is mounted in the Pod
229+
```
230+
:::
231+
232+
#### ca.cert file
233+
234+
The NPM connector also provides a `ca.cert` file containing the Connector Proxy's CA certificate. This file can be mounted into the Pod via Connector CSI Driver to establish TLS trust when accessing the proxy over HTTPS.
235+
#### Using Connectors CSI Driver to mount .npmrc and .yarnrc.yml file \{#using-connectors-csi-driver-to-mount-npmrc-and-yarnrc-yml-file}
236+
237+
The NPM connector provides a `.npmrc`, `.yarnrc.yml` and `ca.cert` file that can be mounted into the Pod via Connector CSI Driver.
238+
239+
For example:
240+
241+
``` yaml
242+
spec:
243+
244+
volumes:
245+
- name: npmrc
246+
csi:
247+
readOnly: true
248+
driver: connectors-csi
249+
volumeAttributes:
250+
connector.name: "npm-connector"
251+
configuration.names: "npmrc"
252+
- name: yarnrc
253+
csi:
254+
readOnly: true
255+
driver: connectors-csi
256+
volumeAttributes:
257+
connector.name: "npm-connector"
258+
configuration.names: "yarnrc"
259+
```
260+
261+
parameter descriptions:
262+
263+
- `csi.readOnly`: Fixed value `true`
264+
- `csi.driver`: The Connector CSI Driver, fixed as `connectors-csi`.
265+
- `csi.volumeAttributes`: CSI Volume attributes
266+
- `connector.name`: Name of the NPM Connector
267+
- `connector.namespace`: Namespace of the NPM Connector; if not specified, the Pod's namespace is used
268+
- `configuration.names`: Configuration name, provided by the NPM Connector. As above, `npmrc` and `yarnrc` are supported.
269+
270+
For detailed information about how to use the `.npmrc` and `.yarnrc.yml` file in the Pod by connectors-csi-driver, please refer to [Using NPM Connectors in kubernetes jobs](../quick_start.mdx)
271+
272+
## Further Reading
273+
274+
- [Using NPM Connectors as Distribution Management Repository](../quick_start.mdx)
275+
276+
## References
277+
278+
- [Concepts of Connector](../../connectors/concepts/connector.mdx)
279+
- [Connector Proxy](../../connectors/concepts/connectors_proxy.mdx)
280+
- [Connector CSI Driver](../../connectors/concepts/connectors_csi.mdx)
281+
- [Kubernetes CSI Volume](https://kubernetes.io/docs/concepts/storage/volumes/#csi)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
weight: 60
3+
i18n:
4+
title:
5+
en: How To
6+
title: How To
7+
---
8+
9+
# Practical Guide
10+
11+
<Overview />
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# NPM Connector
2+
3+
<Overview overviewHeaders={[]} />
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
weight: 10
3+
---
4+
5+
# Introduction
6+
7+
## What is NPM Connector
8+
9+
NPM Connector is a specialized connector component that enables secure and convenient integration with NPM Registry, allowing users to interact with NPM Registry without handling credentials in clients like `npm`.
10+
11+
Once NPM Connector Component is deployed, users can:
12+
13+
- Create NPM connectors to integrate with various NPM Registries (NPM repository hosted by Nexus, Artifactory, etc.)
14+
- Perform `npm` operations in CI/CD pipelines or Kubernetes workloads without directly handling credentials.
15+
16+
## Application Scenarios
17+
18+
The NPM Connector allows you to perform `npm` operations securely by:
19+
20+
- Managing credentials centrally rather than hardcoding them in clients
21+
- Automatically injecting authentication during the `npm` operations
22+
23+
This approach is particularly useful for:
24+
25+
- `CI/CD pipelines` or `kubernetes jobs` requiring access to NPM Registry
26+
- Teams sharing NPM Registry access without sharing credentials
27+
- Environments requiring centralized management of NPM Registry credentials without distributing credentials to each client

0 commit comments

Comments
 (0)