@techwavedev/agi-agent-kit 1.1.7 → 1.2.1
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.
Potentially problematic release.
This version of @techwavedev/agi-agent-kit might be problematic. Click here for more details.
- package/CHANGELOG.md +82 -1
- package/README.md +190 -12
- package/bin/init.js +30 -2
- package/package.json +6 -3
- package/templates/base/AGENTS.md +54 -23
- package/templates/base/README.md +325 -0
- package/templates/base/directives/memory_integration.md +95 -0
- package/templates/base/execution/memory_manager.py +309 -0
- package/templates/base/execution/session_boot.py +218 -0
- package/templates/base/execution/session_init.py +320 -0
- package/templates/base/skill-creator/SKILL_skillcreator.md +23 -36
- package/templates/base/skill-creator/scripts/init_skill.py +18 -135
- package/templates/skills/ec/README.md +31 -0
- package/templates/skills/ec/aws/SKILL.md +1020 -0
- package/templates/skills/ec/aws/defaults.yaml +13 -0
- package/templates/skills/ec/aws/references/common_patterns.md +80 -0
- package/templates/skills/ec/aws/references/mcp_servers.md +98 -0
- package/templates/skills/ec/aws-terraform/SKILL.md +349 -0
- package/templates/skills/ec/aws-terraform/references/best_practices.md +394 -0
- package/templates/skills/ec/aws-terraform/references/checkov_reference.md +337 -0
- package/templates/skills/ec/aws-terraform/scripts/configure_mcp.py +150 -0
- package/templates/skills/ec/confluent-kafka/SKILL.md +655 -0
- package/templates/skills/ec/confluent-kafka/references/ansible_playbooks.md +792 -0
- package/templates/skills/ec/confluent-kafka/references/ec_deployment.md +579 -0
- package/templates/skills/ec/confluent-kafka/references/kraft_migration.md +490 -0
- package/templates/skills/ec/confluent-kafka/references/troubleshooting.md +778 -0
- package/templates/skills/ec/confluent-kafka/references/upgrade_7x_to_8x.md +488 -0
- package/templates/skills/ec/confluent-kafka/scripts/kafka_health_check.py +435 -0
- package/templates/skills/ec/confluent-kafka/scripts/upgrade_preflight.py +568 -0
- package/templates/skills/ec/confluent-kafka/scripts/validate_config.py +455 -0
- package/templates/skills/ec/consul/SKILL.md +427 -0
- package/templates/skills/ec/consul/references/acl_setup.md +168 -0
- package/templates/skills/ec/consul/references/ha_config.md +196 -0
- package/templates/skills/ec/consul/references/troubleshooting.md +267 -0
- package/templates/skills/ec/consul/references/upgrades.md +213 -0
- package/templates/skills/ec/consul/scripts/consul_health_report.py +530 -0
- package/templates/skills/ec/consul/scripts/consul_status.py +264 -0
- package/templates/skills/ec/consul/scripts/generate_values.py +170 -0
- package/templates/skills/ec/documentation/SKILL.md +351 -0
- package/templates/skills/ec/documentation/references/best_practices.md +201 -0
- package/templates/skills/ec/documentation/scripts/analyze_code.py +307 -0
- package/templates/skills/ec/documentation/scripts/detect_changes.py +460 -0
- package/templates/skills/ec/documentation/scripts/generate_changelog.py +312 -0
- package/templates/skills/ec/documentation/scripts/sync_docs.py +272 -0
- package/templates/skills/ec/documentation/scripts/update_skill_docs.py +366 -0
- package/templates/skills/ec/gitlab/SKILL.md +529 -0
- package/templates/skills/ec/gitlab/references/agent_installation.md +416 -0
- package/templates/skills/ec/gitlab/references/api_reference.md +508 -0
- package/templates/skills/ec/gitlab/references/gitops_flux.md +465 -0
- package/templates/skills/ec/gitlab/references/troubleshooting.md +518 -0
- package/templates/skills/ec/gitlab/scripts/generate_agent_values.py +329 -0
- package/templates/skills/ec/gitlab/scripts/gitlab_agent_status.py +414 -0
- package/templates/skills/ec/jira/SKILL.md +484 -0
- package/templates/skills/ec/jira/references/jql_reference.md +148 -0
- package/templates/skills/ec/jira/scripts/add_comment.py +91 -0
- package/templates/skills/ec/jira/scripts/bulk_log_work.py +124 -0
- package/templates/skills/ec/jira/scripts/create_ticket.py +162 -0
- package/templates/skills/ec/jira/scripts/get_ticket.py +191 -0
- package/templates/skills/ec/jira/scripts/jira_client.py +383 -0
- package/templates/skills/ec/jira/scripts/log_work.py +154 -0
- package/templates/skills/ec/jira/scripts/search_tickets.py +104 -0
- package/templates/skills/ec/jira/scripts/update_comment.py +67 -0
- package/templates/skills/ec/jira/scripts/update_ticket.py +161 -0
- package/templates/skills/ec/karpenter/SKILL.md +301 -0
- package/templates/skills/ec/karpenter/references/ec2nodeclasses.md +421 -0
- package/templates/skills/ec/karpenter/references/migration.md +396 -0
- package/templates/skills/ec/karpenter/references/nodepools.md +400 -0
- package/templates/skills/ec/karpenter/references/troubleshooting.md +359 -0
- package/templates/skills/ec/karpenter/scripts/generate_ec2nodeclass.py +187 -0
- package/templates/skills/ec/karpenter/scripts/generate_nodepool.py +245 -0
- package/templates/skills/ec/karpenter/scripts/karpenter_status.py +359 -0
- package/templates/skills/ec/opensearch/SKILL.md +720 -0
- package/templates/skills/ec/opensearch/references/ml_neural_search.md +576 -0
- package/templates/skills/ec/opensearch/references/operator.md +532 -0
- package/templates/skills/ec/opensearch/references/query_dsl.md +532 -0
- package/templates/skills/ec/opensearch/scripts/configure_mcp.py +148 -0
- package/templates/skills/ec/victoriametrics/SKILL.md +598 -0
- package/templates/skills/ec/victoriametrics/references/kubernetes.md +531 -0
- package/templates/skills/ec/victoriametrics/references/prometheus_migration.md +333 -0
- package/templates/skills/ec/victoriametrics/references/troubleshooting.md +442 -0
- package/templates/skills/knowledge/SKILLS_CATALOG.md +274 -4
- package/templates/skills/knowledge/intelligent-routing/SKILL.md +237 -164
- package/templates/skills/knowledge/parallel-agents/SKILL.md +345 -73
- package/templates/skills/knowledge/plugin-discovery/SKILL.md +582 -0
- package/templates/skills/knowledge/plugin-discovery/scripts/platform_setup.py +1083 -0
- package/templates/skills/knowledge/design-md/README.md +0 -34
- package/templates/skills/knowledge/design-md/SKILL.md +0 -193
- package/templates/skills/knowledge/design-md/examples/DESIGN.md +0 -154
- package/templates/skills/knowledge/notebooklm-mcp/SKILL.md +0 -71
- package/templates/skills/knowledge/notebooklm-mcp/assets/example_asset.txt +0 -24
- package/templates/skills/knowledge/notebooklm-mcp/references/api_reference.md +0 -34
- package/templates/skills/knowledge/notebooklm-mcp/scripts/example.py +0 -19
- package/templates/skills/knowledge/react-components/README.md +0 -36
- package/templates/skills/knowledge/react-components/SKILL.md +0 -53
- package/templates/skills/knowledge/react-components/examples/gold-standard-card.tsx +0 -80
- package/templates/skills/knowledge/react-components/package-lock.json +0 -231
- package/templates/skills/knowledge/react-components/package.json +0 -16
- package/templates/skills/knowledge/react-components/resources/architecture-checklist.md +0 -15
- package/templates/skills/knowledge/react-components/resources/component-template.tsx +0 -37
- package/templates/skills/knowledge/react-components/resources/stitch-api-reference.md +0 -14
- package/templates/skills/knowledge/react-components/resources/style-guide.json +0 -27
- package/templates/skills/knowledge/react-components/scripts/fetch-stitch.sh +0 -30
- package/templates/skills/knowledge/react-components/scripts/validate.js +0 -68
- package/templates/skills/knowledge/self-update/SKILL.md +0 -60
- package/templates/skills/knowledge/self-update/scripts/update_kit.py +0 -103
- package/templates/skills/knowledge/stitch-loop/README.md +0 -54
- package/templates/skills/knowledge/stitch-loop/SKILL.md +0 -235
- package/templates/skills/knowledge/stitch-loop/examples/SITE.md +0 -73
- package/templates/skills/knowledge/stitch-loop/examples/next-prompt.md +0 -25
- package/templates/skills/knowledge/stitch-loop/resources/baton-schema.md +0 -61
- package/templates/skills/knowledge/stitch-loop/resources/site-template.md +0 -104
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
# GitOps with Flux
|
|
2
|
+
|
|
3
|
+
GitLab recommends Flux for GitOps deployments. This guide covers setting up Flux with GitLab Agent for continuous deployment to EKS clusters.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
### Why Flux?
|
|
10
|
+
|
|
11
|
+
| Feature | Flux (GitOps) | CI/CD (kubectl) |
|
|
12
|
+
| ---------------------- | ------------------------------ | ------------------------- |
|
|
13
|
+
| **Deployment Trigger** | Git push → automatic | Pipeline trigger → manual |
|
|
14
|
+
| **Security Model** | Pull-based, no credentials out | Push-based, tokens in CI |
|
|
15
|
+
| **Drift Detection** | Automatic remediation | Manual checks needed |
|
|
16
|
+
| **Audit Trail** | Git history = deploy history | Pipeline logs |
|
|
17
|
+
| **Recommended For** | Production environments | Dev/test, migrations |
|
|
18
|
+
|
|
19
|
+
### Architecture
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌───────────────────────────────────────────────────────────────┐
|
|
23
|
+
│ GitLab │
|
|
24
|
+
│ ┌─────────────────────────────────────────────────────────┐ │
|
|
25
|
+
│ │ flux-config repository │ │
|
|
26
|
+
│ │ ├── clusters/ │ │
|
|
27
|
+
│ │ │ ├── eks-nonprod/ │ │
|
|
28
|
+
│ │ │ │ ├── flux-system/ │ │
|
|
29
|
+
│ │ │ │ ├── apps/ │ │
|
|
30
|
+
│ │ │ │ └── infrastructure/ │ │
|
|
31
|
+
│ │ │ └── eks-prod/ │ │
|
|
32
|
+
│ │ └── apps/ │ │
|
|
33
|
+
│ │ └── my-app/ │ │
|
|
34
|
+
│ └─────────────────────────────────────────────────────────┘ │
|
|
35
|
+
│ ┌─────────────────────────────────────────────────────────┐ │
|
|
36
|
+
│ │ application repositories (source of manifests) │ │
|
|
37
|
+
│ └─────────────────────────────────────────────────────────┘ │
|
|
38
|
+
└───────────────────────────────────────────────────────────────┘
|
|
39
|
+
│
|
|
40
|
+
Git pull
|
|
41
|
+
│
|
|
42
|
+
┌───────────────────────────────────────────────────────────────┐
|
|
43
|
+
│ EKS Cluster │
|
|
44
|
+
│ ┌─────────────────────────────────────────────────────────┐ │
|
|
45
|
+
│ │ flux-system namespace │ │
|
|
46
|
+
│ │ ├── source-controller (fetches Git repos) │ │
|
|
47
|
+
│ │ ├── kustomize-controller (applies manifests) │ │
|
|
48
|
+
│ │ ├── helm-controller (manages Helm releases) │ │
|
|
49
|
+
│ │ └── notification-controller (sends events) │ │
|
|
50
|
+
│ └─────────────────────────────────────────────────────────┘ │
|
|
51
|
+
│ ┌─────────────────────────────────────────────────────────┐ │
|
|
52
|
+
│ │ gitlab-agent namespace │ │
|
|
53
|
+
│ │ └── agentk (provides cluster connectivity to GitLab) │ │
|
|
54
|
+
│ └─────────────────────────────────────────────────────────┘ │
|
|
55
|
+
└───────────────────────────────────────────────────────────────┘
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Setup
|
|
61
|
+
|
|
62
|
+
### Prerequisites
|
|
63
|
+
|
|
64
|
+
- GitLab Agent installed and connected
|
|
65
|
+
- `flux` CLI installed: `brew install fluxcd/tap/flux`
|
|
66
|
+
- GitLab access token with `api` and `write_repository` scopes
|
|
67
|
+
|
|
68
|
+
### Step 1: Enable Flux in Agent Config
|
|
69
|
+
|
|
70
|
+
Update `.gitlab/agents/<agent-name>/config.yaml`:
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
# Enable Flux integration
|
|
74
|
+
flux:
|
|
75
|
+
resource_inclusions:
|
|
76
|
+
- api_groups:
|
|
77
|
+
- "*"
|
|
78
|
+
resources:
|
|
79
|
+
- "*"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Step 2: Bootstrap Flux
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Set environment
|
|
86
|
+
export GITLAB_HOST="gitlab.example.com"
|
|
87
|
+
export GITLAB_TOKEN="glpat-xxxx"
|
|
88
|
+
export GITLAB_GROUP="path/to/group"
|
|
89
|
+
export FLUX_REPO="flux-config"
|
|
90
|
+
|
|
91
|
+
# Verify prerequisites
|
|
92
|
+
flux check --pre
|
|
93
|
+
|
|
94
|
+
# Bootstrap (creates flux-config repo if needed)
|
|
95
|
+
flux bootstrap gitlab \
|
|
96
|
+
--hostname=${GITLAB_HOST} \
|
|
97
|
+
--token-auth \
|
|
98
|
+
--owner=${GITLAB_GROUP} \
|
|
99
|
+
--repository=${FLUX_REPO} \
|
|
100
|
+
--branch=main \
|
|
101
|
+
--path=clusters/eks-nonprod \
|
|
102
|
+
--components-extra=image-reflector-controller,image-automation-controller
|
|
103
|
+
|
|
104
|
+
# Verify installation
|
|
105
|
+
flux check
|
|
106
|
+
kubectl get pods -n flux-system
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Step 3: Create GitLab Token Secret
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Create secret for Flux to access GitLab repos
|
|
113
|
+
kubectl create secret generic gitlab-token \
|
|
114
|
+
--namespace=flux-system \
|
|
115
|
+
--from-literal=username=git \
|
|
116
|
+
--from-literal=password=${GITLAB_TOKEN}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For self-signed certificates:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Create CA secret
|
|
123
|
+
kubectl create secret generic gitlab-ca \
|
|
124
|
+
--namespace=flux-system \
|
|
125
|
+
--from-file=ca.crt=./gitlab-ca.pem
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Configuration
|
|
131
|
+
|
|
132
|
+
### GitRepository Source
|
|
133
|
+
|
|
134
|
+
```yaml
|
|
135
|
+
# clusters/eks-nonprod/apps/my-app-source.yaml
|
|
136
|
+
apiVersion: source.toolkit.fluxcd.io/v1
|
|
137
|
+
kind: GitRepository
|
|
138
|
+
metadata:
|
|
139
|
+
name: my-app
|
|
140
|
+
namespace: flux-system
|
|
141
|
+
spec:
|
|
142
|
+
interval: 1m0s
|
|
143
|
+
url: https://gitlab.example.com/path/to/my-app.git
|
|
144
|
+
ref:
|
|
145
|
+
branch: main
|
|
146
|
+
secretRef:
|
|
147
|
+
name: gitlab-token
|
|
148
|
+
# For self-signed certs
|
|
149
|
+
certSecretRef:
|
|
150
|
+
name: gitlab-ca
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Kustomization
|
|
154
|
+
|
|
155
|
+
```yaml
|
|
156
|
+
# clusters/eks-nonprod/apps/my-app-kustomization.yaml
|
|
157
|
+
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
158
|
+
kind: Kustomization
|
|
159
|
+
metadata:
|
|
160
|
+
name: my-app
|
|
161
|
+
namespace: flux-system
|
|
162
|
+
spec:
|
|
163
|
+
interval: 5m0s
|
|
164
|
+
path: ./manifests
|
|
165
|
+
prune: true # Delete resources removed from Git
|
|
166
|
+
sourceRef:
|
|
167
|
+
kind: GitRepository
|
|
168
|
+
name: my-app
|
|
169
|
+
targetNamespace: production
|
|
170
|
+
healthChecks:
|
|
171
|
+
- apiVersion: apps/v1
|
|
172
|
+
kind: Deployment
|
|
173
|
+
name: my-app
|
|
174
|
+
namespace: production
|
|
175
|
+
timeout: 3m0s
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### HelmRelease
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
# clusters/eks-nonprod/infrastructure/cert-manager.yaml
|
|
182
|
+
apiVersion: source.toolkit.fluxcd.io/v1
|
|
183
|
+
kind: HelmRepository
|
|
184
|
+
metadata:
|
|
185
|
+
name: jetstack
|
|
186
|
+
namespace: flux-system
|
|
187
|
+
spec:
|
|
188
|
+
interval: 1h0m0s
|
|
189
|
+
url: https://charts.jetstack.io
|
|
190
|
+
---
|
|
191
|
+
apiVersion: helm.toolkit.fluxcd.io/v2
|
|
192
|
+
kind: HelmRelease
|
|
193
|
+
metadata:
|
|
194
|
+
name: cert-manager
|
|
195
|
+
namespace: flux-system
|
|
196
|
+
spec:
|
|
197
|
+
interval: 1h0m0s
|
|
198
|
+
chart:
|
|
199
|
+
spec:
|
|
200
|
+
chart: cert-manager
|
|
201
|
+
version: "1.13.x"
|
|
202
|
+
sourceRef:
|
|
203
|
+
kind: HelmRepository
|
|
204
|
+
name: jetstack
|
|
205
|
+
targetNamespace: cert-manager
|
|
206
|
+
install:
|
|
207
|
+
createNamespace: true
|
|
208
|
+
values:
|
|
209
|
+
installCRDs: true
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Repository Structure
|
|
215
|
+
|
|
216
|
+
### Recommended Layout
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
flux-config/
|
|
220
|
+
├── clusters/
|
|
221
|
+
│ ├── eks-nonprod/
|
|
222
|
+
│ │ ├── flux-system/ # Flux components (auto-generated)
|
|
223
|
+
│ │ │ └── gotk-*.yaml
|
|
224
|
+
│ │ ├── apps/ # Application deployments
|
|
225
|
+
│ │ │ ├── kustomization.yaml
|
|
226
|
+
│ │ │ ├── my-app.yaml
|
|
227
|
+
│ │ │ └── other-app.yaml
|
|
228
|
+
│ │ └── infrastructure/ # Shared infrastructure
|
|
229
|
+
│ │ ├── kustomization.yaml
|
|
230
|
+
│ │ ├── cert-manager.yaml
|
|
231
|
+
│ │ └── ingress-nginx.yaml
|
|
232
|
+
│ └── eks-prod/
|
|
233
|
+
│ ├── flux-system/
|
|
234
|
+
│ ├── apps/
|
|
235
|
+
│ └── infrastructure/
|
|
236
|
+
├── apps/ # Shared app definitions
|
|
237
|
+
│ ├── base/
|
|
238
|
+
│ │ └── my-app/
|
|
239
|
+
│ │ ├── deployment.yaml
|
|
240
|
+
│ │ ├── service.yaml
|
|
241
|
+
│ │ └── kustomization.yaml
|
|
242
|
+
│ ├── nonprod/
|
|
243
|
+
│ │ └── my-app/
|
|
244
|
+
│ │ └── kustomization.yaml
|
|
245
|
+
│ └── prod/
|
|
246
|
+
│ └── my-app/
|
|
247
|
+
│ └── kustomization.yaml
|
|
248
|
+
└── infrastructure/ # Shared infra definitions
|
|
249
|
+
├── cert-manager/
|
|
250
|
+
└── ingress-nginx/
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Dependency Ordering
|
|
254
|
+
|
|
255
|
+
```yaml
|
|
256
|
+
# clusters/eks-nonprod/apps/kustomization.yaml
|
|
257
|
+
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
258
|
+
kind: Kustomization
|
|
259
|
+
resources:
|
|
260
|
+
- my-app.yaml
|
|
261
|
+
- other-app.yaml
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```yaml
|
|
265
|
+
# clusters/eks-nonprod/infrastructure/kustomization.yaml
|
|
266
|
+
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
267
|
+
kind: Kustomization
|
|
268
|
+
resources:
|
|
269
|
+
- cert-manager.yaml
|
|
270
|
+
- ingress-nginx.yaml
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Use `dependsOn` for ordering:
|
|
274
|
+
|
|
275
|
+
```yaml
|
|
276
|
+
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
|
277
|
+
kind: Kustomization
|
|
278
|
+
metadata:
|
|
279
|
+
name: apps
|
|
280
|
+
namespace: flux-system
|
|
281
|
+
spec:
|
|
282
|
+
dependsOn:
|
|
283
|
+
- name: infrastructure # Apps wait for infra
|
|
284
|
+
# ...
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Notifications
|
|
290
|
+
|
|
291
|
+
### Send Deployment Events to GitLab
|
|
292
|
+
|
|
293
|
+
```yaml
|
|
294
|
+
# clusters/eks-nonprod/flux-system/notifications.yaml
|
|
295
|
+
apiVersion: notification.toolkit.fluxcd.io/v1beta3
|
|
296
|
+
kind: Provider
|
|
297
|
+
metadata:
|
|
298
|
+
name: gitlab
|
|
299
|
+
namespace: flux-system
|
|
300
|
+
spec:
|
|
301
|
+
type: gitlab
|
|
302
|
+
address: https://gitlab.example.com
|
|
303
|
+
secretRef:
|
|
304
|
+
name: gitlab-token
|
|
305
|
+
---
|
|
306
|
+
apiVersion: notification.toolkit.fluxcd.io/v1beta3
|
|
307
|
+
kind: Alert
|
|
308
|
+
metadata:
|
|
309
|
+
name: deployment-alerts
|
|
310
|
+
namespace: flux-system
|
|
311
|
+
spec:
|
|
312
|
+
providerRef:
|
|
313
|
+
name: gitlab
|
|
314
|
+
eventSeverity: info
|
|
315
|
+
eventSources:
|
|
316
|
+
- kind: Kustomization
|
|
317
|
+
name: "*"
|
|
318
|
+
- kind: HelmRelease
|
|
319
|
+
name: "*"
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Webhook for Immediate Reconciliation
|
|
323
|
+
|
|
324
|
+
```yaml
|
|
325
|
+
# Trigger immediate sync on Git push
|
|
326
|
+
apiVersion: notification.toolkit.fluxcd.io/v1
|
|
327
|
+
kind: Receiver
|
|
328
|
+
metadata:
|
|
329
|
+
name: gitlab-webhook
|
|
330
|
+
namespace: flux-system
|
|
331
|
+
spec:
|
|
332
|
+
type: gitlab
|
|
333
|
+
secretRef:
|
|
334
|
+
name: webhook-token
|
|
335
|
+
resources:
|
|
336
|
+
- kind: GitRepository
|
|
337
|
+
name: "*"
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Get webhook URL:
|
|
341
|
+
|
|
342
|
+
```bash
|
|
343
|
+
kubectl get receiver gitlab-webhook -n flux-system -o jsonpath='{.status.webhookPath}'
|
|
344
|
+
# Configure as webhook in GitLab project settings
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Operations
|
|
350
|
+
|
|
351
|
+
### Sync Status
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
# Check all Flux resources
|
|
355
|
+
flux get all
|
|
356
|
+
|
|
357
|
+
# Check specific app
|
|
358
|
+
flux get kustomization my-app
|
|
359
|
+
|
|
360
|
+
# Check source status
|
|
361
|
+
flux get sources git
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Manual Reconciliation
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
# Trigger immediate sync
|
|
368
|
+
flux reconcile source git my-app
|
|
369
|
+
|
|
370
|
+
# Reconcile kustomization
|
|
371
|
+
flux reconcile kustomization my-app
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Suspend/Resume
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
# Suspend (disable auto-sync)
|
|
378
|
+
flux suspend kustomization my-app
|
|
379
|
+
|
|
380
|
+
# Resume
|
|
381
|
+
flux resume kustomization my-app
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Rollback
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
# Git-based rollback (recommended)
|
|
388
|
+
git revert HEAD
|
|
389
|
+
git push
|
|
390
|
+
|
|
391
|
+
# Or rollback to specific commit
|
|
392
|
+
git reset --hard <commit>
|
|
393
|
+
git push --force-with-lease
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Logs
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
# Flux controller logs
|
|
400
|
+
kubectl logs -n flux-system deployment/source-controller
|
|
401
|
+
kubectl logs -n flux-system deployment/kustomize-controller
|
|
402
|
+
kubectl logs -n flux-system deployment/helm-controller
|
|
403
|
+
|
|
404
|
+
# Events
|
|
405
|
+
kubectl get events -n flux-system --sort-by='.lastTimestamp'
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Troubleshooting
|
|
411
|
+
|
|
412
|
+
### Common Issues
|
|
413
|
+
|
|
414
|
+
| Issue | Diagnosis | Solution |
|
|
415
|
+
| ------------------------- | ------------------------------- | --------------------------------------- |
|
|
416
|
+
| **Source not ready** | `flux get sources git my-app` | Check token, URL, branch name |
|
|
417
|
+
| **Certificate error** | x509 errors in logs | Add `certSecretRef` with CA cert |
|
|
418
|
+
| **Authentication failed** | 401/403 in source-controller | Verify token has correct permissions |
|
|
419
|
+
| **Kustomization stuck** | `flux get kustomization my-app` | Check health checks, resource conflicts |
|
|
420
|
+
| **Drift not reconciled** | Changes not applied | Check `prune: true`, verify interval |
|
|
421
|
+
|
|
422
|
+
### Debug Commands
|
|
423
|
+
|
|
424
|
+
```bash
|
|
425
|
+
# Describe resources
|
|
426
|
+
flux get sources git my-app
|
|
427
|
+
flux get kustomization my-app
|
|
428
|
+
|
|
429
|
+
# View events
|
|
430
|
+
flux events
|
|
431
|
+
|
|
432
|
+
# Force reconciliation
|
|
433
|
+
flux reconcile kustomization my-app --with-source
|
|
434
|
+
|
|
435
|
+
# Trace failures
|
|
436
|
+
flux trace kustomization my-app
|
|
437
|
+
|
|
438
|
+
# Preview changes (dry-run)
|
|
439
|
+
flux diff kustomization my-app
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## Best Practices
|
|
445
|
+
|
|
446
|
+
### Security
|
|
447
|
+
|
|
448
|
+
1. **Use deploy tokens** — Create read-only tokens for Flux
|
|
449
|
+
2. **Limit permissions** — Only expose necessary namespaces
|
|
450
|
+
3. **Seal secrets** — Use Sealed Secrets or SOPS for encrypted secrets
|
|
451
|
+
4. **Audit access** — Use Git history as audit trail
|
|
452
|
+
|
|
453
|
+
### Operations
|
|
454
|
+
|
|
455
|
+
1. **Use health checks** — Define healthChecks in Kustomization
|
|
456
|
+
2. **Set proper timeouts** — Don't let failures hang forever
|
|
457
|
+
3. **Enable pruning** — `prune: true` cleans up removed resources
|
|
458
|
+
4. **Monitor with alerts** — Configure notification provider
|
|
459
|
+
|
|
460
|
+
### Structure
|
|
461
|
+
|
|
462
|
+
1. **Separate environments** — Different cluster paths
|
|
463
|
+
2. **Use Kustomize overlays** — Base + environment overlays
|
|
464
|
+
3. **Order dependencies** — Infrastructure before apps
|
|
465
|
+
4. **Version pin** — Pin chart and image versions
|