Skip to content

Commit 195a67a

Browse files
Cleanup (#169)
* removed node abstraction, and added --filter to executor ls * Add cleanup process submission on blueprint deletion and fix executor location config * improved conr * fixing test * fixing test
1 parent 833441f commit 195a67a

43 files changed

Lines changed: 554 additions & 2682 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ all: build
22
.PHONY: all build
33

44
BUILD_IMAGE ?= colonyos/colonies
5-
PUSH_IMAGE ?= colonyos/colonies:v1.9.3
5+
PUSH_IMAGE ?= colonyos/colonies:v1.9.4
66

77
VERSION := $(shell git rev-parse --short HEAD)
88
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')

deployment/blueprints/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ Deploys a docker executor specifically on the **local/main node**.
1818

1919
**Key Settings:**
2020
- `executorType`: `docker-reconciler` - Requires a docker-reconciler
21-
- `executorName`: `local-node-docker-reconciler` - Targets the main node
21+
- `executorName`: `local-docker-reconciler` - Targets the main node
2222
- `replicas`: 1 - Single executor instance
2323

2424
**Deploy:**
2525
```bash
2626
colonies blueprint add --spec local-docker-executor-deployment.json
2727
```
2828

29-
**Result:** The deployment will run specifically on the `local-node-docker-reconciler` (main node from colonies docker-compose).
29+
**Result:** The deployment will run specifically on the `local-docker-reconciler` (main node from colonies docker-compose).
3030

3131
## Executor Targeting Examples
3232

@@ -39,7 +39,7 @@ colonies blueprint add --spec local-docker-executor-deployment.json
3939
},
4040
"spec": {
4141
"executorType": "docker-reconciler",
42-
"executorName": "local-node-docker-reconciler" // Main node
42+
"executorName": "local-docker-reconciler" // Main node
4343
}
4444
}
4545
```
@@ -72,15 +72,15 @@ colonies blueprint add --spec local-docker-executor-deployment.json
7272
},
7373
"spec": {
7474
"executorType": "docker-reconciler",
75-
"executorName": "local-node-docker-reconciler" // Specific node
75+
"executorName": "local-docker-reconciler" // Specific node
7676
}
7777
}
7878
```
7979
✅ Guaranteed deployment on specific node
8080
⚠️ Fails if that reconciler is down
8181

8282
**Available reconcilers in default setup:**
83-
- `local-node-docker-reconciler` - Main node (in colonies docker-compose)
83+
- `local-docker-reconciler` - Main node (in colonies docker-compose)
8484
- `docker-reconciler-edge` - Edge node (in docker-reconciler docker-compose)
8585

8686
### Example 3: Target Edge Node

