@vfarcic/dot-ai 0.5.1 โ†’ 0.7.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 (146) hide show
  1. package/dist/cli.d.ts +3 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/{src/cli.ts โ†’ dist/cli.js} +19 -26
  4. package/dist/core/claude.d.ts +42 -0
  5. package/dist/core/claude.d.ts.map +1 -0
  6. package/dist/core/claude.js +229 -0
  7. package/dist/core/deploy-operation.d.ts +38 -0
  8. package/dist/core/deploy-operation.d.ts.map +1 -0
  9. package/dist/core/deploy-operation.js +101 -0
  10. package/dist/core/discovery.d.ts +162 -0
  11. package/dist/core/discovery.d.ts.map +1 -0
  12. package/dist/core/discovery.js +758 -0
  13. package/dist/core/error-handling.d.ts +167 -0
  14. package/dist/core/error-handling.d.ts.map +1 -0
  15. package/dist/core/error-handling.js +399 -0
  16. package/dist/core/index.d.ts +42 -0
  17. package/dist/core/index.d.ts.map +1 -0
  18. package/dist/core/index.js +123 -0
  19. package/dist/core/kubernetes-utils.d.ts +38 -0
  20. package/dist/core/kubernetes-utils.d.ts.map +1 -0
  21. package/dist/core/kubernetes-utils.js +177 -0
  22. package/dist/core/memory.d.ts +45 -0
  23. package/dist/core/memory.d.ts.map +1 -0
  24. package/dist/core/memory.js +113 -0
  25. package/dist/core/schema.d.ts +187 -0
  26. package/dist/core/schema.d.ts.map +1 -0
  27. package/dist/core/schema.js +655 -0
  28. package/dist/core/session-utils.d.ts +29 -0
  29. package/dist/core/session-utils.d.ts.map +1 -0
  30. package/dist/core/session-utils.js +121 -0
  31. package/dist/core/workflow.d.ts +70 -0
  32. package/dist/core/workflow.d.ts.map +1 -0
  33. package/dist/core/workflow.js +161 -0
  34. package/dist/index.d.ts +15 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +32 -0
  37. package/dist/interfaces/cli.d.ts +74 -0
  38. package/dist/interfaces/cli.d.ts.map +1 -0
  39. package/dist/interfaces/cli.js +769 -0
  40. package/dist/interfaces/mcp.d.ts +30 -0
  41. package/dist/interfaces/mcp.d.ts.map +1 -0
  42. package/dist/interfaces/mcp.js +105 -0
  43. package/dist/mcp/server.d.ts +9 -0
  44. package/dist/mcp/server.d.ts.map +1 -0
  45. package/dist/mcp/server.js +151 -0
  46. package/dist/tools/answer-question.d.ts +27 -0
  47. package/dist/tools/answer-question.d.ts.map +1 -0
  48. package/dist/tools/answer-question.js +696 -0
  49. package/dist/tools/choose-solution.d.ts +23 -0
  50. package/dist/tools/choose-solution.d.ts.map +1 -0
  51. package/dist/tools/choose-solution.js +171 -0
  52. package/dist/tools/deploy-manifests.d.ts +25 -0
  53. package/dist/tools/deploy-manifests.d.ts.map +1 -0
  54. package/dist/tools/deploy-manifests.js +74 -0
  55. package/dist/tools/generate-manifests.d.ts +23 -0
  56. package/dist/tools/generate-manifests.d.ts.map +1 -0
  57. package/dist/tools/generate-manifests.js +424 -0
  58. package/dist/tools/index.d.ts +11 -0
  59. package/dist/tools/index.d.ts.map +1 -0
  60. package/dist/tools/index.js +34 -0
  61. package/dist/tools/recommend.d.ts +23 -0
  62. package/dist/tools/recommend.d.ts.map +1 -0
  63. package/dist/tools/recommend.js +332 -0
  64. package/package.json +124 -2
  65. package/.claude/commands/context-load.md +0 -11
  66. package/.claude/commands/context-save.md +0 -16
  67. package/.claude/commands/prd-done.md +0 -115
  68. package/.claude/commands/prd-get.md +0 -25
  69. package/.claude/commands/prd-start.md +0 -87
  70. package/.claude/commands/task-done.md +0 -77
  71. package/.claude/commands/tests-reminder.md +0 -32
  72. package/.claude/settings.local.json +0 -20
  73. package/.eslintrc.json +0 -25
  74. package/.github/workflows/ci.yml +0 -170
  75. package/.prettierrc.json +0 -10
  76. package/.teller.yml +0 -8
  77. package/CLAUDE.md +0 -162
  78. package/assets/images/logo.png +0 -0
  79. package/bin/dot-ai.ts +0 -47
  80. package/bin.js +0 -19
  81. package/destroy.sh +0 -45
  82. package/devbox.json +0 -13
  83. package/devbox.lock +0 -225
  84. package/docs/API.md +0 -449
  85. package/docs/CONTEXT.md +0 -49
  86. package/docs/DEVELOPMENT.md +0 -203
  87. package/docs/NEXT_STEPS.md +0 -97
  88. package/docs/STAGE_BASED_API.md +0 -97
  89. package/docs/cli-guide.md +0 -798
  90. package/docs/design.md +0 -750
  91. package/docs/discovery-engine.md +0 -515
  92. package/docs/error-handling.md +0 -429
  93. package/docs/function-registration.md +0 -157
  94. package/docs/mcp-guide.md +0 -416
  95. package/renovate.json +0 -51
  96. package/setup.sh +0 -111
  97. package/src/core/claude.ts +0 -280
  98. package/src/core/deploy-operation.ts +0 -127
  99. package/src/core/discovery.ts +0 -900
  100. package/src/core/error-handling.ts +0 -562
  101. package/src/core/index.ts +0 -143
  102. package/src/core/kubernetes-utils.ts +0 -218
  103. package/src/core/memory.ts +0 -148
  104. package/src/core/schema.ts +0 -830
  105. package/src/core/session-utils.ts +0 -97
  106. package/src/core/workflow.ts +0 -234
  107. package/src/index.ts +0 -18
  108. package/src/interfaces/cli.ts +0 -872
  109. package/src/interfaces/mcp.ts +0 -183
  110. package/src/mcp/server.ts +0 -131
  111. package/src/tools/answer-question.ts +0 -807
  112. package/src/tools/choose-solution.ts +0 -169
  113. package/src/tools/deploy-manifests.ts +0 -94
  114. package/src/tools/generate-manifests.ts +0 -502
  115. package/src/tools/index.ts +0 -41
  116. package/src/tools/recommend.ts +0 -370
  117. package/tests/__mocks__/@kubernetes/client-node.ts +0 -106
  118. package/tests/build-system.test.ts +0 -345
  119. package/tests/configuration.test.ts +0 -226
  120. package/tests/core/deploy-operation.test.ts +0 -38
  121. package/tests/core/discovery.test.ts +0 -1648
  122. package/tests/core/error-handling.test.ts +0 -632
  123. package/tests/core/schema.test.ts +0 -1658
  124. package/tests/core/session-utils.test.ts +0 -245
  125. package/tests/core.test.ts +0 -439
  126. package/tests/fixtures/configmap-no-labels.yaml +0 -8
  127. package/tests/fixtures/crossplane-app-configuration.yaml +0 -6
  128. package/tests/fixtures/crossplane-providers.yaml +0 -45
  129. package/tests/fixtures/crossplane-rbac.yaml +0 -48
  130. package/tests/fixtures/invalid-configmap.yaml +0 -8
  131. package/tests/fixtures/invalid-deployment.yaml +0 -17
  132. package/tests/fixtures/test-deployment.yaml +0 -28
  133. package/tests/fixtures/valid-configmap.yaml +0 -15
  134. package/tests/infrastructure.test.ts +0 -426
  135. package/tests/interfaces/cli.test.ts +0 -1036
  136. package/tests/interfaces/mcp.test.ts +0 -139
  137. package/tests/kubernetes-utils.test.ts +0 -200
  138. package/tests/mcp/server.test.ts +0 -126
  139. package/tests/setup.ts +0 -31
  140. package/tests/tools/answer-question.test.ts +0 -367
  141. package/tests/tools/choose-solution.test.ts +0 -481
  142. package/tests/tools/deploy-manifests.test.ts +0 -185
  143. package/tests/tools/generate-manifests.test.ts +0 -441
  144. package/tests/tools/index.test.ts +0 -111
  145. package/tests/tools/recommend.test.ts +0 -180
  146. package/tsconfig.json +0 -34
