istio

package
v1.18.0-beta2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EdgeApisRoutingFileName                     = "edge-apis-routing"
	DisableAutomtlsEdgeApisFileName             = "disable-automtls-edge-apis-routing"
	UpstreamSslConfigEdgeApisFileName           = "upstream-ssl-config-edge-apis"
	UpstreamSslConfigAndDisableAutomtlsFileName = "sslconfig-and-disable-automtls-edge-apis-routing"

	// GetGlooGatewayEdgeResources defines the Edge API resources based on the UpstreamConfigOpts and the file name of the generated manifest
	GetGlooGatewayEdgeResources = func(installNamespace string, config UpstreamConfigOpts) []client.Object {
		var sslConfig *ssl.UpstreamSslConfig
		if config.SetSslConfig {

			sslConfig = &ssl.UpstreamSslConfig{
				AlpnProtocols: []string{"istio"},
				SslSecrets: &ssl.UpstreamSslConfig_Sds{
					Sds: &ssl.SDSConfig{
						CertificatesSecretName: constants.IstioCertSecret,
						SdsBuilder: &ssl.SDSConfig_ClusterName{
							ClusterName: constants.SdsClusterName,
						},
						TargetUri:             constants.SdsTargetURI,
						ValidationContextName: constants.IstioValidationContext,
					},
				},
			}
		}

		upstreamName := fmt.Sprintf("httpbin-upstream-%s", getGlooGatewayEdgeResourceName(config))
		httpbinUpstream := &soloapis_gloov1.Upstream{
			TypeMeta: metav1.TypeMeta{
				Kind:       gloov1.UpstreamGVK.Kind,
				APIVersion: fmt.Sprintf("%s/%s", gloov1.UpstreamGVK.Group, gloov1.UpstreamGVK.Version),
			},
			ObjectMeta: metav1.ObjectMeta{
				Name:      upstreamName,
				Namespace: installNamespace,
			},
			Spec: soloapis_gloov1.UpstreamSpec{
				DisableIstioAutoMtls: &wrappers.BoolValue{Value: config.DisableIstioAutoMtls},
				UpstreamType: &soloapis_gloov1.UpstreamSpec_Kube{
					Kube: &soloapis_kubernetes.UpstreamSpec{
						Selector: map[string]string{
							"app": "httpbin",
						},
						ServiceName:      httpbinSvc.GetName(),
						ServiceNamespace: httpbinSvc.GetNamespace(),
						ServicePort:      8000,
					},
				},
				SslConfig: sslConfig,
			},
		}

		headlessVs := &v1.VirtualService{
			TypeMeta: metav1.TypeMeta{
				Kind:       v1.VirtualServiceGVK.Kind,
				APIVersion: fmt.Sprintf("%s/%s", v1.VirtualServiceGVK.Group, v1.VirtualServiceGVK.Version),
			},
			ObjectMeta: metav1.ObjectMeta{
				Name:      "httpbin-vs",
				Namespace: installNamespace,
			},
			Spec: v1.VirtualServiceSpec{
				VirtualHost: &v1.VirtualHost{
					Domains: []string{"httpbin"},
					Routes: []*v1.Route{{
						Matchers: []*matchers.Matcher{
							{
								PathSpecifier: &matchers.Matcher_Prefix{
									Prefix: "/",
								},
							},
						},
						Action: &v1.Route_RouteAction{
							RouteAction: &soloapis_gloov1.RouteAction{
								Destination: &soloapis_gloov1.RouteAction_Single{
									Single: &soloapis_gloov1.Destination{
										DestinationType: &soloapis_gloov1.Destination_Upstream{
											Upstream: &gloocore.ResourceRef{
												Name:      httpbinUpstream.Name,
												Namespace: httpbinUpstream.Namespace,
											},
										},
									},
								},
							},
						},
					}},
				},
			},
		}

		var resources []client.Object
		resources = append(resources, headlessVs, httpbinUpstream)

		return resources
	}
)

Functions

func NewGlooIstioAutoMtlsSuite

func NewGlooIstioAutoMtlsSuite(ctx context.Context, testInst *e2e.TestInstallation) suite.TestingSuite

func NewGlooTestingSuite

func NewGlooTestingSuite(ctx context.Context, testInst *e2e.TestInstallation) suite.TestingSuite

func NewIstioAutoMtlsSuite

func NewIstioAutoMtlsSuite(ctx context.Context, testInst *e2e.TestInstallation) suite.TestingSuite

func NewTestingSuite

func NewTestingSuite(ctx context.Context, testInst *e2e.TestInstallation) suite.TestingSuite

Types

type UpstreamConfigOpts

type UpstreamConfigOpts struct {
	DisableIstioAutoMtls bool
	SetSslConfig         bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL