@r8s/rustfs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +165 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface RustFSProps {
|
|
2
|
+
/** Resource name */
|
|
3
|
+
name?: string;
|
|
4
|
+
/** Kubernetes namespace */
|
|
5
|
+
namespace?: string;
|
|
6
|
+
/** Number of instances (default: 4) */
|
|
7
|
+
instances?: number;
|
|
8
|
+
/** Storage per instance (default: 100Gi) */
|
|
9
|
+
storage?: string;
|
|
10
|
+
/** Storage class */
|
|
11
|
+
storageClass?: string;
|
|
12
|
+
/** Root user (default: rustfs) */
|
|
13
|
+
rootUser?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Root credentials. If `existingSecret` is set, that Secret must already
|
|
16
|
+
* exist (with `user` and `password` keys). Otherwise a Secret named
|
|
17
|
+
* `<name>-root-password` is created with the given `password`.
|
|
18
|
+
*/
|
|
19
|
+
rootCredentials?: {
|
|
20
|
+
password?: string;
|
|
21
|
+
existingSecret?: string;
|
|
22
|
+
};
|
|
23
|
+
/** Ingress host for S3 API */
|
|
24
|
+
host?: string;
|
|
25
|
+
/** TLS config */
|
|
26
|
+
tls?: {
|
|
27
|
+
secretName: string;
|
|
28
|
+
clusterIssuer: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* RustFS S3-compatible object storage cluster.
|
|
33
|
+
* Deploys without operator — native Kubernetes resources only.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* <RustFS
|
|
37
|
+
* name="storage"
|
|
38
|
+
* namespace="rustfs"
|
|
39
|
+
* instances={4}
|
|
40
|
+
* storage="500Gi"
|
|
41
|
+
* host="s3.example.com"
|
|
42
|
+
* tls={{ secretName: "s3-tls", clusterIssuer: "letsencrypt" }}
|
|
43
|
+
* />
|
|
44
|
+
*/
|
|
45
|
+
export declare function RustFS(props: RustFSProps): import("@r8s/core").r8sElement;
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,eAAe,CAAC,EAAE;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,cAAc,CAAC,EAAE,MAAM,CAAA;KACxB,CAAA;IACD,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iBAAiB;IACjB,GAAG,CAAC,EAAE;QACJ,UAAU,EAAE,MAAM,CAAA;QAClB,aAAa,EAAE,MAAM,CAAA;KACtB,CAAA;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,kCAkLxC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RustFS = RustFS;
|
|
4
|
+
const core_1 = require("@r8s/core");
|
|
5
|
+
/**
|
|
6
|
+
* RustFS S3-compatible object storage cluster.
|
|
7
|
+
* Deploys without operator — native Kubernetes resources only.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <RustFS
|
|
11
|
+
* name="storage"
|
|
12
|
+
* namespace="rustfs"
|
|
13
|
+
* instances={4}
|
|
14
|
+
* storage="500Gi"
|
|
15
|
+
* host="s3.example.com"
|
|
16
|
+
* tls={{ secretName: "s3-tls", clusterIssuer: "letsencrypt" }}
|
|
17
|
+
* />
|
|
18
|
+
*/
|
|
19
|
+
function RustFS(props) {
|
|
20
|
+
const { name = 'rustfs', namespace = 'rustfs', instances = 4, storage = '100Gi', storageClass, rootUser = 'rustfs', rootCredentials, host, tls, } = props;
|
|
21
|
+
const rootPasswordSecret = rootCredentials?.existingSecret ?? `${name}-root-password`;
|
|
22
|
+
const resources = [];
|
|
23
|
+
// Namespace
|
|
24
|
+
resources.push((0, core_1.jsx)('Namespace', {
|
|
25
|
+
apiVersion: 'v1',
|
|
26
|
+
kind: 'Namespace',
|
|
27
|
+
metadata: { name: namespace },
|
|
28
|
+
}));
|
|
29
|
+
// Root credentials Secret — created unless the user points at an
|
|
30
|
+
// existing one. Without this the StatefulSet references a Secret that
|
|
31
|
+
// never exists and pods fail to start.
|
|
32
|
+
if (!rootCredentials?.existingSecret) {
|
|
33
|
+
resources.push((0, core_1.jsx)('Secret', {
|
|
34
|
+
apiVersion: 'v1',
|
|
35
|
+
kind: 'Secret',
|
|
36
|
+
metadata: { name: rootPasswordSecret, namespace },
|
|
37
|
+
type: 'Opaque',
|
|
38
|
+
stringData: {
|
|
39
|
+
user: rootUser,
|
|
40
|
+
password: rootCredentials?.password ?? 'rustfs-change-me',
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
// Headless service for StatefulSet
|
|
45
|
+
resources.push((0, core_1.jsx)('Service', {
|
|
46
|
+
apiVersion: 'v1',
|
|
47
|
+
kind: 'Service',
|
|
48
|
+
metadata: { name: `${name}-headless`, namespace },
|
|
49
|
+
spec: {
|
|
50
|
+
clusterIP: 'None',
|
|
51
|
+
selector: { app: name },
|
|
52
|
+
ports: [
|
|
53
|
+
{ port: 9000, name: 's3' },
|
|
54
|
+
{ port: 9001, name: 'console' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
}));
|
|
58
|
+
// Service
|
|
59
|
+
resources.push((0, core_1.jsx)('Service', {
|
|
60
|
+
apiVersion: 'v1',
|
|
61
|
+
kind: 'Service',
|
|
62
|
+
metadata: { name, namespace },
|
|
63
|
+
spec: {
|
|
64
|
+
selector: { app: name },
|
|
65
|
+
ports: [
|
|
66
|
+
{ port: 80, targetPort: 9000, name: 's3' },
|
|
67
|
+
{ port: 9001, targetPort: 9001, name: 'console' },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
}));
|
|
71
|
+
// StatefulSet
|
|
72
|
+
const pvcTemplate = {
|
|
73
|
+
metadata: { name: 'data' },
|
|
74
|
+
spec: {
|
|
75
|
+
accessModes: ['ReadWriteOnce'],
|
|
76
|
+
resources: { requests: { storage } },
|
|
77
|
+
...(storageClass && { storageClassName: storageClass }),
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
resources.push((0, core_1.jsx)('StatefulSet', {
|
|
81
|
+
apiVersion: 'apps/v1',
|
|
82
|
+
kind: 'StatefulSet',
|
|
83
|
+
metadata: { name, namespace },
|
|
84
|
+
spec: {
|
|
85
|
+
serviceName: `${name}-headless`,
|
|
86
|
+
replicas: instances,
|
|
87
|
+
selector: { matchLabels: { app: name } },
|
|
88
|
+
template: {
|
|
89
|
+
metadata: { labels: { app: name } },
|
|
90
|
+
spec: {
|
|
91
|
+
containers: [
|
|
92
|
+
{
|
|
93
|
+
name: 'rustfs',
|
|
94
|
+
image: 'rustfs/rustfs:latest',
|
|
95
|
+
ports: [
|
|
96
|
+
{ containerPort: 9000, name: 's3' },
|
|
97
|
+
{ containerPort: 9001, name: 'console' },
|
|
98
|
+
],
|
|
99
|
+
env: [
|
|
100
|
+
{ name: 'RUSTFS_ROOT_USER', value: rootUser },
|
|
101
|
+
{
|
|
102
|
+
name: 'RUSTFS_ROOT_PASSWORD',
|
|
103
|
+
valueFrom: {
|
|
104
|
+
secretKeyRef: { name: rootPasswordSecret, key: 'password' },
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
volumeMounts: [{ name: 'data', mountPath: '/data' }],
|
|
109
|
+
resources: {
|
|
110
|
+
requests: { memory: '1Gi', cpu: '500m' },
|
|
111
|
+
limits: { memory: '4Gi', cpu: '2000m' },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
volumeClaimTemplates: [pvcTemplate],
|
|
118
|
+
},
|
|
119
|
+
}));
|
|
120
|
+
// Ingress
|
|
121
|
+
if (host) {
|
|
122
|
+
const ingressSpec = {
|
|
123
|
+
rules: [
|
|
124
|
+
{
|
|
125
|
+
host,
|
|
126
|
+
http: {
|
|
127
|
+
paths: [
|
|
128
|
+
{
|
|
129
|
+
path: '/',
|
|
130
|
+
pathType: 'Prefix',
|
|
131
|
+
backend: {
|
|
132
|
+
service: { name, port: { number: 80 } },
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
if (tls) {
|
|
141
|
+
ingressSpec.tls = [
|
|
142
|
+
{
|
|
143
|
+
hosts: [host],
|
|
144
|
+
secretName: tls.secretName,
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
resources.push((0, core_1.jsx)('Ingress', {
|
|
149
|
+
apiVersion: 'networking.k8s.io/v1',
|
|
150
|
+
kind: 'Ingress',
|
|
151
|
+
metadata: {
|
|
152
|
+
name,
|
|
153
|
+
namespace,
|
|
154
|
+
annotations: tls
|
|
155
|
+
? {
|
|
156
|
+
'cert-manager.io/cluster-issuer': tls.clusterIssuer,
|
|
157
|
+
}
|
|
158
|
+
: undefined,
|
|
159
|
+
},
|
|
160
|
+
spec: ingressSpec,
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
return (0, core_1.jsx)(core_1.Fragment, { children: resources });
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AA+CA,wBAkLC;AAjOD,oCAAyC;AAiCzC;;;;;;;;;;;;;GAaG;AACH,SAAgB,MAAM,CAAC,KAAkB;IACvC,MAAM,EACJ,IAAI,GAAG,QAAQ,EACf,SAAS,GAAG,QAAQ,EACpB,SAAS,GAAG,CAAC,EACb,OAAO,GAAG,OAAO,EACjB,YAAY,EACZ,QAAQ,GAAG,QAAQ,EACnB,eAAe,EACf,IAAI,EACJ,GAAG,GACJ,GAAG,KAAK,CAAA;IAET,MAAM,kBAAkB,GAAG,eAAe,EAAE,cAAc,IAAI,GAAG,IAAI,gBAAgB,CAAA;IACrF,MAAM,SAAS,GAA6B,EAAE,CAAA;IAE9C,YAAY;IACZ,SAAS,CAAC,IAAI,CACZ,IAAA,UAAG,EAAC,WAAW,EAAE;QACf,UAAU,EAAE,IAAI;QAChB,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC9B,CAAC,CACH,CAAA;IAED,iEAAiE;IACjE,sEAAsE;IACtE,uCAAuC;IACvC,IAAI,CAAC,eAAe,EAAE,cAAc,EAAE,CAAC;QACrC,SAAS,CAAC,IAAI,CACZ,IAAA,UAAG,EAAC,QAAQ,EAAE;YACZ,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,SAAS,EAAE;YACjD,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,eAAe,EAAE,QAAQ,IAAI,kBAAkB;aAC1D;SACF,CAAC,CAC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I,IAAI,EAAE,CAAC;QACT,MAAM,WAAW,GAA4B;YAC3C,KAAK,EAAE;gBACL;oBACE,IAAI;oBACJ,IAAI,EAAE;wBACJ,KAAK,EAAE;4BACL;gCACE,IAAI,EAAE,GAAG;gCACT,QAAQ,EAAE,QAAQ;gCAClB,OAAO,EAAE;oCACP,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE;iCACxC;6BACF;yBACF;qBACF;iBACF;aACF;SACF,CAAA;QAED,IAAI,GAAG,EAAE,CAAC;YACR,WAAW,CAAC,GAAG,GAAG;gBAChB;oBACE,KAAK,EAAE,CAAC,IAAI,CAAC;oBACb,UAAU,EAAE,GAAG,CAAC,UAAU;iBAC3B;aACF,CAAA;QACH,CAAC;QAED,SAAS,CAAC,IAAI,CACZ,IAAA,UAAG,EAAC,SAAS,EAAE;YACb,UAAU,EAAE,sBAAsB;YAClC,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE;gBACR,IAAI;gBACJ,SAAS;gBACT,WAAW,EAAE,GAAG;oBACd,CAAC,CAAC;wBACE,gCAAgC,EAAE,GAAG,CAAC,aAAa;qBACpD;oBACH,CAAC,CAAC,SAAS;aACd;YACD,IAAI,EAAE,WAAW;SAClB,CAAC,CACH,CAAA;IACH,CAAC;IAED,OAAO,IAAA,UAAG,EAAC,eAAQ,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAA;AAC/C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@r8s/rustfs",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "RustFS S3-compatible object storage components for r8s",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Berget AI AB",
|
|
7
|
+
"homepage": "https://r8s.berget.ai",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/berget-ai/r8s.git",
|
|
11
|
+
"directory": "packages/rustfs"
|
|
12
|
+
},
|
|
13
|
+
"bugs": "https://github.com/berget-ai/r8s/issues",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"rustfs",
|
|
22
|
+
"s3",
|
|
23
|
+
"object-storage",
|
|
24
|
+
"storage"
|
|
25
|
+
],
|
|
26
|
+
"r8s": {
|
|
27
|
+
"category": "Data & Analytics"
|
|
28
|
+
},
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc --build",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@r8s/core": "^0.1.0",
|
|
38
|
+
"@r8s/k8s-types": "^0.1.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"typescript": "^5.3.0",
|
|
42
|
+
"vitest": "^1.0.0"
|
|
43
|
+
}
|
|
44
|
+
}
|