func()

in custom-targets/vertex-ai/model-deployer/deploy.go [122:144]


func (d *deployer) applyModel(ctx context.Context, localManifest string) ([]byte, error) {

	deployModelRequest, err := deployModelFromManifest(localManifest)
	if err != nil {
		return nil, fmt.Errorf("unable to load DeployModelRequest from manifest: %v", err)
	}

	if d.req.Percentage != 100 {
		if err := d.makeManifestChangesForCanary(deployModelRequest); err != nil {
			return nil, fmt.Errorf("unable to make canary changes to the manifest: %v", err)
		}
	}

	if err := deployModel(ctx, d.aiPlatformService, d.params.endpoint, deployModelRequest); err != nil {
		return nil, fmt.Errorf("unable to deploy model: %v", err)
	}

	if err := undeployNoTrafficModels(ctx, d.aiPlatformService, d.params.endpoint); err != nil {
		return nil, fmt.Errorf("unable to undeploy models from endpoint: %v", err)
	}

	return yaml.Marshal(deployModelRequest)
}