@r8s/recipes 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.
Files changed (65) hide show
  1. package/dist/app.d.ts +94 -0
  2. package/dist/app.d.ts.map +1 -0
  3. package/dist/app.js +120 -0
  4. package/dist/app.js.map +1 -0
  5. package/dist/auth/components.d.ts +163 -0
  6. package/dist/auth/components.d.ts.map +1 -0
  7. package/dist/auth/components.js +134 -0
  8. package/dist/auth/components.js.map +1 -0
  9. package/dist/auth/index.d.ts +2 -0
  10. package/dist/auth/index.d.ts.map +1 -0
  11. package/dist/auth/index.js +14 -0
  12. package/dist/auth/index.js.map +1 -0
  13. package/dist/auth.d.ts +92 -0
  14. package/dist/auth.d.ts.map +1 -0
  15. package/dist/auth.js +302 -0
  16. package/dist/auth.js.map +1 -0
  17. package/dist/backup.d.ts +45 -0
  18. package/dist/backup.d.ts.map +1 -0
  19. package/dist/backup.js +59 -0
  20. package/dist/backup.js.map +1 -0
  21. package/dist/cert-provider.d.ts +78 -0
  22. package/dist/cert-provider.d.ts.map +1 -0
  23. package/dist/cert-provider.js +71 -0
  24. package/dist/cert-provider.js.map +1 -0
  25. package/dist/database.d.ts +49 -0
  26. package/dist/database.d.ts.map +1 -0
  27. package/dist/database.js +212 -0
  28. package/dist/database.js.map +1 -0
  29. package/dist/dns-provider.d.ts +110 -0
  30. package/dist/dns-provider.d.ts.map +1 -0
  31. package/dist/dns-provider.js +121 -0
  32. package/dist/dns-provider.js.map +1 -0
  33. package/dist/endpoint-provider.d.ts +121 -0
  34. package/dist/endpoint-provider.d.ts.map +1 -0
  35. package/dist/endpoint-provider.js +79 -0
  36. package/dist/endpoint-provider.js.map +1 -0
  37. package/dist/endpoint.d.ts +43 -0
  38. package/dist/endpoint.d.ts.map +1 -0
  39. package/dist/endpoint.js +221 -0
  40. package/dist/endpoint.js.map +1 -0
  41. package/dist/index.d.ts +14 -0
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/index.js +49 -0
  44. package/dist/index.js.map +1 -0
  45. package/dist/monitoring.d.ts +49 -0
  46. package/dist/monitoring.d.ts.map +1 -0
  47. package/dist/monitoring.js +128 -0
  48. package/dist/monitoring.js.map +1 -0
  49. package/dist/operators.d.ts +19 -0
  50. package/dist/operators.d.ts.map +1 -0
  51. package/dist/operators.js +30 -0
  52. package/dist/operators.js.map +1 -0
  53. package/dist/platform.d.ts +116 -0
  54. package/dist/platform.d.ts.map +1 -0
  55. package/dist/platform.js +121 -0
  56. package/dist/platform.js.map +1 -0
  57. package/dist/secret-provider.d.ts +119 -0
  58. package/dist/secret-provider.d.ts.map +1 -0
  59. package/dist/secret-provider.js +125 -0
  60. package/dist/secret-provider.js.map +1 -0
  61. package/dist/web-service.d.ts +87 -0
  62. package/dist/web-service.d.ts.map +1 -0
  63. package/dist/web-service.js +171 -0
  64. package/dist/web-service.js.map +1 -0
  65. package/package.json +48 -0
