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

dnsprovider: Avoid panic if fields are nil #44380

Merged
merged 1 commit into from
Apr 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions federation/pkg/dnsprovider/providers/aws/route53/rrset.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"k8s.io/kubernetes/federation/pkg/dnsprovider"
"k8s.io/kubernetes/federation/pkg/dnsprovider/rrstype"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/route53"
)

Expand All @@ -32,24 +33,24 @@ type ResourceRecordSet struct {
}

func (rrset ResourceRecordSet) Name() string {
return *rrset.impl.Name
return aws.StringValue(rrset.impl.Name)
}

func (rrset ResourceRecordSet) Rrdatas() []string {
// Sigh - need to unpack the strings out of the route53 ResourceRecords
result := make([]string, len(rrset.impl.ResourceRecords))
for i, record := range rrset.impl.ResourceRecords {
result[i] = *record.Value
result[i] = aws.StringValue(record.Value)
}
return result
}

func (rrset ResourceRecordSet) Ttl() int64 {
return *rrset.impl.TTL
return aws.Int64Value(rrset.impl.TTL)
}

func (rrset ResourceRecordSet) Type() rrstype.RrsType {
return rrstype.RrsType(*rrset.impl.Type)
return rrstype.RrsType(aws.StringValue(rrset.impl.Type))
}

// Route53ResourceRecordSet returns the route53 ResourceRecordSet object for the ResourceRecordSet
Expand Down