sigs.k8s.io/cluster-api-provider-aws@v1.5.5/api/v1alpha3/defaults.go (about)

     1  /*
     2  Copyright 2020 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8  	http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v1alpha3
    18  
    19  // SetDefaults_Bastion is used by defaulter-gen.
    20  func SetDefaults_Bastion(obj *Bastion) { //nolint:golint,stylecheck
    21  	// Default to allow open access to the bastion host if no CIDR Blocks have been set
    22  	if len(obj.AllowedCIDRBlocks) == 0 && !obj.DisableIngressRules {
    23  		obj.AllowedCIDRBlocks = []string{"0.0.0.0/0"}
    24  	}
    25  }
    26  
    27  // SetDefaults_NetworkSpec is used by defaulter-gen.
    28  func SetDefaults_NetworkSpec(obj *NetworkSpec) { //nolint:golint,stylecheck
    29  	// Default to Calico ingress rules if no rules have been set
    30  	if obj.CNI == nil {
    31  		obj.CNI = &CNISpec{
    32  			CNIIngressRules: CNIIngressRules{
    33  				{
    34  					Description: "bgp (calico)",
    35  					Protocol:    SecurityGroupProtocolTCP,
    36  					FromPort:    179,
    37  					ToPort:      179,
    38  				},
    39  				{
    40  					Description: "IP-in-IP (calico)",
    41  					Protocol:    SecurityGroupProtocolIPinIP,
    42  					FromPort:    -1,
    43  					ToPort:      65535,
    44  				},
    45  			},
    46  		}
    47  	}
    48  }