nolint:gocyclo
(output io.Writer, info system.Info)
| 412 | |
| 413 | //nolint:gocyclo |
| 414 | func printSwarmInfo(output io.Writer, info system.Info) { |
| 415 | if info.Swarm.LocalNodeState == swarm.LocalNodeStateInactive || info.Swarm.LocalNodeState == swarm.LocalNodeStateLocked { |
| 416 | return |
| 417 | } |
| 418 | fprintln(output, " NodeID:", info.Swarm.NodeID) |
| 419 | if info.Swarm.Error != "" { |
| 420 | fprintln(output, " Error:", info.Swarm.Error) |
| 421 | } |
| 422 | fprintln(output, " Is Manager:", info.Swarm.ControlAvailable) |
| 423 | if info.Swarm.Cluster != nil && info.Swarm.ControlAvailable && info.Swarm.Error == "" && info.Swarm.LocalNodeState != swarm.LocalNodeStateError { |
| 424 | fprintln(output, " ClusterID:", info.Swarm.Cluster.ID) |
| 425 | fprintln(output, " Managers:", info.Swarm.Managers) |
| 426 | fprintln(output, " Nodes:", info.Swarm.Nodes) |
| 427 | var strAddrPool strings.Builder |
| 428 | if info.Swarm.Cluster.DefaultAddrPool != nil { |
| 429 | for _, p := range info.Swarm.Cluster.DefaultAddrPool { |
| 430 | strAddrPool.WriteString(p.String() + " ") |
| 431 | } |
| 432 | fprintln(output, " Default Address Pool:", strAddrPool.String()) |
| 433 | fprintln(output, " SubnetSize:", info.Swarm.Cluster.SubnetSize) |
| 434 | } |
| 435 | if info.Swarm.Cluster.DataPathPort > 0 { |
| 436 | fprintln(output, " Data Path Port:", info.Swarm.Cluster.DataPathPort) |
| 437 | } |
| 438 | fprintln(output, " Orchestration:") |
| 439 | |
| 440 | taskHistoryRetentionLimit := int64(0) |
| 441 | if info.Swarm.Cluster.Spec.Orchestration.TaskHistoryRetentionLimit != nil { |
| 442 | taskHistoryRetentionLimit = *info.Swarm.Cluster.Spec.Orchestration.TaskHistoryRetentionLimit |
| 443 | } |
| 444 | fprintln(output, " Task History Retention Limit:", taskHistoryRetentionLimit) |
| 445 | fprintln(output, " Raft:") |
| 446 | fprintln(output, " Snapshot Interval:", info.Swarm.Cluster.Spec.Raft.SnapshotInterval) |
| 447 | if info.Swarm.Cluster.Spec.Raft.KeepOldSnapshots != nil { |
| 448 | fprintf(output, " Number of Old Snapshots to Retain: %d\n", *info.Swarm.Cluster.Spec.Raft.KeepOldSnapshots) |
| 449 | } |
| 450 | fprintln(output, " Heartbeat Tick:", info.Swarm.Cluster.Spec.Raft.HeartbeatTick) |
| 451 | fprintln(output, " Election Tick:", info.Swarm.Cluster.Spec.Raft.ElectionTick) |
| 452 | fprintln(output, " Dispatcher:") |
| 453 | fprintln(output, " Heartbeat Period:", units.HumanDuration(info.Swarm.Cluster.Spec.Dispatcher.HeartbeatPeriod)) |
| 454 | fprintln(output, " CA Configuration:") |
| 455 | fprintln(output, " Expiry Duration:", units.HumanDuration(info.Swarm.Cluster.Spec.CAConfig.NodeCertExpiry)) |
| 456 | fprintln(output, " Force Rotate:", info.Swarm.Cluster.Spec.CAConfig.ForceRotate) |
| 457 | if caCert := strings.TrimSpace(info.Swarm.Cluster.Spec.CAConfig.SigningCACert); caCert != "" { |
| 458 | fprintf(output, " Signing CA Certificate: \n%s\n\n", caCert) |
| 459 | } |
| 460 | if len(info.Swarm.Cluster.Spec.CAConfig.ExternalCAs) > 0 { |
| 461 | fprintln(output, " External CAs:") |
| 462 | for _, entry := range info.Swarm.Cluster.Spec.CAConfig.ExternalCAs { |
| 463 | fprintf(output, " %s: %s\n", entry.Protocol, entry.URL) |
| 464 | } |
| 465 | } |
| 466 | fprintln(output, " Autolock Managers:", info.Swarm.Cluster.Spec.EncryptionConfig.AutoLockManagers) |
| 467 | fprintln(output, " Root Rotation In Progress:", info.Swarm.Cluster.RootRotationInProgress) |
| 468 | } |
| 469 | fprintln(output, " Node Address:", info.Swarm.NodeAddr) |
| 470 | if len(info.Swarm.RemoteManagers) > 0 { |
| 471 | managers := []string{} |
no test coverage detected
searching dependent graphs…