Skip to content

Commit aa8ed4c

Browse files
authored
Remove cidr flags from instructions of join preflights (#1887)
* Remove cidr flags from instructions of join preflights
1 parent 0def454 commit aa8ed4c

File tree

6 files changed

+46
-27
lines changed

6 files changed

+46
-27
lines changed

cmd/installer/cli/join_runpreflights.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ func runJoinPreflights(ctx context.Context, jcmd *kotsadm.JoinCommandResponse, f
108108
IgnoreHostPreflights: flags.ignoreHostPreflights,
109109
AssumeYes: flags.assumeYes,
110110
TCPConnectionsRequired: jcmd.TCPConnectionsRequired,
111+
IsJoin: true,
111112
}); err != nil {
112113
return err
113114
}

pkg/preflights/host-preflight.yaml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,12 @@ spec:
869869
outcomes:
870870
- fail:
871871
when: "true"
872-
message: The node IP {{ .NodeIP }} cannot be within the Pod CIDR range {{ .PodCIDR.CIDR }}. Use --pod-cidr to specify a different Pod CIDR, or use --network-interface to specify a different network interface.
872+
message: |
873+
{{ if .IsJoin -}}
874+
The node IP {{ .NodeIP }} cannot be within the Pod CIDR range {{ .PodCIDR.CIDR }}. Use --network-interface to specify a different network interface.
875+
{{- else -}}
876+
The node IP {{ .NodeIP }} cannot be within the Pod CIDR range {{ .PodCIDR.CIDR }}. Use --pod-cidr to specify a different Pod CIDR, or use --network-interface to specify a different network interface.
877+
{{- end }}
873878
- pass:
874879
when: "false"
875880
message: The node IP {{ .NodeIP }} is not within the Pod CIDR range {{ .PodCIDR.CIDR }}.
@@ -881,7 +886,12 @@ spec:
881886
outcomes:
882887
- fail:
883888
when: "true"
884-
message: The node IP {{ .NodeIP }} cannot be within the Service CIDR range {{ .ServiceCIDR.CIDR }}. Use --service-cidr to specify a different Service CIDR, or use --network-interface to specify a different network interface.
889+
message: |
890+
{{ if .IsJoin -}}
891+
The node IP {{ .NodeIP }} cannot be within the Service CIDR range {{ .ServiceCIDR.CIDR }}. Use --network-interface to specify a different network interface.
892+
{{- else -}}
893+
The node IP {{ .NodeIP }} cannot be within the Service CIDR range {{ .ServiceCIDR.CIDR }}. Use --service-cidr to specify a different Service CIDR, or use --network-interface to specify a different network interface.
894+
{{- end }}
885895
- pass:
886896
when: "false"
887897
message: The node IP {{ .NodeIP }} is not within the Service CIDR range {{ .ServiceCIDR.CIDR }}.
@@ -893,7 +903,12 @@ spec:
893903
outcomes:
894904
- fail:
895905
when: "true"
896-
message: The node IP {{ .NodeIP }} cannot be within the CIDR range {{ .GlobalCIDR.CIDR }}. Use --cidr to specify a different CIDR block of available private IP addresses (/16 or larger), or use --network-interface to specify a different network interface.
906+
message: |
907+
{{ if .IsJoin -}}
908+
The node IP {{ .NodeIP }} cannot be within the CIDR range {{ .GlobalCIDR.CIDR }}. Use --network-interface to specify a different network interface.
909+
{{- else -}}
910+
The node IP {{ .NodeIP }} cannot be within the CIDR range {{ .GlobalCIDR.CIDR }}. Use --cidr to specify a different CIDR block of available private IP addresses (/16 or larger), or use --network-interface to specify a different network interface.
911+
{{- end }}
897912
- pass:
898913
when: "false"
899914
message: The node IP {{ .NodeIP }} is not within the Global CIDR range {{ .GlobalCIDR.CIDR }}.
@@ -1055,13 +1070,13 @@ spec:
10551070
outcomes:
10561071
- fail:
10571072
when: "connection-refused"
1058-
message: "A TCP connection to {{ $element }} is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and {{ $element }}, or if your firewall doesnt allow traffic between this host and {{ $element }}."
1073+
message: "A TCP connection to {{ $element }} is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and {{ $element }}, or if your firewall doesn't allow traffic between this host and {{ $element }}."
10591074
- fail:
10601075
when: "connection-timeout"
1061-
message: "A TCP connection to {{ $element }} is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and {{ $element }}, or if your firewall doesnt allow traffic between this host and {{ $element }}."
1076+
message: "A TCP connection to {{ $element }} is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and {{ $element }}, or if your firewall doesn't allow traffic between this host and {{ $element }}."
10621077
- fail:
10631078
when: "error"
1064-
message: "A TCP connection to {{ $element }} is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and {{ $element }}, or if your firewall doesnt allow traffic between this host and {{ $element }}."
1079+
message: "A TCP connection to {{ $element }} is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and {{ $element }}, or if your firewall doesn't allow traffic between this host and {{ $element }}."
10651080
- pass:
10661081
when: "connected"
10671082
message: "Successful TCP connection to {{ $element }}."