deployment/blueprints/local-docker-executor-deployment.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"kind": "ExecutorDeployment",
33
"metadata": {
4-
"name": "docker-executor"
4+
"name": "local-docker-executor"
55
},
66
"handler": {
7-
"executorName": "local-node-docker-reconciler"
7+
"executorName": "local-docker-reconciler"
88
},
99
"spec": {
1010
"image": "colonyos/dockerexecutor:v1.0.7",

docker-compose.env

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export COLONIES_SERVER_BACKENDS="http"
3030
# Configuration for the HTTP/REST API server backend
3131
export COLONIES_SERVER_HTTP_HOST="0.0.0.0" # Host to bind HTTP server (0.0.0.0 = all interfaces)
3232
export COLONIES_SERVER_HTTP_PORT="50080" # HTTP server port
33-
export COLONIES_SERVER_HTTP_TLS="false" # Enable TLS for HTTP
3433
# export COLONIES_SERVER_HTTP_TLS_CERT="/path/to/cert.pem" # TLS certificate (if TLS enabled)
3534
# export COLONIES_SERVER_HTTP_TLS_KEY="/path/to/key.pem" # TLS key (if TLS enabled)
3635
# ============================================================================
@@ -61,7 +60,6 @@ export COLONIES_CLIENT_LIBP2P_BOOTSTRAP_PEERS="/ip4/46.62.173.145/udp/4002/quic-
6160
# ============================================================================
6261
# Configuration for the gRPC server backend
6362
export COLONIES_SERVER_GRPC_PORT="50051" # gRPC server port
64-
export COLONIES_SERVER_GRPC_INSECURE="true" # Run without TLS (set to false for production)
6563
# export COLONIES_SERVER_GRPC_TLS_CERT="/path/to/cert.pem" # TLS certificate (required if INSECURE=false)
6664
# export COLONIES_SERVER_GRPC_TLS_KEY="/path/to/key.pem" # TLS key (required if INSECURE=false)
6765
# ============================================================================
@@ -96,10 +94,11 @@ export COLONIES_MONITOR_INTERVAL="1"
9694
export COLONIES_CLIENT_BACKENDS="http"
9795
export COLONIES_CLIENT_HTTP_HOST="localhost"
9896
export COLONIES_CLIENT_HTTP_PORT="50080"
99-
export COLONIES_CLIENT_HTTP_INSECURE="true"
10097
export COLONIES_CLIENT_GRPC_HOST="localhost"
10198
export COLONIES_CLIENT_GRPC_PORT="50051"
102-
export COLONIES_CLIENT_GRPC_INSECURE="true"
99+
100+
# TLS configuration (false = HTTP, true = HTTPS)
101+
export COLONIES_TLS="false"
103102

104103
# DHT discovery:
105104
# - Client will automatically find servers advertising on the DHT

docker-compose.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,14 @@ services:
5151
"
5252
5353
colonies-server:
54-
image: colonyos/colonies:v1.9.3
54+
image: colonyos/colonies:v1.9.4
5555
depends_on:
5656
- timescaledb
5757
environment:
5858
COLONIES_SERVER_BACKENDS: ${COLONIES_SERVER_BACKENDS}
59-
COLONIES_SERVER_HTTP_TLS: ${COLONIES_SERVER_HTTP_TLS}
6059
COLONIES_SERVER_HTTP_PORT: ${COLONIES_SERVER_HTTP_PORT}
6160
COLONIES_SERVER_GRPC_PORT: ${COLONIES_SERVER_GRPC_PORT}
62-
COLONIES_SERVER_GRPC_INSECURE: ${COLONIES_SERVER_GRPC_INSECURE}
63-
COLONIES_SERVER_GRPC_TLS_CERT: ${COLONIES_SERVER_GRPC_TLS_CERT:-}
64-
COLONIES_SERVER_GRPC_TLS_KEY: ${COLONIES_SERVER_GRPC_TLS_KEY:-}
61+
COLONIES_TLS: "false"
6562
COLONIES_SERVER_LIBP2P_PORT: ${COLONIES_SERVER_LIBP2P_PORT}
6663
COLONIES_SERVER_LIBP2P_IDENTITY: ${COLONIES_SERVER_LIBP2P_IDENTITY}
6764
COLONIES_SERVER_COAP_PORT: ${COLONIES_SERVER_COAP_PORT}
@@ -97,26 +94,23 @@ services:
9794
command: sh -c "colonies server start --initdb --port ${COLONIES_SERVER_HTTP_PORT} --relayport 25100 --etcdname server1 --etcdhost colonies-server --etcdclientport 23100 --etcdpeerport 24100 --initial-cluster server1=colonies-server:24100:25100:${COLONIES_SERVER_HTTP_PORT} --etcddatadir /var/colonies/etcd --insecure"
9895

9996
colonies-setup:
100-
image: colonyos/colonies:v1.9.3
97+
image: colonyos/colonies:v1.9.4
10198
depends_on:
10299
- colonies-server
103100
environment:
104101
COLONIES_CLIENT_BACKENDS: "http"
105102
# HTTP client config (inside docker, always use colonies-server as host)
106103
COLONIES_CLIENT_HTTP_HOST: "colonies-server"
107104
COLONIES_CLIENT_HTTP_PORT: ${COLONIES_SERVER_HTTP_PORT}
108-
COLONIES_CLIENT_HTTP_INSECURE: "true"
109105
# gRPC client config (inside docker, always use colonies-server as host)
110106
COLONIES_CLIENT_GRPC_HOST: "colonies-server"
111107
COLONIES_CLIENT_GRPC_PORT: ${COLONIES_SERVER_GRPC_PORT}
112-
COLONIES_CLIENT_GRPC_INSECURE: "true"
113108
# LibP2P client config
114109
COLONIES_CLIENT_LIBP2P_HOST: "/dns/colonies-server/tcp/${COLONIES_SERVER_LIBP2P_PORT}/p2p/12D3KooWSBx1mxbu7rJ8AMsSGHDhG8GRhwqHSVnHPbhZypPLFjgK"
115110
COLONIES_CLIENT_LIBP2P_BOOTSTRAP_PEERS: ${COLONIES_CLIENT_LIBP2P_BOOTSTRAP_PEERS}
116111
# Backward compatibility (hardcode colonies-server for docker containers)
117112
COLONIES_SERVER_HOST: "colonies-server"
118113
COLONIES_SERVER_PORT: ${COLONIES_SERVER_HTTP_PORT}
119-
COLONIES_SERVER_TLS: "false"
120114
COLONIES_TLS: "false"
121115
# Server and auth config
122116
COLONIES_SERVER_ID: ${COLONIES_SERVER_ID}
@@ -147,7 +141,7 @@ services:
147141
"
148142
149143
docker-reconciler:
150-
image: colonyos/docker-reconciler:v1.0.5
144+
image: colonyos/docker-reconciler:v1.0.6
151145
container_name: docker-reconciler
152146
restart: unless-stopped
153147
depends_on:
@@ -158,28 +152,22 @@ services:
158152
# HTTP client config (inside docker, always use colonies-server as host)
159153
COLONIES_CLIENT_HTTP_HOST: "colonies-server"
160154
COLONIES_CLIENT_HTTP_PORT: ${COLONIES_SERVER_HTTP_PORT}
161-
COLONIES_CLIENT_HTTP_INSECURE: "true"
162155
# gRPC client config (inside docker, always use colonies-server as host)
163156
COLONIES_CLIENT_GRPC_HOST: "colonies-server"
164157
COLONIES_CLIENT_GRPC_PORT: ${COLONIES_SERVER_GRPC_PORT}
165-
COLONIES_CLIENT_GRPC_INSECURE: "true"
166158
# LibP2P client config
167159
COLONIES_CLIENT_LIBP2P_HOST: "/dns/colonies-server/tcp/${COLONIES_SERVER_LIBP2P_PORT}/p2p/12D3KooWSBx1mxbu7rJ8AMsSGHDhG8GRhwqHSVnHPbhZypPLFjgK"
168160
COLONIES_CLIENT_LIBP2P_BOOTSTRAP_PEERS: ${COLONIES_CLIENT_LIBP2P_BOOTSTRAP_PEERS}
169161
# Backward compatibility (hardcode colonies-server for docker containers)
170162
COLONIES_SERVER_HOST: "colonies-server"
171163
COLONIES_SERVER_PORT: ${COLONIES_SERVER_HTTP_PORT}
172-
COLONIES_SERVER_TLS: "false"
173164
COLONIES_TLS: "false"
174165
# Auth config
175166
COLONIES_COLONY_NAME: ${COLONIES_COLONY_NAME}
176167
COLONIES_COLONY_PRVKEY: ${COLONIES_COLONY_PRVKEY}
177168
COLONIES_EXECUTOR_TYPE: "docker-reconciler"
178-
COLONIES_EXECUTOR_NAME: "local-node-docker-reconciler"
179-
COLONIES_INSECURE: "true"
180-
# Node config - Fixed node name to prevent new nodes on restart
181-
COLONIES_NODE_NAME: "local-node"
182-
COLONIES_NODE_LOCATION: "local-node"
169+
COLONIES_EXECUTOR_NAME: "local-docker-reconciler"
170+
COLONIES_EXECUTOR_LOCATION: "local"
183171
# S3/MinIO config for auto-injection into deployed containers
184172
AWS_S3_ENDPOINT: "minio:9000"
185173
AWS_S3_ACCESSKEY: "RrXN2vcLeHjBptG8a3Ay"

internal/cli/blueprint.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ var addBlueprintDefinitionCmd = &cobra.Command{
113113
CheckError(err)
114114

115115
// Set colony name if not specified
116-
if sd.Metadata.Namespace == "" {
117-
sd.Metadata.Namespace = ColonyName
116+
if sd.Metadata.ColonyName == "" {
117+
sd.Metadata.ColonyName = ColonyName
118118
}
119119

120120
addedSD, err := client.AddBlueprintDefinition(&sd, ColonyPrvKey)
121121
if err != nil {
122122
if strings.Contains(err.Error(), "duplicate key") {
123-
CheckError(errors.New("BlueprintDefinition with name '" + sd.Metadata.Name + "' already exists in colony '" + sd.Metadata.Namespace + "'"))
123+
CheckError(errors.New("BlueprintDefinition with name '" + sd.Metadata.Name + "' already exists in colony '" + sd.Metadata.ColonyName + "'"))
124124
}
125125
CheckError(err)
126126
}
@@ -131,7 +131,7 @@ var addBlueprintDefinitionCmd = &cobra.Command{
131131
"Kind": addedSD.Spec.Names.Kind,
132132
"Group": addedSD.Spec.Group,
133133
"Version": addedSD.Spec.Version,
134-
"ColonyName": addedSD.Metadata.Namespace,
134+
"ColonyName": addedSD.Metadata.ColonyName,
135135
}).Info("BlueprintDefinition added")
136136

137137
},
@@ -155,7 +155,7 @@ var getBlueprintDefinitionCmd = &cobra.Command{
155155
"BlueprintDefinitionID": sd.ID,
156156
"Name": sd.Metadata.Name,
157157
"Kind": sd.Spec.Names.Kind,
158-
"ColonyName": sd.Metadata.Namespace,
158+
"ColonyName": sd.Metadata.ColonyName,
159159
}).Info("BlueprintDefinition retrieved")
160160

