@kustodian/nodes 1.0.0 → 1.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/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # @kustodian/nodes
2
+
3
+ Node definitions, roles, and labeling utilities for Kustodian Kubernetes cluster management.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @kustodian/nodes
9
+ ```
10
+
11
+ ## API Overview
12
+
13
+ ### Types
14
+
15
+ - **`NodeType`** - Node definition with name, role, address, SSH config, labels, taints, and annotations
16
+ - **`NodeRoleType`** - Node role: `'controller'` | `'worker'` | `'controller+worker'`
17
+ - **`NodeListType`** - Collection of nodes with cluster name and default SSH configuration
18
+ - **`TaintType`** - Kubernetes taint configuration with key, value, and effect
19
+ - **`SshConfigType`** - SSH connection settings (user, key path, port, known hosts)
20
+
21
+ ### Node Utilities
22
+
23
+ ```typescript
24
+ import {
25
+ is_controller,
26
+ is_worker,
27
+ get_controllers,
28
+ get_workers,
29
+ get_primary_controller,
30
+ get_node_ssh_config,
31
+ } from '@kustodian/nodes';
32
+ ```
33
+
34
+ ### Label Management
35
+
36
+ ```typescript
37
+ import {
38
+ format_label_key,
39
+ format_label_value,
40
+ format_node_labels,
41
+ calculate_label_changes,
42
+ calculate_all_label_changes,
43
+ } from '@kustodian/nodes';
44
+ ```
45
+
46
+ The labeler module provides diff-based label synchronization with support for add, update, and remove operations.
47
+
48
+ ### Profile Resolution
49
+
50
+ ```typescript
51
+ import {
52
+ resolve_node_profile,
53
+ resolve_all_node_profiles,
54
+ validate_profile_references,
55
+ } from '@kustodian/nodes';
56
+ ```
57
+
58
+ Profiles allow shared configuration (labels, taints, annotations) to be defined once and applied to multiple nodes. Node-specific values override profile defaults.
59
+
60
+ ## License
61
+
62
+ MIT
63
+
64
+ ## Repository
65
+
66
+ [github.com/lucasilverentand/kustodian](https://github.com/lucasilverentand/kustodian)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kustodian/nodes",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Node definitions, roles, and labeling for Kustodian",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -35,8 +35,8 @@
35
35
  "registry": "https://npm.pkg.github.com"
36
36
  },
37
37
  "dependencies": {
38
- "@kustodian/core": "workspace:*",
39
- "@kustodian/schema": "workspace:*"
38
+ "@kustodian/core": "1.1.0",
39
+ "@kustodian/schema": "1.3.0"
40
40
  },
41
41
  "devDependencies": {}
42
42
  }
package/src/profile.ts CHANGED
@@ -42,9 +42,7 @@ function merge_taints(
42
42
  }
43
43
 
44
44
  // Create a map of node taints keyed by key+effect for deduplication
45
- const node_taint_keys = new Set(
46
- node_taints.map((t) => `${t.key}:${t.effect}`),
47
- );
45
+ const node_taint_keys = new Set(node_taints.map((t) => `${t.key}:${t.effect}`));
48
46
 
49
47
  // Filter out profile taints that are overridden by node taints
50
48
  const filtered_profile_taints = profile_taints.filter(
@@ -80,9 +78,7 @@ export function resolve_node_profile(
80
78
 
81
79
  // Merge labels: profile as base, node overrides
82
80
  const merged_labels =
83
- profile.labels || node.labels
84
- ? { ...profile.labels, ...node.labels }
85
- : undefined;
81
+ profile.labels || node.labels ? { ...profile.labels, ...node.labels } : undefined;
86
82
 
87
83
  // Merge taints: deduplicate by key+effect, node wins
88
84
  const merged_taints = merge_taints(profile.taints, node.taints);
@@ -177,9 +173,7 @@ export function validate_profile_references(
177
173
 
178
174
  for (const profile_name of referenced) {
179
175
  if (!profiles.has(profile_name)) {
180
- const nodes_using = nodes
181
- .filter((n) => n.profile === profile_name)
182
- .map((n) => n.name);
176
+ const nodes_using = nodes.filter((n) => n.profile === profile_name).map((n) => n.name);
183
177
  errors.push(
184
178
  `Profile '${profile_name}' not found, referenced by nodes: ${nodes_using.join(', ')}`,
185
179
  );