pkg/preflights/run.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type PrepareAndRunOptions struct {
3636
AssumeYes bool
3737
TCPConnectionsRequired []string
3838
MetricsReporter MetricsReporter
39+
IsJoin bool
3940
}
4041

4142
type MetricsReporter interface {
@@ -68,6 +69,7 @@ func PrepareAndRun(ctx context.Context, opts PrepareAndRunOptions) error {
6869
ToCIDR: opts.ServiceCIDR,
6970
TCPConnectionsRequired: opts.TCPConnectionsRequired,
7071
NodeIP: opts.NodeIP,
72+
IsJoin: opts.IsJoin,
7173
}.WithCIDRData(opts.PodCIDR, opts.ServiceCIDR, opts.GlobalCIDR)
7274

7375
if err != nil {

pkg/preflights/template_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -413,19 +413,19 @@ func TestTemplateTCPConnectionsRequired(t *testing.T) {
413413
{
414414
Fail: &v1beta2.SingleOutcome{
415415
When: "connection-refused",
416-
Message: "A TCP connection to 192.168.10.1:6443 is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesnt allow traffic between this host and 192.168.10.1:6443.",
416+
Message: "A TCP connection to 192.168.10.1:6443 is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesn't allow traffic between this host and 192.168.10.1:6443.",
417417
},
418418
},
419419
{
420420
Fail: &v1beta2.SingleOutcome{
421421
When: "connection-timeout",
422-
Message: "A TCP connection to 192.168.10.1:6443 is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesnt allow traffic between this host and 192.168.10.1:6443.",
422+
Message: "A TCP connection to 192.168.10.1:6443 is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesn't allow traffic between this host and 192.168.10.1:6443.",
423423
},
424424
},
425425
{
426426
Fail: &v1beta2.SingleOutcome{
427427
When: "error",
428-
Message: "A TCP connection to 192.168.10.1:6443 is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesnt allow traffic between this host and 192.168.10.1:6443.",
428+
Message: "A TCP connection to 192.168.10.1:6443 is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesn't allow traffic between this host and 192.168.10.1:6443.",
429429
},
430430
},
431431
{
@@ -477,19 +477,19 @@ func TestTemplateTCPConnectionsRequired(t *testing.T) {
477477
{
478478
Fail: &v1beta2.SingleOutcome{
479479
When: "connection-refused",
480-
Message: "A TCP connection to 192.168.10.1:6443 is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesnt allow traffic between this host and 192.168.10.1:6443.",
480+
Message: "A TCP connection to 192.168.10.1:6443 is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesn't allow traffic between this host and 192.168.10.1:6443.",
481481
},
482482
},
483483
{
484484
Fail: &v1beta2.SingleOutcome{
485485
When: "connection-timeout",
486-
Message: "A TCP connection to 192.168.10.1:6443 is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesnt allow traffic between this host and 192.168.10.1:6443.",
486+
Message: "A TCP connection to 192.168.10.1:6443 is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesn't allow traffic between this host and 192.168.10.1:6443.",
487487
},
488488
},
489489
{
490490
Fail: &v1beta2.SingleOutcome{
491491
When: "error",
492-
Message: "A TCP connection to 192.168.10.1:6443 is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesnt allow traffic between this host and 192.168.10.1:6443.",
492+
Message: "A TCP connection to 192.168.10.1:6443 is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:6443, or if your firewall doesn't allow traffic between this host and 192.168.10.1:6443.",
493493
},
494494
},
495495
{
@@ -506,19 +506,19 @@ func TestTemplateTCPConnectionsRequired(t *testing.T) {
506506
{
507507
Fail: &v1beta2.SingleOutcome{
508508
When: "connection-refused",
509-
Message: "A TCP connection to 192.168.10.1:9443 is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:9443, or if your firewall doesnt allow traffic between this host and 192.168.10.1:9443.",
509+
Message: "A TCP connection to 192.168.10.1:9443 is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:9443, or if your firewall doesn't allow traffic between this host and 192.168.10.1:9443.",
510510
},
511511
},
512512
{
513513
Fail: &v1beta2.SingleOutcome{
514514
When: "connection-timeout",
515-
Message: "A TCP connection to 192.168.10.1:9443 is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:9443, or if your firewall doesnt allow traffic between this host and 192.168.10.1:9443.",
515+
Message: "A TCP connection to 192.168.10.1:9443 is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:9443, or if your firewall doesn't allow traffic between this host and 192.168.10.1:9443.",
516516
},
517517
},
518518
{
519519
Fail: &v1beta2.SingleOutcome{
520520
When: "error",
521-
Message: "A TCP connection to 192.168.10.1:9443 is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:9443, or if your firewall doesnt allow traffic between this host and 192.168.10.1:9443.",
521+
Message: "A TCP connection to 192.168.10.1:9443 is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:9443, or if your firewall doesn't allow traffic between this host and 192.168.10.1:9443.",
522522
},
523523
},
524524
{
@@ -535,19 +535,19 @@ func TestTemplateTCPConnectionsRequired(t *testing.T) {
535535
{
536536
Fail: &v1beta2.SingleOutcome{
537537
When: "connection-refused",
538-
Message: "A TCP connection to 192.168.10.1:2380 is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:2380, or if your firewall doesnt allow traffic between this host and 192.168.10.1:2380.",
538+
Message: "A TCP connection to 192.168.10.1:2380 is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:2380, or if your firewall doesn't allow traffic between this host and 192.168.10.1:2380.",
539539
},
540540
},
541541
{
542542
Fail: &v1beta2.SingleOutcome{
543543
When: "connection-timeout",
544-
Message: "A TCP connection to 192.168.10.1:2380 is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:2380, or if your firewall doesnt allow traffic between this host and 192.168.10.1:2380.",
544+
Message: "A TCP connection to 192.168.10.1:2380 is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:2380, or if your firewall doesn't allow traffic between this host and 192.168.10.1:2380.",
545545
},
546546
},
547547
{
548548
Fail: &v1beta2.SingleOutcome{
549549
When: "error",
550-
Message: "A TCP connection to 192.168.10.1:2380 is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:2380, or if your firewall doesnt allow traffic between this host and 192.168.10.1:2380.",
550+
Message: "A TCP connection to 192.168.10.1:2380 is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:2380, or if your firewall doesn't allow traffic between this host and 192.168.10.1:2380.",
551551
},
552552
},
553553
{
@@ -564,19 +564,19 @@ func TestTemplateTCPConnectionsRequired(t *testing.T) {
564564
{
565565
Fail: &v1beta2.SingleOutcome{
566566
When: "connection-refused",
567-
Message: "A TCP connection to 192.168.10.1:10250 is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:10250, or if your firewall doesnt allow traffic between this host and 192.168.10.1:10250.",
567+
Message: "A TCP connection to 192.168.10.1:10250 is required, but the connection was refused. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:10250, or if your firewall doesn't allow traffic between this host and 192.168.10.1:10250.",
568568
},
569569
},
570570
{
571571
Fail: &v1beta2.SingleOutcome{
572572
When: "connection-timeout",
573-
Message: "A TCP connection to 192.168.10.1:10250 is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:10250, or if your firewall doesnt allow traffic between this host and 192.168.10.1:10250.",
573+
Message: "A TCP connection to 192.168.10.1:10250 is required, but the connection timed out. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:10250, or if your firewall doesn't allow traffic between this host and 192.168.10.1:10250.",
574574
},
575575
},
576576
{
577577
Fail: &v1beta2.SingleOutcome{
578578
When: "error",
579-
Message: "A TCP connection to 192.168.10.1:10250 is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:10250, or if your firewall doesnt allow traffic between this host and 192.168.10.1:10250.",
579+
Message: "A TCP connection to 192.168.10.1:10250 is required, but an unexpected error occurred. This can occur, for example, if IP routing is not possible between this host and 192.168.10.1:10250, or if your firewall doesn't allow traffic between this host and 192.168.10.1:10250.",
580580
},
581581
},
582582
{

pkg/preflights/types/template.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type TemplateData struct {
3434
ToCIDR string
3535
TCPConnectionsRequired []string
3636
NodeIP string
37+
IsJoin bool
3738
}
3839

3940
// WithCIDRData sets the respective CIDR properties in the TemplateData struct based on the provided CIDR strings

0 commit comments

Comments
 (0)