161161
if JSON {
@@ -232,8 +232,8 @@ var addBlueprintCmd = &cobra.Command{
232232
CheckError(err)
233233

234234
// Set namespace (colony name) if not specified
235-
if blueprint.Metadata.Namespace == "" {
236-
blueprint.Metadata.Namespace = ColonyName
235+
if blueprint.Metadata.ColonyName == "" {
236+
blueprint.Metadata.ColonyName = ColonyName
237237
}
238238

239239
addedBlueprint, err := client.AddBlueprint(&blueprint, PrvKey)
@@ -243,7 +243,7 @@ var addBlueprintCmd = &cobra.Command{
243243
"BlueprintID": addedBlueprint.ID,
244244
"Name": addedBlueprint.Metadata.Name,
245245
"Kind": addedBlueprint.Kind,
246-
"Namespace": addedBlueprint.Metadata.Namespace,
246+
"Namespace": addedBlueprint.Metadata.ColonyName,
247247
}).Info("Blueprint added")
248248

249249
},
@@ -267,7 +267,7 @@ var getBlueprintCmd = &cobra.Command{
267267
"BlueprintID": blueprint.ID,
268268
"Name": blueprint.Metadata.Name,
269269
"Kind": blueprint.Kind,
270-
"Namespace": blueprint.Metadata.Namespace,
270+
"Namespace": blueprint.Metadata.ColonyName,
271271
}).Info("Blueprint retrieved")
272272

