@@ -45,16 +45,12 @@ func (b *ExternalAccessModelBuilder) Build(c *fi.CloudupModelBuilderContext) err
4545 klog .Warningf ("SSHAccess is empty" )
4646 }
4747
48- // SSH is open to AdminCIDR set
48+ network , err := b .LinkToNetwork ()
49+ if err != nil {
50+ return err
51+ }
52+
4953 if b .UsesSSHBastion () {
50- // If we are using a bastion, we only access through the bastion
51- // This is admittedly a little odd... adding a bastion shuts down direct access to the masters/nodes
52- // But I think we can always add more permissions in this case later, but we can't easily take them away
53- klog .V (2 ).Infof ("bastion is in use; won't configure SSH access to control-plane / worker node instances" )
54- network , err := b .LinkToNetwork ()
55- if err != nil {
56- return err
57- }
5854 b .AddFirewallRulesTasks (c , "ssh-external-to-bastion" , & gcetasks.FirewallRule {
5955 Lifecycle : b .Lifecycle ,
6056 TargetTags : []string {b .GCETagForRole (kops .InstanceGroupRoleBastion )},
@@ -76,11 +72,10 @@ func (b *ExternalAccessModelBuilder) Build(c *fi.CloudupModelBuilderContext) err
7672 SourceTags : []string {b .GCETagForRole (kops .InstanceGroupRoleBastion )},
7773 Network : network ,
7874 })
79- } else {
80- network , err := b .LinkToNetwork ()
81- if err != nil {
82- return err
83- }
75+ }
76+
77+ // If you specify SSHAccess, we open up SSH to master & nodes regardless of whether a bastion is used or not
78+ if len (b .Cluster .Spec .SSHAccess ) > 0 {
8479 b .AddFirewallRulesTasks (c , "ssh-external-to-master" , & gcetasks.FirewallRule {
8580 Lifecycle : b .Lifecycle ,
8681 TargetTags : []string {b .GCETagForRole (kops .InstanceGroupRoleControlPlane ), b .GCETagForRole ("Master" )},
0 commit comments