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

Bug r53 hostedzone notexist #247

Merged
merged 2 commits into from
Aug 17, 2022
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
5 changes: 4 additions & 1 deletion cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,10 @@ to quickly create a Cobra application.`,
// todo: this doesn't default to testing the dns check
skipHostedZoneCheck := viper.GetBool("init.hostedzonecheck.enabled")
if !skipHostedZoneCheck {
aws.TestHostedZoneLiveness(dryRun, hostedZoneName, hostedZoneId)
hostedZoneLiveness := aws.TestHostedZoneLiveness(dryRun, hostedZoneName, hostedZoneId)
if !hostedZoneLiveness {
log.Panic("Fail to check the Liveness of HostedZone, we need a valid public HostedZone on the same AWS account that Kubefirst will be installed.")
}
} else {
log.Println("skipping hosted zone check")
}
Expand Down
8 changes: 5 additions & 3 deletions internal/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
stsV1 "github.com/aws/aws-sdk-go/service/sts"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
stsV1 "github.com/aws/aws-sdk-go/service/sts"
"github.com/cip8/autoname"
"github.com/google/uuid"
"github.com/kubefirst/kubefirst/pkg"
Expand Down Expand Up @@ -120,10 +120,10 @@ func GetAccountInfo() {
viper.WriteConfig()
}

func TestHostedZoneLiveness(dryRun bool, hostedZoneName, hostedZoneId string) {
func TestHostedZoneLiveness(dryRun bool, hostedZoneName, hostedZoneId string) bool {
if dryRun {
log.Printf("[#99] Dry-run mode, TestHostedZoneLiveness skipped.")
return
return true
}
//tracker := progress.Tracker{Message: "testing hosted zone", Total: 25}

Expand Down Expand Up @@ -168,6 +168,7 @@ func TestHostedZoneLiveness(dryRun bool, hostedZoneName, hostedZoneId string) {
})
if err != nil {
log.Println(err)
return false
}
log.Println("record creation status is ", record.ChangeInfo.Status)
} else {
Expand Down Expand Up @@ -203,6 +204,7 @@ func TestHostedZoneLiveness(dryRun bool, hostedZoneName, hostedZoneId string) {
log.Panicf("unable to resolve hosted zone dns record. please check your domain registrar")
}
}
return true
// todo delete route53 record

// recordDelete, err := route53Client.ChangeResourceRecordSets(context.TODO(), &route53.ChangeResourceRecordSetsInput{
Expand Down