in pkg/gateway/model_build_lattice_service.go [176:212]
func (t *latticeServiceModelBuildTask) getACMCertArn(ctx context.Context) (string, error) {
// when a service is associate to multiple service network(s), all listener config MUST be same
// so here we are only using the 1st gateway
gw, err := t.findGateway(ctx)
if err != nil {
if apierrors.IsNotFound(err) && !t.route.DeletionTimestamp().IsZero() {
return "", nil // ok if we're deleting the route
}
return "", err
}
for _, parentRef := range t.route.Spec().ParentRefs() {
if string(parentRef.Name) != gw.Name {
t.log.Debugf(ctx, "Ignore ParentRef of different gateway %s", parentRef.Name)
continue
}
if parentRef.SectionName == nil {
continue
}
for _, section := range gw.Spec.Listeners {
if section.Name == *parentRef.SectionName && section.TLS != nil {
if section.TLS.Mode != nil && *section.TLS.Mode == gwv1.TLSModeTerminate {
curCertARN, ok := section.TLS.Options[awsCustomCertARN]
if ok {
t.log.Debugf(ctx, "Found certification %s under section %s", curCertARN, section.Name)
return string(curCertARN), nil
}
}
break
}
}
}
return "", nil
}