Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: export regionBySubnet #53

Merged
merged 3 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions controllers/controlplane/kopscontrolplane_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ func (r *KopsControlPlaneReconciler) reconcileKopsMachinePool(ctx context.Contex
// GetASGByName returns the existing ASG or nothing if it doesn't exist.
func GetASGByName(kopsMachinePool *infrastructurev1alpha1.KopsMachinePool, kopsControlPlane *controlplanev1alpha1.KopsControlPlane, creds *aws.Credentials) (*asgTypes.AutoScalingGroup, error) {
ctx := context.TODO()
region, err := regionBySubnet(kopsControlPlane)
region, err := RegionBySubnet(kopsControlPlane)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -806,7 +806,7 @@ func GetASGByName(kopsMachinePool *infrastructurev1alpha1.KopsMachinePool, kopsC
return nil, apierrors.NewNotFound(schema.GroupResource{}, "ASG not ready")
}

func regionBySubnet(kopsControlPlane *controlplanev1alpha1.KopsControlPlane) (string, error) {
func RegionBySubnet(kopsControlPlane *controlplanev1alpha1.KopsControlPlane) (string, error) {
subnets := kopsControlPlane.Spec.KopsClusterSpec.Subnets
if len(subnets) == 0 {
return "", errors.New("kopsControlPlane with no subnets")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ func TestGetRegionBySubnet(t *testing.T) {
for _, tc := range testCases {
kcp := &controlplanev1alpha1.KopsControlPlane{}
kcp.Spec.KopsClusterSpec.Subnets = tc.input
region, err := regionBySubnet(kcp)
region, err := RegionBySubnet(kcp)

t.Run(tc.description, func(t *testing.T) {
if tc.expectedError {
Expand Down
Loading