func IngressRouteToHTTPProxy(ir *irv1beta1.IngressRoute) (*hpv1.HTTPProxy, []string, error) {

	// TODO(youngnick): Investigate if we should skip logically empty IngressRoutes

	if ir.Spec.VirtualHost == nil {
		return nil, nil, errors.New("unimplemented: Can't translate non-root IngressRoutes yet")
	}

	routes, includes, warnings := translateRoutes(ir.Spec.Routes)

	hp := &hpv1.HTTPProxy{
		TypeMeta: v1.TypeMeta{
			Kind:       "HTTPProxy",
			APIVersion: "projectcontour.io/v1",
		},
		ObjectMeta: v1.ObjectMeta{
			// TODO(youngnick): For some reason, the zero value of the CreationTimestamp field
			// is output as 'null' by the JSON/YAML serializer, even though it's set to 'omitempty'.
			// ¯\_(ツ)_/¯
			// Doesn't stop the objects being applied, but it is weird.
			// This field is filtered out of the marshaled YAML before it's output.
			Name:        ir.ObjectMeta.Name,
			Namespace:   ir.ObjectMeta.Namespace,
			Labels:      ir.ObjectMeta.DeepCopy().GetLabels(),
			Annotations: ir.ObjectMeta.DeepCopy().GetAnnotations(),
		},
		Spec: hpv1.HTTPProxySpec{
			VirtualHost: ir.Spec.VirtualHost,
			Routes:      routes,
			Includes:    includes,
		},
	}

	return hp, warnings, nil
}
// IngressRouteToHTTPProxy translates IngressRoute objects to HTTPProxy ones, emitting warnings
// as it goes.
// There are currently no fatal conditions (that should not produces a HTTPProxy output)
// TODO(youngnick) - change this signature to return HTTPProxy, []string, error if we need that.
IngressRouteToHTTPProxy translates IngressRoute objects to HTTPProxy ones, emitting warnings
as it goes.
There are currently no fatal conditions (that should not produces a HTTPProxy output)
TODO(youngnick) - change this signature to return HTTPProxy, []string, error if we need that.
// IngressRouteToHTTPProxy translates IngressRoute objects to HTTPProxy ones emitting warnings // as it goes . // There are currently no fatal conditions ( that should not produces a HTTPProxy output ) // TODO ( youngnick ) - change this signature to return HTTPProxy [] string error if we need that .
func IngressRouteToHTTPProxy(ir *irv1beta1.IngressRoute) (*hpv1.HTTPProxy, []string, error) {
	if ir.Spec.VirtualHost == nil {
		return nil, nil, errors.New("unimplemented: Can't translate non-root IngressRoutes yet")
	}
	routes, includes, warnings := translateRoutes(ir.Spec.Routes)
	hp := &hpv1.HTTPProxy{
		TypeMeta: v1.TypeMeta{
			Kind:       "HTTPProxy",
			APIVersion: "projectcontour.io/v1",
		},
		ObjectMeta: v1.ObjectMeta{
			Name:        ir.ObjectMeta.Name,
			Namespace:   ir.ObjectMeta.Namespace,
			Labels:      ir.ObjectMeta.DeepCopy().GetLabels(),
			Annotations: ir.ObjectMeta.DeepCopy().GetAnnotations(),
		},
		Spec: hpv1.HTTPProxySpec{
			VirtualHost: ir.Spec.VirtualHost,
			Routes:      routes,
			Includes:    includes,
		},
	}
	return hp, warnings, nil
}
func IngressRouteToHTTPProxy ( ir * irv1beta1 . IngressRoute ) ( * hpv1 . HTTPProxy , [ ] string , error ) { if ir . Spec . VirtualHost == nil { return nil , nil , errors . New ( " " ) } routes , includes , warnings := translateRoutes ( ir . Spec . Routes ) hp := & hpv1 . HTTPProxy { TypeMeta : v1 . TypeMeta { Kind : " " , APIVersion : " " , } , ObjectMeta : v1 . ObjectMeta { Name : ir . ObjectMeta . Name , Namespace : ir . ObjectMeta . Namespace , Labels : ir . ObjectMeta . DeepCopy ( ) . GetLabels ( ) , Annotations : ir . ObjectMeta . DeepCopy ( ) . GetAnnotations ( ) , } , Spec : hpv1 . HTTPProxySpec { VirtualHost : ir . Spec . VirtualHost , Routes : routes , Includes : includes , } , } return hp , warnings , nil }
IngressRouteToHTTPProxy translates IngressRoute objects to HTTPProxy ones, emitting warnings
as it goes.
IngressRouteToHTTPProxy translates IngressRoute objects to HTTPProxy ones emitting warnings as it goes .
// TODO(youngnick): Investigate if we should skip logically empty IngressRoutes // TODO(youngnick): For some reason, the zero value of the CreationTimestamp field // is output as 'null' by the JSON/YAML serializer, even though it's set to 'omitempty'. // ¯\_(ツ)_/¯ // Doesn't stop the objects being applied, but it is weird. // This field is filtered out of the marshaled YAML before it's output.