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

fix dns testing #130

Merged
merged 1 commit into from
Jul 19, 2022
Merged
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 cmd/init.go
Original file line number Diff line number Diff line change
@@ -128,9 +128,9 @@ to quickly create a Cobra application.`,
// todo: this doesn't default to testing the dns check
skipHostedZoneCheck := viper.GetBool("init.hostedzonecheck.enabled")
if !skipHostedZoneCheck {
log.Println("skipping hosted zone check")
} else {
aws.TestHostedZoneLiveness(dryRun, hostedZoneName, hostedZoneId)
} else {
log.Println("skipping hosted zone check")
}
trackers[pkg.TestHostedZoneLiveness].Tracker.Increment(1)

23 changes: 12 additions & 11 deletions internal/aws/aws.go
Original file line number Diff line number Diff line change
@@ -3,6 +3,13 @@ package aws
import (
"context"
"fmt"
"log"
"net"
"os"
"strconv"
"strings"
"time"

"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/route53"
"github.com/aws/aws-sdk-go-v2/service/route53/types"
@@ -14,12 +21,6 @@ import (
"github.com/cip8/autoname"
"github.com/kubefirst/kubefirst/pkg"
"github.com/spf13/viper"
"log"
"net"
"os"
"strconv"
"strings"
"time"
)

func BucketRand(dryRun bool, trackers map[string]*pkg.ActionTracker) {
@@ -61,15 +62,15 @@ func BucketRand(dryRun bool, trackers map[string]*pkg.ActionTracker) {
LocationConstraint: aws.String(regionName),
},
})
}
}
if err != nil {
log.Println("failed to create bucket "+bucketName, err.Error())
os.Exit(1)
}
vc := &s3.VersioningConfiguration{}
vc.Status = aws.String(s3.BucketVersioningStatusEnabled)
versionConfigInput := &s3.PutBucketVersioningInput{
Bucket: aws.String(bucketName),
Bucket: aws.String(bucketName),
VersioningConfiguration: vc,
}
log.Printf("[DEBUG] S3 put bucket versioning: %#v", versionConfigInput)
@@ -170,7 +171,7 @@ func TestHostedZoneLiveness(dryRun bool, hostedZoneName, hostedZoneId string) {
count := 0
// todo need to exit after n number of minutes and tell them to check ns records
// todo this logic sucks
for count <= 25 {
for count <= 100 {
count++
//tracker.Increment(1)
//log.Println(text.Faint.Sprintf("[INFO] dns test %d of 25", count))
@@ -188,10 +189,10 @@ func TestHostedZoneLiveness(dryRun bool, hostedZoneName, hostedZoneId string) {
// todo check ip against route53RecordValue in some capacity so we can pivot the value for testing
log.Println(fmt.Sprintf("%s. in TXT record value: %s\n", route53RecordName, ip))
//tracker.MarkAsDone()
count = 26
count = 101
}
}
if count == 25 {
if count == 100 {
//tracker.MarkAsErrored()
//pw.Stop()
log.Panicf("unable to resolve hosted zone dns record. please check your domain registrar")