273273
if JSON {
@@ -328,8 +328,8 @@ var updateBlueprintCmd = &cobra.Command{
328328
CheckError(err)
329329

330330
// Set namespace (colony name) if not specified
331-
if blueprint.Metadata.Namespace == "" {
332-
blueprint.Metadata.Namespace = ColonyName
331+
if blueprint.Metadata.ColonyName == "" {
332+
blueprint.Metadata.ColonyName = ColonyName
333333
}
334334

335335
updatedBlueprint, err := client.UpdateBlueprint(&blueprint, PrvKey)

internal/cli/blueprint_table.go

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,47 @@ func printBlueprintsTableWithClient(c *client.ColoniesClient, blueprints []*core
179179
var cols = []table.Column{
180180
{ID: "name", Name: "Name", SortIndex: 1},
181181
{ID: "kind", Name: "Kind", SortIndex: 2},
182-
{ID: "replicas", Name: "Replicas", SortIndex: 3},
183-
{ID: "reconciling", Name: "Reconciling", SortIndex: 4},
184-
{ID: "oldgen", Name: "OldGen", SortIndex: 5},
185-
{ID: "generation", Name: "Gen", SortIndex: 6},
182+
{ID: "reconciler", Name: "Reconciler", SortIndex: 3},
183+
{ID: "replicas", Name: "Replicas", SortIndex: 4},
184+
{ID: "reconciling", Name: "Reconciling", SortIndex: 5},
185+
{ID: "oldgen", Name: "OldGen", SortIndex: 6},
186+
{ID: "generation", Name: "Gen", SortIndex: 7},
186187
}
187188
t.SetCols(cols)
188189

190+
// Build map of Kind -> ExecutorType from BlueprintDefinitions
191+
kindToExecutorType := make(map[string]string)
192+
if c != nil && len(blueprints) > 0 {
193+
defs, err := c.GetBlueprintDefinitions(ColonyName, PrvKey)
194+
if err == nil {
195+
for _, def := range defs {
196+
if def.Spec.Handler.ExecutorType != "" {
197+
kindToExecutorType[def.Spec.Names.Kind] = def.Spec.Handler.ExecutorType
198+
}
199+
}
200+
}
201+
}
202+
189203
for _, blueprint := range blueprints {
204+
// Get reconciler name from handler or definition
205+
reconcilerStr := "-"
206+
if blueprint.Handler != nil {
207+
if blueprint.Handler.ExecutorName != "" {
208+
reconcilerStr = blueprint.Handler.ExecutorName
209+
} else if len(blueprint.Handler.ExecutorNames) > 0 {
210+
reconcilerStr = blueprint.Handler.ExecutorNames[0]
211+
if len(blueprint.Handler.ExecutorNames) > 1 {
212+
reconcilerStr += "..."
213+
}
214+
}
215+
}
216+
// Fall back to executor type from definition
217+
if reconcilerStr == "-" {
218+
if execType, ok := kindToExecutorType[blueprint.Kind]; ok {
219+
reconcilerStr = "[" + execType + "]"
220+
}
221+
}
222+
190223
// Get replica information
191224
replicasStr := "-"
192225
reconcilingStr := "-"
@@ -325,6 +358,7 @@ func printBlueprintsTableWithClient(c *client.ColoniesClient, blueprints []*core
325358
row := []interface{}{
326359
termenv.String(blueprint.Metadata.Name).Foreground(theme.ColorCyan),
327360
termenv.String(blueprint.Kind).Foreground(theme.ColorViolet),
361+
termenv.String(reconcilerStr).Foreground(theme.ColorBlue),
328362
termenv.String(replicasStr).Foreground(theme.ColorMagenta),
329363
termenv.String(reconcilingStr).Foreground(getReconcilingColor(reconcilingStr, theme)),
330364
termenv.String(oldGenStr).Foreground(getOldGenColor(oldGenStr, theme)),

internal/cli/common.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ func parseEnv() {
198198
CheckError(err)
199199
}
200200

201-
TLSEnv := os.Getenv("COLONIES_SERVER_TLS")
201+
// COLONIES_TLS controls whether to use HTTPS (true) or HTTP (false)
202+
TLSEnv := os.Getenv("COLONIES_TLS")
202203
if TLSEnv == "true" {
203204
UseTLS = true
204205
Insecure = false

0 commit comments

Comments
 (0)