-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdeployer.go
More file actions
794 lines (654 loc) · 23 KB
/
deployer.go
File metadata and controls
794 lines (654 loc) · 23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
package caodeploy
import (
"context"
"fmt"
"time"
"github.com/couchbaselabs/cbdinocluster/clusterdef"
"github.com/couchbaselabs/cbdinocluster/deployment"
"github.com/couchbaselabs/cbdinocluster/utils/caocontrol"
"github.com/couchbaselabs/cbdinocluster/utils/cbdcuuid"
"github.com/pkg/errors"
"go.uber.org/zap"
)
const (
CouchbaseClusterName = "cluster"
UiServiceName = CouchbaseClusterName + "-ui"
CngServiceName = CouchbaseClusterName + "-cloud-native-gateway-service"
)
type Deployer struct {
logger *zap.Logger
client *caocontrol.Controller
}
var _ deployment.Deployer = (*Deployer)(nil)
type NewDeployerOptions struct {
Logger *zap.Logger
Client *caocontrol.Controller
}
func NewDeployer(opts *NewDeployerOptions) (*Deployer, error) {
return &Deployer{
logger: opts.Logger,
client: opts.Client,
}, nil
}
func (d *Deployer) formatExpiry(expiry time.Time) string {
if expiry.IsZero() {
return "none"
}
return expiry.UTC().Format("20060102-150405")
}
func (d *Deployer) parseExpiry(expiryStr string) (time.Time, error) {
if expiryStr == "none" || expiryStr == "" {
return time.Time{}, nil
}
expiryTime, err := time.Parse("20060102-150405", expiryStr)
if err != nil {
return time.Time{}, errors.Wrap(err, "failed to parse expiry time")
}
return expiryTime, nil
}
func (d *Deployer) GetClient() *caocontrol.Controller {
return d.client
}
func (d *Deployer) ListClusters(ctx context.Context) ([]deployment.ClusterInfo, error) {
namespaces, err := d.client.ListNamespaces(ctx)
if err != nil {
return nil, errors.Wrap(err, "failed to list namespaces")
}
var clusters []deployment.ClusterInfo
for _, namespace := range namespaces.Items {
if namespace.Labels["cbdc2.cluster_id"] != "" {
clusterStatus := "broken"
cluster, err := d.client.GetCouchbaseCluster(ctx, namespace.Name, CouchbaseClusterName)
if err != nil {
d.logger.Debug("failed to read cluster info", zap.Error(err))
} else {
status, err := d.client.ParseCouchbaseClusterStatus(cluster)
if err != nil {
d.logger.Debug("failed to parse cluster status", zap.Error(err))
} else {
for _, condition := range status.Conditions {
if condition.Type == "Available" {
if condition.Status == "True" {
clusterStatus = "available"
} else if condition.Reason == "Creating" {
clusterStatus = "creating"
}
}
}
}
}
var expiryTime time.Time
expiryStr := namespace.Labels["cbdc2.expiry"]
if expiryStr != "" {
expiryTime, err = d.parseExpiry(expiryStr)
if err != nil {
d.logger.Debug("failed to parse cluster expiry", zap.Error(err))
}
}
clusters = append(clusters, &ClusterInfo{
ClusterID: namespace.Labels["cbdc2.cluster_id"],
Expiry: expiryTime,
State: clusterStatus,
})
}
}
return clusters, nil
}
func (d *Deployer) generateClusterSpec(
ctx context.Context,
def *clusterdef.Cluster,
isOpenShift bool,
) (map[string]string, map[string]interface{}, error) {
clusterVersion := ""
for _, nodeGrp := range def.NodeGroups {
if clusterVersion == "" {
clusterVersion = nodeGrp.Version
}
if clusterVersion != nodeGrp.Version {
return nil, nil, errors.New("all node groups must have the same couchbase version")
}
}
serverImagePath, err := caocontrol.GetServerImage(ctx, clusterVersion, isOpenShift)
if err != nil {
return nil, nil, errors.Wrap(err, "failed to identify server image")
}
gatewayImagePath := ""
if def.Cao.GatewayVersion != "" {
foundGatewayImagePath, err := caocontrol.GetGatewayImage(ctx, def.Cao.GatewayVersion, isOpenShift)
if err != nil {
return nil, nil, errors.Wrap(err, "failed to identify gateway image")
}
gatewayImagePath = foundGatewayImagePath
}
gatewayLogLevel := ""
if def.Cao.GatewayLogLevel != "" {
gatewayLogLevel = def.Cao.GatewayLogLevel
}
gatewayOtlpEndpoint := ""
if def.Cao.GatewayOtlpEndpoint != "" {
gatewayOtlpEndpoint = def.Cao.GatewayOtlpEndpoint
}
var serversRes []interface{}
for nodeGrpIdx, nodeGrp := range def.NodeGroups {
caoServices, err := clusterdef.ServicesToCaoServices(nodeGrp.Services)
if err != nil {
return nil, nil, errors.Wrap(err, "failed to generate cao server services list")
}
serversRes = append(serversRes, map[string]interface{}{
"size": nodeGrp.Count,
"name": fmt.Sprintf("group_%d", nodeGrpIdx),
"services": caoServices,
"pod": map[string]interface{}{
"spec": map[string]interface{}{
"imagePullSecrets": []map[string]interface{}{
{
"name": caocontrol.GhcrSecretName,
},
},
},
},
})
}
cngSpec := make(map[string]interface{})
if gatewayImagePath != "" {
cngSpec["image"] = gatewayImagePath
}
if gatewayLogLevel != "" {
cngSpec["logLevel"] = gatewayLogLevel
}
if len(cngSpec) == 0 {
cngSpec = nil
}
clusterSpec := map[string]interface{}{
"image": serverImagePath,
"buckets": map[string]interface{}{
"managed": false,
},
"security": map[string]interface{}{
"adminSecret": "cbdc2-admin-auth",
"rbac": map[string]interface{}{
"managed": true,
},
},
"networking": map[string]interface{}{
"exposeAdminConsole": true,
"exposedFeatures": []string{"admin", "xdcr", "client"},
"cloudNativeGateway": cngSpec,
},
"servers": serversRes,
}
annotations := make(map[string]string)
if gatewayOtlpEndpoint != "" {
annotations["cao.couchbase.com/networking.cloudNativeGateway.otlp.endpoint"] = gatewayOtlpEndpoint
}
return annotations, clusterSpec, nil
}
func (d *Deployer) NewCluster(ctx context.Context, def *clusterdef.Cluster) (deployment.ClusterInfo, error) {
isOpenShift, err := d.client.IsOpenShift(ctx)
if err != nil {
return nil, errors.Wrap(err, "failed to detect whether we are using openshift")
}
if def.Columnar {
return nil, errors.New("columnar is not supported for caodeploy")
}
clusterID := cbdcuuid.New()
namespace := "cbdc2-" + clusterID.String()
expiryTime := time.Time{}
if def.Expiry > 0 {
expiryTime = time.Now().Add(def.Expiry)
}
username := "Administrator"
password := "password"
if def.Docker.Username != "" {
username = def.Cao.Username
}
if def.Docker.Password != "" {
password = def.Cao.Password
}
err = d.client.CreateNamespace(ctx, namespace, map[string]string{
"cbdc2.type": "cluster",
"cbdc2.cluster_id": clusterID.String(),
"cbdc2.purpose": def.Purpose,
"cbdc2.expiry": d.formatExpiry(expiryTime),
})
if err != nil {
return nil, errors.Wrap(err, "failed to create cluster namespace")
}
err = d.client.InstallGhcrSecret(ctx, namespace)
if err != nil {
return nil, errors.Wrap(err, "failed to install ghcr secret")
}
err = d.client.InstallOperator(ctx, namespace, def.Cao.OperatorVersion, isOpenShift)
if err != nil {
return nil, errors.Wrap(err, "failed to install operator")
}
err = d.client.CreateBasicAuthSecret(ctx, namespace, "cbdc2-admin-auth", username, password)
if err != nil {
return nil, errors.Wrap(err, "failed to create admin auth")
}
clusterAnnotations, clusterSpec, err := d.generateClusterSpec(ctx, def, isOpenShift)
if err != nil {
return nil, errors.Wrap(err, "failed to generate cluster spec")
}
err = d.client.CreateCouchbaseCluster(ctx,
namespace, CouchbaseClusterName, nil,
clusterAnnotations, clusterSpec)
if err != nil {
return nil, errors.Wrap(err, "failed to create cluster resource")
}
_, err = d.client.GetService(ctx, namespace, CngServiceName)
if err != nil {
d.logger.Info("no cng service detected")
} else {
d.logger.Info("cng service detected, waiting for endpoints to be available")
err := d.client.WaitServiceHasEndpoints(ctx, namespace, CngServiceName)
if err != nil {
return nil, errors.Wrap(err, "failed to wait for cng service to have endpoints")
}
d.logger.Info("creating cbdc cng NodePort service")
err = d.client.CreateCbdcCngService(ctx, namespace, CouchbaseClusterName)
if err != nil {
return nil, errors.Wrap(err, "failed to create dino cng service")
}
}
return ClusterInfo{
ClusterID: clusterID.String(),
Expiry: time.Time{},
State: "running",
}, nil
}
func (d *Deployer) GetDefinition(ctx context.Context, clusterID string) (*clusterdef.Cluster, error) {
return nil, errors.New("caodeploy does not support fetching the cluster definition")
}
func (d *Deployer) UpdateClusterExpiry(ctx context.Context, clusterID string, newExpiryTime time.Time) error {
return errors.New("caodeploy does not support updating cluster expiry")
}
func (d *Deployer) ModifyCluster(ctx context.Context, clusterID string, def *clusterdef.Cluster) error {
isOpenShift, err := d.client.IsOpenShift(ctx)
if err != nil {
return errors.Wrap(err, "failed to detect whether we are using openshift")
}
for _, nodeGrp := range def.NodeGroups {
if nodeGrp.ForceNew {
return errors.New("cao cluster modification does not yet support force-new")
}
}
namespaceName, err := d.getClusterNamespace(ctx, clusterID)
if err != nil {
return err
}
clusterAnnotations, clusterSpec, err := d.generateClusterSpec(ctx, def, isOpenShift)
if err != nil {
return errors.Wrap(err, "failed to generate cluster spec")
}
err = d.client.UpdateCouchbaseClusterSpec(ctx, namespaceName, CouchbaseClusterName, clusterAnnotations, clusterSpec)
if err != nil {
return errors.Wrap(err, "failed to update cluster spec")
}
return nil
}
func (d *Deployer) AddNode(ctx context.Context, clusterID string) (string, error) {
return "", errors.New("caodeploy does not support cluster node addition")
}
func (d *Deployer) RemoveNode(ctx context.Context, clusterID string, nodeID string) error {
return errors.New("caodeploy does not support cluster node removal")
}
func (d *Deployer) getClusterNamespace(ctx context.Context, clusterID string) (string, error) {
namespaces, err := d.client.ListNamespaces(ctx)
if err != nil {
return "", errors.Wrap(err, "failed to list namespaces")
}
var namespaceName string
for _, namespace := range namespaces.Items {
if namespace.Labels["cbdc2.cluster_id"] == clusterID {
namespaceName = namespace.Name
}
}
return namespaceName, nil
}
func (d *Deployer) RemoveCluster(ctx context.Context, clusterID string) error {
namespaceName, err := d.getClusterNamespace(ctx, clusterID)
if err != nil {
return err
}
if namespaceName != "" {
err = d.client.DeleteNamespaces(ctx, []string{namespaceName})
if err != nil {
return errors.Wrap(err, "failed delete namespaces")
}
}
return nil
}
func (d *Deployer) RemoveAll(ctx context.Context) error {
namespaces, err := d.client.ListNamespaces(ctx)
if err != nil {
return errors.Wrap(err, "failed to list namespaces")
}
var clusterNames []string
for _, namespace := range namespaces.Items {
if namespace.Labels["cbdc2.cluster_id"] != "" {
clusterNames = append(clusterNames, namespace.Name)
}
}
if len(clusterNames) > 0 {
err = d.client.DeleteNamespaces(ctx, clusterNames)
if err != nil {
return errors.Wrap(err, "failed delete namespaces")
}
}
return nil
}
func (d *Deployer) EnableIngresses(ctx context.Context, clusterID string) error {
isOpenShift, err := d.client.IsOpenShift(ctx)
if err != nil {
return errors.Wrap(err, "failed to detect whether we are using openshift")
}
if !isOpenShift {
return errors.New("ingresses are currently only supported with openshift")
}
namespace, err := d.getClusterNamespace(ctx, clusterID)
if err != nil {
return err
}
d.logger.Info("creating ui route")
// this must be a short name or we hit dns name length limits
err = d.client.CreateRoute(ctx, namespace, "ui", map[string]interface{}{
"tls": map[string]interface{}{
"termination": "edge",
},
"to": map[string]interface{}{
"kind": "Service",
"name": UiServiceName,
},
"port": map[string]interface{}{
"targetPort": 8091,
},
})
if err != nil {
return errors.Wrap(err, "failed to create ui route")
}
_, err = d.client.GetService(ctx, namespace, CngServiceName)
if err != nil {
d.logger.Info("no cng service detected")
} else {
d.logger.Info("cng service detected, creating cng route")
// this must be a short name or we hit dns name length limits
err = d.client.CreateRoute(ctx, namespace, "cng", map[string]interface{}{
"tls": map[string]interface{}{
"termination": "passthrough",
},
"to": map[string]interface{}{
"kind": "Service",
"name": CngServiceName,
},
"port": map[string]interface{}{
"targetPort": 18098,
},
})
if err != nil {
return errors.Wrap(err, "failed to create cng route")
}
}
return nil
}
func (d *Deployer) DisableIngresses(ctx context.Context, clusterID string) error {
namespace, err := d.getClusterNamespace(ctx, clusterID)
if err != nil {
return err
}
allDeletesFailed := true
err = d.client.DeleteRoute(ctx, namespace, "ui")
if err != nil {
d.logger.Debug("failed to delete ui route", zap.Error(err))
} else {
allDeletesFailed = false
}
err = d.client.DeleteRoute(ctx, namespace, "cng")
if err != nil {
d.logger.Debug("failed to delete cng route", zap.Error(err))
} else {
allDeletesFailed = false
}
if allDeletesFailed {
return errors.New("route deletions failed")
}
return nil
}
func (d *Deployer) GetConnectInfo(ctx context.Context, clusterID string) (*deployment.ConnectInfo, error) {
namespaceName, err := d.getClusterNamespace(ctx, clusterID)
if err != nil {
return nil, err
}
nodes, err := d.client.GetNodes(ctx)
if err != nil {
return nil, errors.Wrap(err, "failed to get nodes")
}
var externalIP string
for _, node := range nodes.Items {
for _, address := range node.Status.Addresses {
// use the first IP we find
externalIP = address.Address
break
}
if externalIP != "" {
break
}
}
if externalIP == "" {
return nil, errors.New("could not identify node IP to use")
}
service, err := d.client.GetService(ctx, namespaceName, CouchbaseClusterName+"-ui")
if err != nil {
return nil, errors.Wrap(err, "failed to get service")
}
var mgmtAddr string
var mgmtTlsAddr string
var connstr string
var connstrTls string
for _, port := range service.Spec.Ports {
switch port.Name {
case "couchbase-ui":
mgmtAddr = fmt.Sprintf("http://%s:%d", externalIP, port.NodePort)
case "couchbase-ui-tls":
mgmtTlsAddr = fmt.Sprintf("https://%s:%d", externalIP, port.NodePort)
case "data":
connstr = fmt.Sprintf("couchbase://%s:%d", externalIP, port.NodePort)
case "data-tls":
connstrTls = fmt.Sprintf("couchbases://%s:%d", externalIP, port.NodePort)
}
}
var connstrCb2 string
service, err = d.client.GetService(ctx, namespaceName, "cbdc2-"+CouchbaseClusterName+"-cng-service")
if err == nil {
for _, port := range service.Spec.Ports {
switch port.Name {
case "cloud-native-gateway-https":
connstrCb2 = fmt.Sprintf("couchbase2://%s:%d", externalIP, port.NodePort)
}
}
}
return &deployment.ConnectInfo{
ConnStr: connstr,
ConnStrTls: connstrTls,
ConnStrCb2: connstrCb2,
Mgmt: mgmtAddr,
MgmtTls: mgmtTlsAddr,
DataApiConnstr: "",
}, nil
}
func (d *Deployer) GetIngressConnectInfo(ctx context.Context, clusterID string) (*deployment.ConnectInfo, error) {
namespaceName, err := d.getClusterNamespace(ctx, clusterID)
if err != nil {
return nil, err
}
var mgmtTlsAddr string
var connstrCb2 string
uiHost, err := d.client.GetRouteHost(ctx, namespaceName, "ui")
if err == nil {
mgmtTlsAddr = fmt.Sprintf("https://%s:443", uiHost)
}
cngHost, err := d.client.GetRouteHost(ctx, namespaceName, "cng")
if err == nil {
connstrCb2 = fmt.Sprintf("couchbase2://%s:443", cngHost)
}
return &deployment.ConnectInfo{
ConnStr: "",
ConnStrTls: "",
ConnStrCb2: connstrCb2,
Mgmt: "",
MgmtTls: mgmtTlsAddr,
}, nil
}
func (d *Deployer) Cleanup(ctx context.Context) error {
curTime := time.Now()
namespaces, err := d.client.ListNamespaces(ctx)
if err != nil {
return errors.Wrap(err, "failed to list namespaces")
}
var clusterNames []string
for _, namespace := range namespaces.Items {
if namespace.Labels["cbdc2.cluster_id"] != "" {
expiryStr := namespace.Labels["cbdc2.expiry"]
expiryTime, err := d.parseExpiry(expiryStr)
if err != nil {
d.logger.Debug("failed to parse cluster expiry time", zap.Error(err))
continue
}
if !expiryTime.IsZero() && !expiryTime.After(curTime) {
clusterNames = append(clusterNames, namespace.Name)
}
}
}
if len(clusterNames) > 0 {
err = d.client.DeleteNamespaces(ctx, clusterNames)
if err != nil {
return errors.Wrap(err, "failed delete namespaces")
}
}
return nil
}
func (d *Deployer) ListUsers(ctx context.Context, clusterID string) ([]deployment.UserInfo, error) {
return nil, errors.New("caodeploy does not support listing users")
}
func (d *Deployer) CreateUser(ctx context.Context, clusterID string, opts *deployment.CreateUserOptions) error {
return errors.New("caodeploy does not support creating users")
}
func (d *Deployer) DeleteUser(ctx context.Context, clusterID string, username string) error {
return errors.New("caodeploy does not support deleting users")
}
func (d *Deployer) ListBuckets(ctx context.Context, clusterID string) ([]deployment.BucketInfo, error) {
return nil, errors.New("caodeploy does not support listing buckets")
}
func (d *Deployer) CreateBucket(ctx context.Context, clusterID string, opts *deployment.CreateBucketOptions) error {
return errors.New("caodeploy does not support creating buckets")
}
func (d *Deployer) DeleteBucket(ctx context.Context, clusterID string, bucketName string) error {
return errors.New("caodeploy does not support deleting buckets")
}
func (d *Deployer) LoadSampleBucket(ctx context.Context, clusterID string, bucketName string) error {
return errors.New("caodeploy does not support loading sample buckets")
}
func (d *Deployer) GetCertificate(ctx context.Context, clusterID string) (string, error) {
return "", errors.New("caodeploy does not support getting certificates")
}
func (d *Deployer) GetGatewayCertificate(ctx context.Context, clusterID string) (string, error) {
namespaceName, err := d.getClusterNamespace(ctx, clusterID)
if err != nil {
return "", err
}
secret, err := d.client.GetSecret(ctx, namespaceName, "couchbase-cloud-native-gateway-self-signed-secret-cluster")
if err != nil {
return "", errors.Wrap(err, "failed to get secret")
}
secretData := secret.Data["tls.crt"]
if len(secretData) == 0 {
return "", errors.New("secret data was unexpectedly empty")
}
return string(secretData), nil
}
func (d *Deployer) GetMetrics(ctx context.Context, clusterID string) (string, error) {
return "", errors.New("caodeploy does not support getting metrics")
}
func (d *Deployer) ExecuteQuery(ctx context.Context, clusterID string, query string) (string, error) {
return "", errors.New("caodeploy does not support executing queries")
}
func (d *Deployer) ListCollections(ctx context.Context, clusterID string, bucketName string) ([]deployment.ScopeInfo, error) {
return nil, errors.New("caodeploy does not support getting collections")
}
func (d *Deployer) CreateScope(ctx context.Context, clusterID string, bucketName, scopeName string) error {
return errors.New("caodeploy does not support creating scopes")
}
func (d *Deployer) CreateCollection(ctx context.Context, clusterID string, bucketName, scopeName, collectionName string) error {
return errors.New("caodeploy does not support creating collections")
}
func (d *Deployer) DeleteScope(ctx context.Context, clusterID string, bucketName, scopeName string) error {
return errors.New("caodeploy does not support deleting scopes")
}
func (d *Deployer) DeleteCollection(ctx context.Context, clusterID string, bucketName, scopeName, collectionName string) error {
return errors.New("caodeploy does not support deleting collections")
}
func (d *Deployer) BlockNodeTraffic(ctx context.Context, clusterID string, nodeIDs []string, trafficType deployment.BlockNodeTrafficType, rejectType string) error {
return errors.New("caodeploy does not support traffic control")
}
func (d *Deployer) AllowNodeTraffic(ctx context.Context, clusterID string, nodeIDs []string) error {
return errors.New("caodeploy does not support traffic control")
}
func (d *Deployer) PartitionNodeTraffic(ctx context.Context, clusterID string, nodeIDs []string, rejectType string) error {
return errors.New("caodeploy does not support traffic control")
}
func (d *Deployer) CollectLogs(ctx context.Context, clusterID string, destPath string) ([]string, error) {
namespaceName, err := d.getClusterNamespace(ctx, clusterID)
if err != nil {
return nil, err
}
destPaths, err := d.client.CollectLogs(ctx, namespaceName, CouchbaseClusterName, destPath)
if err != nil {
return nil, errors.Wrap(err, "failed to collect logs using cao")
}
return destPaths, nil
}
func (d *Deployer) ListImages(ctx context.Context) ([]deployment.Image, error) {
return nil, errors.New("caodeploy does not support image listing")
}
func (d *Deployer) SearchImages(ctx context.Context, version string) ([]deployment.Image, error) {
return nil, errors.New("caodeploy does not support image search")
}
func (d *Deployer) PauseNode(ctx context.Context, clusterID string, nodeIDs []string) error {
return errors.New("caodeploy does not support node pausing")
}
func (d *Deployer) UnpauseNode(ctx context.Context, clusterID string, nodeIDs []string) error {
return errors.New("caodeploy does not support node pausing")
}
func (d *Deployer) RedeployCluster(ctx context.Context, clusterID string) error {
return errors.New("caodeploy does not support redeploy cluster")
}
func (d *Deployer) CreateCapellaLink(ctx context.Context, columnarID, linkName, clusterId, directID string) error {
return errors.New("caodeploy does not support create capella link")
}
func (d *Deployer) CreateS3Link(ctx context.Context, columnarID, linkName, region, endpoint, accessKey, secretKey string) error {
return errors.New("caodeploy does not support create S3 link")
}
func (d *Deployer) DropLink(ctx context.Context, columnarID, linkName string) error {
return errors.New("caodeploy does not support drop link")
}
func (d *Deployer) UpgradeCluster(ctx context.Context, clusterID string, CurrentImages string, NewImage string) error {
return errors.New("caodeploy does not support upgrade cluster command")
}
func (d *Deployer) EnableDataApi(ctx context.Context, clusterID string) error {
return errors.New("caodeploy does not support enabling data api")
}
func (d *Deployer) FailOverNode(ctx context.Context, clusterID string, nodeID string, failOverType deployment.FailOverType, allowUnsafe bool) error {
return errors.New("caodeploy does not support failing over a node")
}
func (d *Deployer) SetNodeRecovery(ctx context.Context, clusterID string, nodeID string, recoverType deployment.RecoveryType) error {
return errors.New("caodeploy does not support failover recovery")
}
func (d *Deployer) RebalanceCluster(ctx context.Context, clusterID string, nodesToEject []string) error {
return errors.New("caodeploy does not support rebalance cluster")
}
func (d *Deployer) KillCouchbase(ctx context.Context, clusterID string, nodes []string) error {
return errors.New("caodeploy does not support killing couchbase process")
}
func (d *Deployer) SetAutoFailover(ctx context.Context, clusterID string, enabled bool, timeout int) error {
return errors.New("caodeploy does not support setting auto-failover")
}