package/docs/mcp-guide.md DELETED
@@ -1,416 +0,0 @@
1
- # DevOps AI Toolkit MCP Integration Guide
2
-
3
- **Complete guide for using DevOps AI Toolkit as an MCP (Model Context Protocol) server with AI development tools.**
4
-
5
- ## Table of Contents
6
-
7
- - [Quick Start](#quick-start)
8
- - [Configuration](#configuration)
9
- - [Supported AI Tools](#supported-ai-tools)
10
- - [MCP Tools Reference](#mcp-tools-reference)
11
- - [Workflow Examples](#workflow-examples)
12
- - [Troubleshooting](#troubleshooting)
13
- - [Advanced Configuration](#advanced-configuration)
14
-
15
- ## Quick Start
16
-
17
- ### 1. Configure MCP Server (Claude Code)
18
-
19
- Create `.mcp.json` in your project for Claude Code:
20
-
21
- ```json
22
- {
23
- "mcpServers": {
24
- "dot-ai": {
25
- "command": "npx",
26
- "args": ["--package=@vfarcic/dot-ai", "npm", "run", "start:mcp"],
27
- "env": {
28
- "ANTHROPIC_API_KEY": "your_anthropic_key_here",
29
- "DOT_AI_SESSION_DIR": "./tmp/sessions",
30
- "KUBECONFIG": "./configs/my-cluster.yaml"
31
- }
32
- }
33
- }
34
- }
35
- ```
36
-
37
- ### 2. Start Claude Code
38
-
39
- ```bash
40
- # Start Claude Code with MCP enabled
41
- claude
42
- ```
43
-
44
- ## Configuration
45
-
46
- ### Environment Variables
47
-
48
- | Variable | Required | Description | Example |
49
- |----------|----------|-------------|---------|
50
- | `ANTHROPIC_API_KEY` | โœ… Yes | Claude API key for AI recommendations | `sk-ant-api03-...` |
51
- | `DOT_AI_SESSION_DIR` | โœ… Yes | Session storage directory | `./tmp/sessions` |
52
- | `KUBECONFIG` | โŒ Optional | Kubernetes config file path | `./configs/cluster.yaml` |
53
-
54
- ### Path Resolution
55
-
56
- **Relative paths** are resolved relative to the MCP server's working directory:
57
-
58
- ```json
59
- {
60
- "cwd": "/Users/you/projects/myapp",
61
- "env": {
62
- "DOT_AI_SESSION_DIR": "./tmp/sessions", // โ†’ /Users/you/projects/myapp/tmp/sessions
63
- "KUBECONFIG": "./k8s/config.yaml" // โ†’ /Users/you/projects/myapp/k8s/config.yaml
64
- }
65
- }
66
- ```
67
-
68
- **Absolute paths** work as expected:
69
-
70
- ```json
71
- {
72
- "env": {
73
- "DOT_AI_SESSION_DIR": "/tmp/dot-ai-sessions",
74
- "KUBECONFIG": "/Users/you/.kube/config"
75
- }
76
- }
77
- ```
78
-
79
- ## Supported AI Tools
80
-
81
- ### Claude Code
82
-
83
- **Setup:**
84
- ```json
85
- {
86
- "mcpServers": {
87
- "dot-ai": {
88
- "command": "npx",
89
- "args": ["--package=@vfarcic/dot-ai", "npm", "run", "start:mcp"],
90
- "env": {
91
- "ANTHROPIC_API_KEY": "your_key_here",
92
- "DOT_AI_SESSION_DIR": "./tmp/sessions"
93
- }
94
- }
95
- }
96
- }
97
- ```
98
-
99
- **Usage:**
100
- ```bash
101
- claude --mcp
102
- # Now you can use dot-ai MCP tools directly in conversation
103
- ```
104
-
105
- ### Cursor
106
-
107
- **Setup:**
108
- 1. Open Cursor Settings
109
- 2. Navigate to "MCP Servers"
110
- 3. Add DevOps AI Toolkit configuration
111
- 4. Restart Cursor
112
-
113
- ### VS Code
114
-
115
- **Setup:**
116
- 1. Install MCP extension
117
- 2. Configure in `settings.json`
118
- 3. Restart VS Code
119
-
120
- ## MCP Tools Reference
121
-
122
- ### Core Workflow Tools
123
-
124
- #### `recommend`
125
- Get AI-powered deployment recommendations based on your cluster capabilities.
126
-
127
- **Usage:**
128
- ```
129
- Use the recommend tool to get deployment suggestions for my web application
130
- ```
131
-
132
- **Parameters:**
133
- - `intent` (required): Description of what you want to deploy
134
-
135
- **Returns:**
136
- - List of recommended solutions with scoring
137
- - Available configuration questions
138
-
139
- #### `chooseSolution`
140
- Select a specific solution and get its configuration questions.
141
-
142
- **Usage:**
143
- ```
144
- Use chooseSolution with solution ID sol_2024-12-01T123456_abc123
145
- ```
146
-
147
- **Parameters:**
148
- - `solutionId` (required): ID from recommend tool response
149
-
150
- **Returns:**
151
- - Configuration questions grouped by stage (required, basic, advanced, open)
152
-
153
- #### `answerQuestion`
154
- Provide answers to configuration questions for your chosen solution.
155
-
156
- **Usage:**
157
- ```
158
- Use answerQuestion to configure the database settings
159
- ```
160
-
161
- **Parameters:**
162
- - `solutionId` (required): Solution ID
163
- - `stage` (required): Question stage (required/basic/advanced/open)
164
- - `answers` (required): Your configuration answers
165
-
166
- **Returns:**
167
- - Next set of questions or completion status
168
-
169
- #### `generateManifests`
170
- Generate final Kubernetes manifests from your configured solution.
171
-
172
- **Usage:**
173
- ```
174
- Use generateManifests to create the deployment files
175
- ```
176
-
177
- **Parameters:**
178
- - `solutionId` (required): Fully configured solution ID
179
-
180
- **Returns:**
181
- - Generated Kubernetes YAML manifests
182
- - Deployment instructions
183
-
184
- #### `deployManifests`
185
- Deploy the generated manifests to your Kubernetes cluster.
186
-
187
- **Usage:**
188
- ```
189
- Use deployManifests to apply the configuration to the cluster
190
- ```
191
-
192
- **Parameters:**
193
- - `solutionId` (required): Solution ID with generated manifests
194
- - `timeout` (optional): Deployment timeout in seconds (default: 30)
195
-
196
- **Returns:**
197
- - Deployment status and results
198
- - Any deployment errors or warnings
199
-
200
- ### Utility Tools
201
-
202
- #### `canHelp`
203
- Check if DevOps AI Toolkit can assist with your specific deployment request.
204
-
205
- **Usage:**
206
- ```
207
- Use canHelp to check if you can deploy a microservice with database
208
- ```
209
-
210
- **Parameters:**
211
- - `request` (required): Description of your deployment needs
212
-
213
- **Returns:**
214
- - Whether DevOps AI Toolkit can help
215
- - Suggested approach or alternatives
216
-
217
- ## Workflow Examples
218
-
219
- ### Example 1: Simple Web Application
220
-
221
- ```
222
- User: I want to deploy a Node.js web application to my cluster
223
-
224
- Agent: I'll help you deploy a Node.js web application. Let me get recommendations for your cluster.
225
-
226
- [Uses recommend tool with intent "deploy Node.js web application"]
227
-
228
- Agent: Based on your cluster capabilities, I found 3 deployment options:
229
- 1. Standard Kubernetes Deployment + Service (Score: 85)
230
- 2. Cloud Run Service (Score: 78)
231
- 3. Knative Service (Score: 72)
232
-
233
- Let's go with the standard Kubernetes approach.
234
-
235
- [Uses chooseSolution with the selected solution ID]
236
-
237
- Agent: Great! I need some configuration details:
238
-
239
- Required Configuration:
240
- - Application name
241
- - Container image
242
- - Port number
243
-
244
- [Uses answerQuestion to collect responses]
245
-
246
- Agent: Perfect! Now generating your Kubernetes manifests...
247
-
248
- [Uses generateManifests and deployManifests]
249
-
250
- Agent: Successfully deployed! Your Node.js application is now running.
251
- ```
252
-
253
- ### Example 2: Database + Application
254
-
255
- ```
256
- User: I need to deploy a web app with a PostgreSQL database
257
-
258
- Agent: I'll help you set up both the application and database.
259
-
260
- [Uses recommend tool]
261
-
262
- Agent: I found several options including StatefulSet for PostgreSQL and Deployment for your app. Let me configure this step by step...
263
-
264
- [Goes through chooseSolution, answerQuestion cycle for both components]
265
-
266
- Agent: Deploying your complete stack now...
267
-
268
- [Uses generateManifests and deployManifests]
269
- ```
270
-
271
- ## Troubleshooting
272
-
273
- ### Common Issues
274
-
275
- #### MCP Server Won't Start
276
-
277
- **Symptoms:**
278
- - "Cannot connect to MCP server" error
279
- - Server process exits immediately
280
-
281
- **Solutions:**
282
- 1. **Check API key:**
283
- ```bash
284
- echo $ANTHROPIC_API_KEY
285
- # Should show your API key
286
- ```
287
-
288
- 2. **Verify session directory:**
289
- ```bash
290
- ls -la ./tmp/sessions
291
- # Directory should exist and be writable
292
- ```
293
-
294
- 3. **Test manual startup:**
295
- ```bash
296
- cd /path/to/dot-ai
297
- npm run start:mcp
298
- # Should start without errors
299
- ```
300
-
301
- #### Kubeconfig Not Found
302
-
303
- **Symptoms:**
304
- - "Kubeconfig file not found" errors
305
- - Cannot discover cluster resources
306
-
307
- **Solutions:**
308
- 1. **Check path resolution:**
309
- ```json
310
- {
311
- "cwd": "/your/project/root",
312
- "env": {
313
- "KUBECONFIG": "./path/to/config.yaml" // Relative to cwd
314
- }
315
- }
316
- ```
317
-
318
- 2. **Use absolute path:**
319
- ```json
320
- {
321
- "env": {
322
- "KUBECONFIG": "/Users/you/.kube/config"
323
- }
324
- }
325
- ```
326
-
327
- 3. **Verify file exists:**
328
- ```bash
329
- ls -la /Users/you/.kube/config
330
- kubectl config view # Test kubeconfig
331
- ```
332
-
333
- #### Session Directory Errors
334
-
335
- **Symptoms:**
336
- - "Session directory not found" errors
337
- - Permission denied errors
338
-
339
- **Solutions:**
340
- 1. **Create directory:**
341
- ```bash
342
- mkdir -p ./tmp/sessions
343
- chmod 755 ./tmp/sessions
344
- ```
345
-
346
- 2. **Check permissions:**
347
- ```bash
348
- ls -la ./tmp/
349
- # Should show write permissions for sessions directory
350
- ```
351
-
352
- ### Debug Mode
353
-
354
- For debugging MCP server issues, check the logs in your AI tool's MCP output. There are currently no specific debug environment variables.
355
-
356
- ## Advanced Configuration
357
-
358
- ### Multiple Clusters
359
-
360
- Configure different MCP servers for different clusters:
361
-
362
- ```json
363
- {
364
- "mcpServers": {
365
- "dot-ai-prod": {
366
- "command": "npm",
367
- "args": ["run", "start:mcp"],
368
- "cwd": "/path/to/dot-ai",
369
- "env": {
370
- "KUBECONFIG": "./configs/prod-cluster.yaml",
371
- "DOT_AI_SESSION_DIR": "./tmp/prod-sessions"
372
- }
373
- },
374
- "dot-ai-staging": {
375
- "command": "npm",
376
- "args": ["run", "start:mcp"],
377
- "cwd": "/path/to/dot-ai",
378
- "env": {
379
- "KUBECONFIG": "./configs/staging-cluster.yaml",
380
- "DOT_AI_SESSION_DIR": "./tmp/staging-sessions"
381
- }
382
- }
383
- }
384
- }
385
- ```
386
-
387
- ### Custom Session Management
388
-
389
- **Project-specific sessions:**
390
- ```json
391
- {
392
- "env": {
393
- "DOT_AI_SESSION_DIR": "./deployments/dot-ai-sessions"
394
- }
395
- }
396
- ```
397
-
398
- **Shared sessions across projects:**
399
- ```json
400
- {
401
- "env": {
402
- "DOT_AI_SESSION_DIR": "/Users/you/.dot-ai/sessions"
403
- }
404
- }
405
- ```
406
-
407
- ### Performance Tuning
408
-
409
- Performance tuning is currently handled automatically. For large clusters with many resources, the discovery process may take longer but should complete successfully.
410
-
411
- ## See Also
412
-
413
- - [CLI Guide](cli-guide.md) - Command-line interface documentation
414
- - [API Reference](API.md) - Programmatic usage
415
- - [Development Guide](DEVELOPMENT.md) - Contributing and architecture
416
- - [Manual Testing](manual-testing.md) - Testing procedures
package/renovate.json DELETED
@@ -1,51 +0,0 @@
1
- {
2
- "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "config:base",
5
- ":dependencyDashboard",
6
- ":semanticCommits",
7
- ":separatePatchReleases"
8
- ],
9
- "schedule": ["before 9am on monday"],
10
- "timezone": "UTC",
11
- "labels": ["dependencies"],
12
- "assignees": ["@vfarcic"],
13
- "packageRules": [
14
- {
15
- "matchDepTypes": ["devDependencies"],
16
- "matchUpdateTypes": ["patch", "minor"],
17
- "automerge": true,
18
- "automergeType": "pr"
19
- },
20
- {
21
- "matchPackageNames": ["@types/*"],
22
- "matchUpdateTypes": ["patch", "minor"],
23
- "automerge": true,
24
- "groupName": "TypeScript definitions"
25
- },
26
- {
27
- "matchPackageNames": ["jest", "@types/jest", "ts-jest"],
28
- "groupName": "Jest packages"
29
- },
30
- {
31
- "matchPackageNames": ["eslint*", "prettier", "@typescript-eslint/*"],
32
- "groupName": "Linting tools"
33
- },
34
- {
35
- "matchPackageNames": ["@kubernetes/client-node"],
36
- "reviewersFromCodeOwners": true,
37
- "labels": ["kubernetes", "major-update"]
38
- }
39
- ],
40
- "vulnerabilityAlerts": {
41
- "enabled": true,
42
- "schedule": ["at any time"]
43
- },
44
- "lockFileMaintenance": {
45
- "enabled": true,
46
- "schedule": ["before 9am on monday"]
47
- },
48
- "prHourlyLimit": 3,
49
- "prConcurrentLimit": 5,
50
- "rebaseWhen": "conflicted"
51
- }
package/setup.sh DELETED
@@ -1,111 +0,0 @@
1
- #!/bin/bash
2
-
3
- # setup.sh - Kubernetes cluster setup for DevOps AI Toolkit development and testing
4
- # This script creates a kind cluster with kubeconfig in the current directory
5
- # and can be used both locally and in CI/CD environments
6
-
7
- set -e # Exit on any error
8
-
9
- KUBECONFIG_PATH="$PWD/kubeconfig.yaml"
10
- CLUSTER_NAME="dot-ai-test"
11
-
12
- echo "๐Ÿš€ Setting up Kubernetes cluster for DevOps AI Toolkit..."
13
-
14
- # Check if kind is available
15
- if ! command -v kind &> /dev/null; then
16
- echo "โŒ Error: kind is not installed"
17
- echo "Please install kind: https://kind.sigs.k8s.io/docs/user/quick-start/#installation"
18
- exit 1
19
- fi
20
-
21
- # Check if kubectl is available
22
- if ! command -v kubectl &> /dev/null; then
23
- echo "โŒ Error: kubectl is not installed"
24
- echo "Please install kubectl: https://kubernetes.io/docs/tasks/tools/"
25
- exit 1
26
- fi
27
-
28
- # Check if helm is available
29
- if ! command -v helm &> /dev/null; then
30
- echo "โŒ Error: helm is not installed"
31
- echo "Please install helm: https://helm.sh/docs/intro/install/"
32
- exit 1
33
- fi
34
-
35
- # Clean up any existing cluster with the same name
36
- echo "๐Ÿงน Cleaning up any existing cluster..."
37
- kind delete cluster --name "$CLUSTER_NAME" 2>/dev/null || true
38
-
39
- # Create new kind cluster with kubeconfig and nginx Ingress support
40
- echo "๐Ÿ—๏ธ Creating kind cluster with nginx Ingress support..."
41
- cat <<EOF | kind create cluster --name "$CLUSTER_NAME" --kubeconfig "$KUBECONFIG_PATH" --config=-
42
- kind: Cluster
43
- apiVersion: kind.x-k8s.io/v1alpha4
44
- nodes:
45
- - role: control-plane
46
- kubeadmConfigPatches:
47
- - |
48
- kind: InitConfiguration
49
- nodeRegistration:
50
- kubeletExtraArgs:
51
- node-labels: "ingress-ready=true"
52
- extraPortMappings:
53
- - containerPort: 80
54
- hostPort: 80
55
- protocol: TCP
56
- - containerPort: 443
57
- hostPort: 443
58
- protocol: TCP
59
- EOF
60
-
61
- # Verify cluster is ready
62
- echo "โœ… Verifying cluster is ready..."
63
- export KUBECONFIG="$KUBECONFIG_PATH"
64
- kubectl cluster-info
65
-
66
- # Wait for all system pods to be ready
67
- echo "โณ Waiting for system pods to be ready..."
68
- kubectl wait --for=condition=Ready pods --all -n kube-system --timeout=300s
69
-
70
- # Install Crossplane
71
- echo "๐Ÿ”ง Installing Crossplane..."
72
- helm repo add crossplane-stable https://charts.crossplane.io/stable 2>/dev/null || true
73
- helm repo add crossplane-preview https://charts.crossplane.io/preview
74
- helm repo update
75
- helm install crossplane crossplane-preview/crossplane \
76
- --namespace crossplane-system --create-namespace \
77
- --set args='{"--enable-usages"}' --devel \
78
- --kubeconfig "$KUBECONFIG_PATH" --wait
79
-
80
- # Apply Crossplane RBAC and providers
81
- echo "๐Ÿ” Setting up Crossplane RBAC and providers..."
82
- kubectl apply -f tests/fixtures/crossplane-rbac.yaml --kubeconfig "$KUBECONFIG_PATH"
83
- kubectl apply -f tests/fixtures/crossplane-providers.yaml --kubeconfig "$KUBECONFIG_PATH"
84
- kubectl apply -f tests/fixtures/crossplane-app-configuration.yaml --kubeconfig "$KUBECONFIG_PATH"
85
-
86
- # Install nginx Ingress Controller
87
- echo "๐ŸŒ Installing nginx Ingress Controller..."
88
- kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml --kubeconfig "$KUBECONFIG_PATH"
89
-
90
- # Wait for nginx Ingress Controller to be ready
91
- echo "โณ Waiting for nginx Ingress Controller to be ready..."
92
- kubectl wait --namespace ingress-nginx \
93
- --for=condition=ready pod \
94
- --selector=app.kubernetes.io/component=controller \
95
- --timeout=300s --kubeconfig "$KUBECONFIG_PATH"
96
-
97
- # Create namespaces
98
- echo "๐Ÿ—๏ธ Creating namespaces..."
99
- kubectl create namespace a-team --kubeconfig "$KUBECONFIG_PATH"
100
- kubectl create namespace b-team --kubeconfig "$KUBECONFIG_PATH"
101
-
102
- echo "๐ŸŽ‰ Kubernetes cluster setup complete!"
103
- echo "๐Ÿ“ Kubeconfig saved to: $KUBECONFIG_PATH"
104
- echo "๐Ÿ”ง To use this cluster, run: export KUBECONFIG=$KUBECONFIG_PATH"
105
-
106
- # Optional: Display cluster info
107
- echo ""
108
- echo "๐Ÿ“Š Cluster Information:"
109
- kubectl get nodes
110
- echo ""
111
- kubectl get pods -A --field-selector=status.phase!=Running 2>/dev/null | head -10 || echo "All pods are running โœ…"