package/dist/auth.js ADDED
@@ -0,0 +1,302 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Auth = Auth;
4
+ const core_1 = require("@r8s/core");
5
+ const defaults_1 = require("@r8s/core/defaults");
6
+ const crds_1 = require("@r8s/crds");
7
+ const database_1 = require("./database");
8
+ const endpoint_1 = require("./endpoint");
9
+ const components_1 = require("./auth/components");
10
+ /**
11
+ * Identity and access management — Keycloak with database, TLS, and routing.
12
+ *
13
+ * @title Auth
14
+ * @category Security & Identity
15
+ *
16
+ * Composes Keycloak (identity provider), CNPG (PostgreSQL database),
17
+ * cert-manager (TLS), and routing (Ingress/Gateway) into a single
18
+ * identity solution with good defaults.
19
+ *
20
+ * The database is auto-wired: Keycloak connects to its own PostgreSQL
21
+ * cluster. Credentials are managed by CNPG's bootstrap secret.
22
+ *
23
+ * @example
24
+ * // Simple Keycloak instance
25
+ * import { Auth } from '@r8s/recipes'
26
+ *
27
+ * export default <Auth name="auth" host="auth.example.com" />
28
+ *
29
+ * @example
30
+ * // Keycloak with custom storage and TLS
31
+ * import { Auth } from '@r8s/recipes'
32
+ *
33
+ * export default (
34
+ * <Auth
35
+ * name="auth"
36
+ * host="auth.example.com"
37
+ * instances={2}
38
+ * storage="20Gi"
39
+ * tls={{ secretName: 'auth-tls', clusterIssuer: 'letsencrypt-prod' }}
40
+ * />
41
+ * )
42
+ *
43
+ * @example
44
+ * // Keycloak with realms and clients
45
+ * import { Auth } from '@r8s/recipes'
46
+ * import { Realms, Realm, Clients, Client } from '@r8s/recipes/auth'
47
+ *
48
+ * export default (
49
+ * <Auth name="auth" host="auth.example.com">
50
+ * <Realms>
51
+ * <Realm id="company" displayName="Company">
52
+ * <Clients>
53
+ * <Client id="web" type="public" redirectUris={['https://app.example.com/*']} />
54
+ * <Client id="api" type="bearer-only" />
55
+ * </Clients>
56
+ * </Realm>
57
+ * </Realms>
58
+ * </Auth>
59
+ * )
60
+ *
61
+ * @example
62
+ * // Keycloak with EntraID federation
63
+ * import { Auth } from '@r8s/recipes'
64
+ * import { Realms, Realm, Clients, Client, EntraID } from '@r8s/recipes/auth'
65
+ *
66
+ * export default (
67
+ * <Auth name="auth" host="auth.example.com">
68
+ * <Realms>
69
+ * <Realm id="company" displayName="Company">
70
+ * <EntraID
71
+ * tenantId="your-tenant-id"
72
+ * clientId="your-client-id"
73
+ * clientSecret="${env:ENTRA_CLIENT_SECRET}"
74
+ * />
75
+ * <Clients>
76
+ * <Client id="web" type="public" redirectUris={['https://app.example.com/*']} />
77
+ * </Clients>
78
+ * </Realm>
79
+ * </Realms>
80
+ * </Auth>
81
+ * )
82
+ */
83
+ function Auth(props) {
84
+ const { name, host, namespace: namespaceProp, instances = 1, storage = '10Gi', tls, children, } = props;
85
+ // Inherit namespace from <Platform> context if not explicitly set
86
+ const contextNamespace = (0, core_1.useContext)(defaults_1.Namespace);
87
+ const namespace = namespaceProp ?? (contextNamespace !== 'default' ? contextNamespace : undefined) ?? 'default';
88
+ const sharedOperators = (0, core_1.useContext)(defaults_1.OperatorContext);
89
+ const hasKeycloak = sharedOperators.some((op) => op.name === 'keycloak-operator');
90
+ const hasCNPG = sharedOperators.some((op) => op.name === 'cnpg');
91
+ const resources = [];
92
+ // Declare operators if not already provided
93
+ if (!hasKeycloak) {
94
+ resources.push((0, core_1.declareOperator)(crds_1.operators['keycloak-operator']()));
95
+ }
96
+ if (!hasCNPG) {
97
+ resources.push((0, core_1.declareOperator)(crds_1.operators['cnpg']()));
98
+ }
99
+ // Database for Keycloak — auto-wired via DatabaseContext.
100
+ // Credentials are managed by the secrets backend configured on the Platform.
101
+ resources.push((0, core_1.jsx)(database_1.Database, {
102
+ name: `${name}-db`,
103
+ namespace,
104
+ storage,
105
+ children: (0, core_1.jsx)('Keycloak', {
106
+ apiVersion: 'k8s.keycloak.org/v2alpha1',
107
+ kind: 'Keycloak',
108
+ metadata: { name, namespace },
109
+ spec: {
110
+ instances,
111
+ hostname: {
112
+ hostname: host,
113
+ strict: false,
114
+ strictBackchannel: false,
115
+ },
116
+ proxy: {
117
+ headers: 'xforwarded',
118
+ },
119
+ ingress: {
120
+ enabled: false, // We use our own Endpoint for routing
121
+ },
122
+ transaction: {
123
+ xaEnabled: false,
124
+ },
125
+ },
126
+ }),
127
+ }));
128
+ // Endpoint for public access
129
+ resources.push((0, core_1.jsx)(endpoint_1.Endpoint, {
130
+ name: `${name}-endpoint`,
131
+ namespace,
132
+ host,
133
+ serviceName: `${name}-service`,
134
+ servicePort: 8080,
135
+ tls,
136
+ }));
137
+ // Process children (Realms) to create KeycloakRealmImport resources
138
+ const realms = collectRealms(children);
139
+ for (const realm of realms) {
140
+ resources.push((0, core_1.jsx)('KeycloakRealmImport', {
141
+ apiVersion: 'k8s.keycloak.org/v2alpha1',
142
+ kind: 'KeycloakRealmImport',
143
+ metadata: { name: `${name}-${realm.id}`, namespace },
144
+ spec: {
145
+ keycloakCRName: name,
146
+ realm: {
147
+ realm: realm.id,
148
+ displayName: realm.displayName,
149
+ enabled: realm.enabled ?? true,
150
+ identityProviders: realm.identityProviders?.map((idp) => ({
151
+ alias: idp.alias,
152
+ displayName: idp.displayName,
153
+ providerId: idp.providerId,
154
+ enabled: idp.enabled ?? true,
155
+ trustEmail: idp.trustEmail ?? false,
156
+ config: idp.config,
157
+ })),
158
+ clients: realm.clients?.map((client) => ({
159
+ clientId: client.id,
160
+ name: client.name ?? client.id,
161
+ publicClient: client.type === 'public',
162
+ standardFlowEnabled: client.type === 'public',
163
+ bearerOnly: client.type === 'bearer-only',
164
+ serviceAccountsEnabled: client.type === 'confidential' ? true : undefined,
165
+ secret: client.secret,
166
+ redirectUris: client.redirectUris,
167
+ webOrigins: client.webOrigins,
168
+ directAccessGrantsEnabled: client.directAccessGrantsEnabled ?? false,
169
+ })),
170
+ },
171
+ },
172
+ }));
173
+ }
174
+ return (0, core_1.jsx)(core_1.Fragment, { children: resources });
175
+ }
176
+ /** Collect Realm configurations from children */
177
+ function collectRealms(children) {
178
+ const realms = [];
179
+ if (!children)
180
+ return realms;
181
+ const childArray = Array.isArray(children) ? children : [children];
182
+ for (const child of childArray) {
183
+ if (child && typeof child === 'object' && 'type' in child) {
184
+ if (child.type === components_1.Realms) {
185
+ const realmsProps = child.props;
186
+ const realmChildren = Array.isArray(realmsProps.children)
187
+ ? realmsProps.children
188
+ : [realmsProps.children];
189
+ for (const realmChild of realmChildren) {
190
+ if (realmChild &&
191
+ typeof realmChild === 'object' &&
192
+ 'type' in realmChild &&
193
+ realmChild.type === components_1.Realm) {
194
+ const realmProps = realmChild.props;
195
+ const clients = collectClients(realmProps.children);
196
+ // Merge identity providers from both prop and child components
197
+ const identityProviders = [
198
+ ...(realmProps.identityProviders ?? []),
199
+ ...collectIdentityProviders(realmProps.children),
200
+ ];
201
+ realms.push({
202
+ id: realmProps.id,
203
+ displayName: realmProps.displayName,
204
+ enabled: realmProps.enabled,
205
+ identityProviders,
206
+ clients,
207
+ });
208
+ }
209
+ }
210
+ }
211
+ else if (child.type === components_1.Realm) {
212
+ const realmProps = child.props;
213
+ const clients = collectClients(realmProps.children);
214
+ // Merge identity providers from both prop and child components
215
+ const identityProviders = [
216
+ ...(realmProps.identityProviders ?? []),
217
+ ...collectIdentityProviders(realmProps.children),
218
+ ];
219
+ realms.push({
220
+ id: realmProps.id,
221
+ displayName: realmProps.displayName,
222
+ enabled: realmProps.enabled,
223
+ identityProviders,
224
+ clients,
225
+ });
226
+ }
227
+ }
228
+ }
229
+ return realms;
230
+ }
231
+ /** Collect Client configurations from children */
232
+ function collectClients(children) {
233
+ const clients = [];
234
+ if (!children)
235
+ return clients;
236
+ const childArray = Array.isArray(children) ? children : [children];
237
+ for (const child of childArray) {
238
+ if (child && typeof child === 'object' && 'type' in child) {
239
+ if (child.type === components_1.Clients) {
240
+ const clientsProps = child.props;
241
+ const clientChildren = Array.isArray(clientsProps.children)
242
+ ? clientsProps.children
243
+ : [clientsProps.children];
244
+ for (const clientChild of clientChildren) {
245
+ if (clientChild &&
246
+ typeof clientChild === 'object' &&
247
+ 'type' in clientChild &&
248
+ clientChild.type === components_1.Client) {
249
+ clients.push(clientChild.props);
250
+ }
251
+ }
252
+ }
253
+ else if (child.type === components_1.Client) {
254
+ clients.push(child.props);
255
+ }
256
+ }
257
+ }
258
+ return clients;
259
+ }
260
+ /** Collect IdentityProvider configurations from children */
261
+ function collectIdentityProviders(children) {
262
+ const identityProviders = [];
263
+ if (!children)
264
+ return identityProviders;
265
+ const childArray = Array.isArray(children) ? children : [children];
266
+ for (const child of childArray) {
267
+ if (child && typeof child === 'object' && 'type' in child) {
268
+ if (child.type === components_1.EntraID) {
269
+ const entraProps = child.props;
270
+ identityProviders.push({
271
+ alias: 'entra-id',
272
+ displayName: entraProps.displayName ?? 'Entra ID',
273
+ providerId: 'oidc',
274
+ enabled: entraProps.enabled ?? true,
275
+ trustEmail: entraProps.trustEmail ?? true,
276
+ config: {
277
+ clientId: entraProps.clientId,
278
+ clientSecret: entraProps.clientSecret,
279
+ tokenUrl: `https://login.microsoftonline.com/${entraProps.tenantId}/oauth2/v2.0/token`,
280
+ authorizationUrl: `https://login.microsoftonline.com/${entraProps.tenantId}/oauth2/v2.0/authorize`,
281
+ },
282
+ });
283
+ }
284
+ else if (child.type === components_1.Google) {
285
+ const googleProps = child.props;
286
+ identityProviders.push({
287
+ alias: 'google',
288
+ displayName: googleProps.displayName ?? 'Google',
289
+ providerId: 'oidc',
290
+ enabled: googleProps.enabled ?? true,
291
+ trustEmail: googleProps.trustEmail ?? true,
292
+ config: {
293
+ clientId: googleProps.clientId,
294
+ clientSecret: googleProps.clientSecret,
295
+ },
296
+ });
297
+ }
298
+ }
299
+ }
300
+ return identityProviders;
301
+ }
302
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.tsx"],"names":[],"mappings":";;AA4GA,oBAmHC;AA/ND,oCAAsE;AACtE,iDAA+D;AAC/D,oCAAqC;AACrC,yCAAqC;AACrC,yCAAqC;AAErC,kDAU0B;AAmB1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,SAAgB,IAAI,CAAC,KAAgB;IACnC,MAAM,EACJ,IAAI,EACJ,IAAI,EACJ,SAAS,EAAE,aAAa,EACxB,SAAS,GAAG,CAAC,EACb,OAAO,GAAG,MAAM,EAChB,GAAG,EACH,QAAQ,GACT,GAAG,KAAK,CAAA;IAET,kEAAkE;IAClE,MAAM,gBAAgB,GAAG,IAAA,iBAAU,EAAC,oBAAS,CAAC,CAAA;IAC9C,MAAM,SAAS,GACb,aAAa,IAAI,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,SAAS,CAAA;IAE/F,MAAM,eAAe,GAAG,IAAA,iBAAU,EAAC,0BAAe,CAAC,CAAA;IACnD,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE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AO,EAAE,WAAW,CAAC,OAAO,IAAI,IAAI;oBACpC,UAAU,EAAE,WAAW,CAAC,UAAU,IAAI,IAAI;oBAC1C,MAAM,EAAE;wBACN,QAAQ,EAAE,WAAW,CAAC,QAAQ;wBAC9B,YAAY,EAAE,WAAW,CAAC,YAAY;qBACvC;iBACF,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,iBAAiB,CAAA;AAC1B,CAAC"}
@@ -0,0 +1,45 @@
1
+ export interface BackupProps {
2
+ /** Resource name */
3
+ name: string;
4
+ /** Default namespace to back up (used when `namespaces` is not set) */
5
+ namespace?: string;
6
+ /** Cron schedule for backups (defaults to daily at 2 AM) */
7
+ schedule?: string;
8
+ /** Namespaces to include in backups (defaults to the current namespace) */
9
+ namespaces?: string[];
10
+ /** Velero storage location name (defaults to 'default') */
11
+ storageLocation?: string;
12
+ /** Backup retention (e.g., '720h' for 30 days) */
13
+ ttl?: string;
14
+ }
15
+ /**
16
+ * Backup — scheduled cluster backups with Velero.
17
+ *
18
+ * @title Backup
19
+ * @category Security & Identity
20
+ *
21
+ * Creates a Velero Schedule that backs up your namespaces on a cron
22
+ * schedule. Pair with a BackupStorageLocation (S3/GCS/Azure) for
23
+ * off-cluster storage.
24
+ *
25
+ * The Velero operator is declared as a dependency.
26
+ *
27
+ * @example
28
+ * import { Backup } from '@r8s/recipes'
29
+ *
30
+ * export default <Backup name="daily" />
31
+ *
32
+ * @example
33
+ * import { Backup } from '@r8s/recipes'
34
+ *
35
+ * export default (
36
+ * <Backup
37
+ * name="weekly"
38
+ * schedule="0 3 * * 0"
39
+ * namespaces={['production', 'staging']}
40
+ * ttl="720h"
41
+ * />
42
+ * )
43
+ */
44
+ export declare function Backup(props: BackupProps): import("@r8s/core").r8sElement;
45
+ //# sourceMappingURL=backup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backup.d.ts","sourceRoot":"","sources":["../src/backup.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,kDAAkD;IAClD,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,kCAoCxC"}
package/dist/backup.js ADDED
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Backup = Backup;
4
+ const core_1 = require("@r8s/core");
5
+ const defaults_1 = require("@r8s/core/defaults");
6
+ const crds_1 = require("@r8s/crds");
7
+ /**
8
+ * Backup — scheduled cluster backups with Velero.
9
+ *
10
+ * @title Backup
11
+ * @category Security & Identity
12
+ *
13
+ * Creates a Velero Schedule that backs up your namespaces on a cron
14
+ * schedule. Pair with a BackupStorageLocation (S3/GCS/Azure) for
15
+ * off-cluster storage.
16
+ *
17
+ * The Velero operator is declared as a dependency.
18
+ *
19
+ * @example
20
+ * import { Backup } from '@r8s/recipes'
21
+ *
22
+ * export default <Backup name="daily" />
23
+ *
24
+ * @example
25
+ * import { Backup } from '@r8s/recipes'
26
+ *
27
+ * export default (
28
+ * <Backup
29
+ * name="weekly"
30
+ * schedule="0 3 * * 0"
31
+ * namespaces={['production', 'staging']}
32
+ * ttl="720h"
33
+ * />
34
+ * )
35
+ */
36
+ function Backup(props) {
37
+ const { name, namespace = 'default', schedule = '0 2 * * *', namespaces, storageLocation = 'default', ttl = '720h', } = props;
38
+ const sharedOperators = (0, core_1.useContext)(defaults_1.OperatorContext);
39
+ const hasVelero = sharedOperators.some((op) => op.name === 'velero');
40
+ const resources = [];
41
+ if (!hasVelero) {
42
+ resources.push((0, core_1.declareOperator)(crds_1.operators['velero']()));
43
+ }
44
+ resources.push((0, core_1.jsx)('Schedule', {
45
+ apiVersion: 'velero.io/v1',
46
+ kind: 'Schedule',
47
+ metadata: { name, namespace: 'velero' },
48
+ spec: {
49
+ schedule,
50
+ template: {
51
+ includedNamespaces: namespaces ?? [namespace],
52
+ storageLocation,
53
+ ttl,
54
+ },
55
+ },
56
+ }));
57
+ return (0, core_1.jsx)(core_1.Fragment, { children: resources });
58
+ }
59
+ //# sourceMappingURL=backup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backup.js","sourceRoot":"","sources":["../src/backup.tsx"],"names":[],"mappings":";;AAgDA,wBAoCC;AApFD,oCAAsE;AACtE,iDAAoD;AACpD,oCAAqC;AAiBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAgB,MAAM,CAAC,KAAkB;IACvC,MAAM,EACJ,IAAI,EACJ,SAAS,GAAG,SAAS,EACrB,QAAQ,GAAG,WAAW,EACtB,UAAU,EACV,eAAe,GAAG,SAAS,EAC3B,GAAG,GAAG,MAAM,GACb,GAAG,KAAK,CAAA;IAET,MAAM,eAAe,GAAG,IAAA,iBAAU,EAAC,0BAAe,CAAC,CAAA;IACnD,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAA;IAEpE,MAAM,SAAS,GAA6B,EAAE,CAAA;IAE9C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,SAAS,CAAC,IAAI,CAAC,IAAA,sBAAe,EAAC,gBAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;IACxD,CAAC;IAED,SAAS,CAAC,IAAI,CACZ,IAAA,UAAG,EAAC,UAAU,EAAE;QACd,UAAU,EAAE,cAAc;QAC1B,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE;QACvC,IAAI,EAAE;YACJ,QAAQ;YACR,QAAQ,EAAE;gBACR,kBAAkB,EAAE,UAAU,IAAI,CAAC,SAAS,CAAC;gBAC7C,eAAe;gBACf,GAAG;aACJ;SACF;KACF,CAAC,CACH,CAAA;IAED,OAAO,IAAA,UAAG,EAAC,eAAQ,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAA;AAC/C,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * CertManager configuration component.
3
+ *
4
+ * Use as a value in CertProvider when you need custom configuration:
5
+ * ```tsx
6
+ * <CertProvider provider={<CertManager clusterIssuer="letsencrypt-prod" />}>
7
+ * ```
8
+ */
9
+ export interface CertManagerProps {
10
+ /** Default ClusterIssuer for certificates (default: 'letsencrypt-prod') */
11
+ clusterIssuer?: string;
12
+ /** Default certificate duration (default: '2160h' = 90 days) */
13
+ duration?: string;
14
+ /** Default renew before expiry (default: '360h' = 15 days) */
15
+ renewBefore?: string;
16
+ }
17
+ export declare function CertManager(props: CertManagerProps): CertConfig;
18
+ /** Certificate provider configuration */
19
+ export interface CertConfig {
20
+ /** Certificate provider type */
21
+ provider: 'cert-manager';
22
+ /** Provider-specific settings */
23
+ settings: {
24
+ /** Default ClusterIssuer */
25
+ clusterIssuer: string;
26
+ /** Default certificate duration */
27
+ duration: string;
28
+ /** Default renew before expiry */
29
+ renewBefore: string;
30
+ };
31
+ }
32
+ /** Union of all cert provider configurations */
33
+ export type CertProviderValue = 'cert-manager' | CertConfig;
34
+ export declare const CertContext: import("../../core/src/context").Context<CertConfig | null>;
35
+ export interface CertProviderProps {
36
+ /**
37
+ * Certificate provider — string for simple cases, component for advanced config.
38
+ *
39
+ * @example
40
+ * // Simple string
41
+ * <CertProvider provider="cert-manager">
42
+ *
43
+ * @example
44
+ * // Advanced component
45
+ * <CertProvider provider={<CertManager clusterIssuer="letsencrypt-staging" />}>
46
+ */
47
+ provider: CertProviderValue;
48
+ /** Child components */
49
+ children?: unknown;
50
+ }
51
+ /**
52
+ * CertProvider — cluster-level certificate management.
53
+ *
54
+ * Sets up cert-manager for TLS certificates. All Endpoint/App children
55
+ * automatically get TLS certificates when tls prop is set.
56
+ *
57
+ * @example
58
+ * // Simple string provider
59
+ * import { CertProvider, App } from '@r8s/recipes'
60
+ *
61
+ * export default (
62
+ * <CertProvider provider="cert-manager">
63
+ * <App name="api" image="myapp:v1" host="api.example.com" tls={{ secretName: 'api-tls' }} />
64
+ * </CertProvider>
65
+ * )
66
+ *
67
+ * @example
68
+ * // Advanced component provider
69
+ * import { CertProvider, CertManager, App } from '@r8s/recipes'
70
+ *
71
+ * export default (
72
+ * <CertProvider provider={<CertManager clusterIssuer="letsencrypt-staging" duration="168h" />}>
73
+ * <App name="api" image="myapp:v1" host="api.example.com" tls={{ secretName: 'api-tls' }} />
74
+ * </CertProvider>
75
+ * )
76
+ */
77
+ export declare function CertProvider(props: CertProviderProps): import("@r8s/core").r8sElement;
78
+ //# sourceMappingURL=cert-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cert-provider.d.ts","sourceRoot":"","sources":["../src/cert-provider.tsx"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,UAAU,CAS/D;AAED,yCAAyC;AACzC,MAAM,WAAW,UAAU;IACzB,gCAAgC;IAChC,QAAQ,EAAE,cAAc,CAAA;IACxB,iCAAiC;IACjC,QAAQ,EAAE;QACR,4BAA4B;QAC5B,aAAa,EAAE,MAAM,CAAA;QACrB,mCAAmC;QACnC,QAAQ,EAAE,MAAM,CAAA;QAChB,kCAAkC;QAClC,WAAW,EAAE,MAAM,CAAA;KACpB,CAAA;CACF;AAED,gDAAgD;AAChD,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,UAAU,CAAA;AAE3D,eAAO,MAAM,WAAW,6DAAyC,CAAA;AAEjE,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;OAUG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,uBAAuB;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,kCA6BpD"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CertContext = void 0;
4
+ exports.CertManager = CertManager;
5
+ exports.CertProvider = CertProvider;
6
+ const core_1 = require("@r8s/core");
7
+ const defaults_1 = require("@r8s/core/defaults");
8
+ const defaults_2 = require("@r8s/core/defaults");
9
+ const crds_1 = require("@r8s/crds");
10
+ function CertManager(props) {
11
+ return {
12
+ provider: 'cert-manager',
13
+ settings: {
14
+ clusterIssuer: props.clusterIssuer ?? 'letsencrypt-prod',
15
+ duration: props.duration ?? '2160h',
16
+ renewBefore: props.renewBefore ?? '360h',
17
+ },
18
+ };
19
+ }
20
+ exports.CertContext = (0, defaults_1.createContext)(null);
21
+ /**
22
+ * CertProvider — cluster-level certificate management.
23
+ *
24
+ * Sets up cert-manager for TLS certificates. All Endpoint/App children
25
+ * automatically get TLS certificates when tls prop is set.
26
+ *
27
+ * @example
28
+ * // Simple string provider
29
+ * import { CertProvider, App } from '@r8s/recipes'
30
+ *
31
+ * export default (
32
+ * <CertProvider provider="cert-manager">
33
+ * <App name="api" image="myapp:v1" host="api.example.com" tls={{ secretName: 'api-tls' }} />
34
+ * </CertProvider>
35
+ * )
36
+ *
37
+ * @example
38
+ * // Advanced component provider
39
+ * import { CertProvider, CertManager, App } from '@r8s/recipes'
40
+ *
41
+ * export default (
42
+ * <CertProvider provider={<CertManager clusterIssuer="letsencrypt-staging" duration="168h" />}>
43
+ * <App name="api" image="myapp:v1" host="api.example.com" tls={{ secretName: 'api-tls' }} />
44
+ * </CertProvider>
45
+ * )
46
+ */
47
+ function CertProvider(props) {
48
+ const { provider, children } = props;
49
+ const sharedOperators = (0, core_1.useContext)(defaults_2.OperatorContext);
50
+ // Resolve provider config
51
+ const config = typeof provider === 'string'
52
+ ? {
53
+ provider,
54
+ settings: {
55
+ clusterIssuer: 'letsencrypt-prod',
56
+ duration: '2160h',
57
+ renewBefore: '360h',
58
+ },
59
+ }
60
+ : provider;
61
+ const resources = [];
62
+ // Declare cert-manager operator
63
+ const hasCertManager = sharedOperators.some((op) => op.name === 'cert-manager');
64
+ if (!hasCertManager) {
65
+ resources.push((0, core_1.declareOperator)(crds_1.operators['cert-manager']()));
66
+ }
67
+ return (0, core_1.jsx)(core_1.Fragment, {
68
+ children: [...resources, (0, core_1.jsx)(exports.CertContext.Provider, { value: config, children })],
69
+ });
70
+ }
71
+ //# sourceMappingURL=cert-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cert-provider.js","sourceRoot":"","sources":["../src/cert-provider.tsx"],"names":[],"mappings":";;;AAsBA,kCASC;AAiED,oCA6BC;AA7HD,oCAAsE;AACtE,iDAAkD;AAClD,iDAAoD;AACpD,oCAAqC;AAmBrC,SAAgB,WAAW,CAAC,KAAuB;IACjD,OAAO;QACL,QAAQ,EAAE,cAAc;QACxB,QAAQ,EAAE;YACR,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,kBAAkB;YACxD,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,OAAO;YACnC,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,MAAM;SACzC;KACF,CAAA;AACH,CAAC;AAoBY,QAAA,WAAW,GAAG,IAAA,wBAAa,EAAoB,IAAI,CAAC,CAAA;AAmBjE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;IAEpC,MAAM,eAAe,GAAG,IAAA,iBAAU,EAAC,0BAAe,CAAC,CAAA;IAEnD,0BAA0B;IAC1B,MAAM,MAAM,GACV,OAAO,QAAQ,KAAK,QAAQ;QAC1B,CAAC,CAAC;YACE,QAAQ;YACR,QAAQ,EAAE;gBACR,aAAa,EAAE,kBAAkB;gBACjC,QAAQ,EAAE,OAAO;gBACjB,WAAW,EAAE,MAAM;aACpB;SACF;QACH,CAAC,CAAC,QAAQ,CAAA;IAEd,MAAM,SAAS,GAA6B,EAAE,CAAA;IAE9C,gCAAgC;IAChC,MAAM,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,cAAc,CAAC,CAAA;IAC/E,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,SAAS,CAAC,IAAI,CAAC,IAAA,sBAAe,EAAC,gBAAS,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,IAAA,UAAG,EAAC,eAAQ,EAAE;QACnB,QAAQ,EAAE,CAAC,GAAG,SAAS,EAAE,IAAA,UAAG,EAAC,mBAAW,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;KACjF,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,49 @@
1
+ export interface DatabaseProps {
2
+ /** Resource name (also the default database name) */
3
+ name: string;
4
+ /** Kubernetes namespace (defaults to 'default') */
5
+ namespace?: string;
6
+ /** Storage size (e.g., '10Gi') for the dedicated cluster data volume */
7
+ storage?: string;
8
+ /** Operator version override. If not set, reads from OperatorContext or uses default. */
9
+ operatorVersion?: string;
10
+ /**
11
+ * Password for the database. Only needed when no secrets backend is
12
+ * configured on the Platform. When a secrets backend (openbao, vault,
13
+ * sealed-secrets) is active, credentials are managed automatically.
14
+ */
15
+ password?: string;
16
+ /** Child components rendered with this database's connection info in context */
17
+ children?: unknown;
18
+ }
19
+ /**
20
+ * CloudNativePG PostgreSQL database.
21
+ *
22
+ * @title Database
23
+ * @category Data & Analytics
24
+ *
25
+ * Creates a dedicated 3-instance HA CloudNativePG cluster for this database.
26
+ * When wrapped in a `<Database>` component, child components receive the
27
+ * connection info via DatabaseContext automatically.
28
+ *
29
+ * Credentials are managed by the secrets backend configured on the Platform.
30
+ * Without a secrets backend, CNPG manages the bootstrap secret automatically.
31
+ *
32
+ * @example
33
+ * import { Database } from '@r8s/recipes'
34
+ *
35
+ * export default <Database name="app-db" storage="10Gi" />
36
+ *
37
+ * @example
38
+ * import { Platform, Database, WebService } from '@r8s/recipes'
39
+ *
40
+ * export default (
41
+ * <Platform secrets={{ backend: 'openbao' }}>
42
+ * <Database name="app-db" storage="10Gi">
43
+ * <WebService name="api" image="myapp/api:v1" />
44
+ * </Database>
45
+ * </Platform>
46
+ * )
47
+ */
48
+ export declare function Database(props: DatabaseProps): import("@r8s/core").r8sElement[];
49
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.tsx"],"names":[],"mappings":"AAWA,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yFAAyF;IACzF,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,oCA6G5C"}