
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
node-rancher2api
Advanced tools
This project provides access to a subset of the Rancher 2.x API in a highly opinionated fashion, intended primarily to address deployment concerns to Rancher2 and K8S within the @endeavorb2b stack.
This library can be included in your project to allow native access to the Rancher2 API methods via node-fetch. Fetch allows both backend and browser access to the API, but does not obscure credentials -- beware of this if building a browser application using this library.
All methods require at minimum a Rancher 2.x v3 API URL (such as https://cows.my-doma.in/api/v3) and a Rancher 2.x API key. While scoped keys are supported, this library assumes a hard dependancy of knowing the cluster ID at runtime. The Bearer Token format should be passed to the library methods (username:secretKey.)
Supported: List.
Parameters: (uri, token)
Returns an array of cluster objects ({ id, name }).
Supported: List and Create.
Parameters: ({ uri, token, clusterId })
Returns an array of project objects ({ id, name }).
Parameters: ({ uri, token, clusterId, name })
Creates and returns a project object ({ id, name }).
Supported: List and Create.
Parameters: ({ uri, token, projectId })
Returns an array of service objects ({ id, name }).
Parameters: ({ uri, token, projectId, namespaceId, name, targetWorkloadIds })
Creates and returns a service object ({ id, name }).
Supported: List and Create.
Parameters: ({ uri, token, clusterId })
Returns an array of namespace objects ({ id, name }).
Parameters: ({ uri, token, clusterId, projectId, name })
Creates and returns a namespace object ({ id, name }) within a project.
Supported: List, Create, and Update.
Parameters: ({ uri, token, projectId })
Returns an array of workload objects ({ id, deploymentId, name }).
Parameters: ({ uri, token, projectId, namespaceId, name, deploymentConfig, containers })
Creates and returns a workload object ({ id, deploymentId, name, ... }) within a project+namespace.
labels, if not specified, will default to the following:
{
'workload.user.cattle.io/workloadselector': `deployment-${namespaceId}-${name}`
}
deploymentConfig, if not specified, will default to the following:
{
maxSurge: 1,
maxUnavailable: 0,
minReadySeconds: 0,
progressDeadlineSeconds: 600,
revisionHistoryLimit: 10,
strategy: 'RollingUpdate',
}
containers, if not specified or without a valid container definition, will default to the following:
[{
env: [],
image: 'busybox:latest',
imagePullPolicy: 'IfNotPresent',
name,
entrypoint: ['top'],
securityContext: {
allowPrivilegeEscalation: false,
capabilities: {},
privileged: false,
procMount: 'Default',
readOnlyRootFilesystem: false,
runAsNonRoot: false,
},
stdin: true,
terminationMessagePath: '/dev/termination-log',
terminationMessagePolicy: 'File',
tty: true,
}]
cronJobConfig, if specified, should provide the following:
{
concurrencyPolicy: 'Allow',
failedJobsHistoryLimit: 10,
schedule: '* * * * *', // A valid cron schedule
successfulJobsHistoryLimit: 10,
suspend: false,
}
Parameters: ({ uri, token, projectId, workloadId, deploymentConfig, containers })
Updates and returns a workload object ({ id, deploymentId, name, ... }) within a project+namespace.
labels, if specified, MUST include the following:
{
'workload.user.cattle.io/workloadselector': `deployment-${namespaceId}-${name}`
}
deploymentConfig, if not specified, will default to the following:
{
maxSurge: 1,
maxUnavailable: 0,
minReadySeconds: 0,
progressDeadlineSeconds: 600,
revisionHistoryLimit: 10,
strategy: 'RollingUpdate',
}
Supported: List, Create, and Update.
Parameters: ({ uri, token, projectId })
Returns an array of ingress objects ({ id, name }).
Parameters: ({ uri, token, projectId, namespaceId, name, rules, tls }), also support tls, the parameter of tls is optional.
Creates and returns a ingress object ({ id, name, ... }) within a project+namespace.
rules must be an array of rule objects specifying the port and workloadIds. The URI path is optional:
{
path: '/test2/test2',
targetPort: 80,
workloadIds: [ 'deployment:<namespaceId>:<workloadName>'],
}
Parameters: ({ uri, token, projectId, ingressId, rules })
Updates and returns a ingress object ({ id, name, ... }) within a project+namespace.
rules must be an array of rule objects specifying the port and workloadIds. The URI path is optional:
{
path: '/test2/test2',
targetPort: 80,
workloadIds: [ 'deployment:<namespaceId>:<workloadName>'],
}
Parameters: ({uri, token, projectId})
Returns an array of ceftificates object ({ id, name }).
Contributions are always welcome -- if you would like access to another module or would like to include support for some other feature of the Rancher2 API, please submit a pull request.
To get started, pull this repository and execute yarn && yarn start from the project root.
FAQs
Rancher2 API library for node
The npm package node-rancher2api receives a total of 3 weekly downloads. As such, node-rancher2api popularity was classified as not popular.
We found that node-rancher2api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.