deployer

package
v1.17.0-beta22 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigureProxiesFromGatewayParameters = e2e.Test{
	Name:        "Deployer.ConfigureProxiesFromGatewayParameters",
	Description: "the deployer will provision a deployment and service for a defined gateway, and configure it based on the GatewayParameters CR",
	Test: func(ctx context.Context, installation *e2e.TestInstallation) {
		provisionResourcesOp := operations.ReversibleOperation{
			Do: &operations.BasicOperation{
				OpName:      fmt.Sprintf("apply-manifest-%s", filepath.Base(manifestFile)),
				OpAction:    installation.Actions.Kubectl().NewApplyManifestAction(manifestFile),
				OpAssertion: installation.Assertions.ObjectsExist(proxyService, proxyDeployment),
			},

			Undo: &operations.BasicOperation{
				OpName:      fmt.Sprintf("delete-manifest-%s", filepath.Base(manifestFile)),
				OpAction:    installation.Actions.Kubectl().NewDeleteManifestAction(manifestFile, "--ignore-not-found=true"),
				OpAssertion: installation.Assertions.ObjectsNotExist(proxyService, proxyDeployment),
			},
		}

		configureGatewayParametersOp := operations.ReversibleOperation{
			Do: &operations.BasicOperation{
				OpName:   fmt.Sprintf("apply-manifest-%s", filepath.Base(gwParametersManifestFile)),
				OpAction: installation.Actions.Kubectl().NewApplyManifestAction(gwParametersManifestFile),
				OpAssertions: []assertions.ClusterAssertion{

					installation.Assertions.ObjectsExist(gwParams),

					installation.Assertions.RunningReplicas(proxyDeployment.ObjectMeta, Equal(1)),

					installation.Assertions.EnvoyAdminApiAssertion(
						proxyDeployment.ObjectMeta,
						func(ctx context.Context, adminClient *admincli.Client) {
							if installation.RuntimeContext.RunSource != runtime.LocalDevelopment {

								return
							}
							Eventually(func(g Gomega) {
								serverInfo, err := adminClient.GetServerInfo(ctx)
								g.Expect(err).NotTo(HaveOccurred(), "can get server info")
								g.Expect(serverInfo.GetCommandLineOptions().GetLogLevel()).To(
									Equal("debug"), "defined on the GatewayParameters CR")
								g.Expect(serverInfo.GetCommandLineOptions().GetComponentLogLevel()).To(
									Equal("connection:trace,upstream:debug"), "defined on the GatewayParameters CR")
							}).
								WithContext(ctx).
								WithTimeout(time.Second * 10).
								WithPolling(time.Millisecond * 200).
								Should(Succeed())
						},
					),
				},
			},
			Undo: &operations.BasicOperation{
				OpName:      fmt.Sprintf("delete-manifest-%s", filepath.Base(gwParametersManifestFile)),
				OpAction:    installation.Actions.Kubectl().NewDeleteManifestAction(gwParametersManifestFile),
				OpAssertion: installation.Assertions.ObjectsNotExist(gwParams),
			},
		}

		err := installation.Operator.ExecuteReversibleOperations(ctx, provisionResourcesOp, configureGatewayParametersOp)
		Expect(err).NotTo(HaveOccurred())
	},
}
View Source
var ProvisionDeploymentAndService = e2e.Test{
	Name:        "Deployer.ProvisionDeploymentAndService",
	Description: "the deployer will provision a deployment and service for a defined gateway",
	Test: func(ctx context.Context, installation *e2e.TestInstallation) {
		provisionResourcesOp := operations.ReversibleOperation{
			Do: &operations.BasicOperation{
				OpName:      fmt.Sprintf("apply-manifest-%s", filepath.Base(manifestFile)),
				OpAction:    installation.Actions.Kubectl().NewApplyManifestAction(manifestFile),
				OpAssertion: installation.Assertions.ObjectsExist(proxyService, proxyDeployment),
			},
			Undo: &operations.BasicOperation{
				OpName:      fmt.Sprintf("delete-manifest-%s", filepath.Base(manifestFile)),
				OpAction:    installation.Actions.Kubectl().NewDeleteManifestAction(manifestFile),
				OpAssertion: installation.Assertions.ObjectsNotExist(proxyService, proxyDeployment),
			},
		}

		err := installation.Operator.ExecuteReversibleOperations(ctx, provisionResourcesOp)
		Expect(err).NotTo(HaveOccurred())
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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