func()

in pkg/cloud_provider/lustre/lustre.go [126:151]


func (sm *lustreServiceManager) CreateInstance(ctx context.Context, instance *ServiceInstance) (*ServiceInstance, error) {
	req := &lustrepb.CreateInstanceRequest{
		Parent:     fmt.Sprintf("projects/%s/locations/%s", instance.Project, instance.Location),
		InstanceId: instance.Name,
		Instance: &lustrepb.Instance{
			Network:           instance.Network,
			Description:       instance.Description,
			Labels:            instance.Labels,
			CapacityGib:       instance.CapacityGib,
			Filesystem:        instance.Filesystem,
			GkeSupportEnabled: instance.GkeSupportEnabled,
		},
	}
	klog.V(4).Infof("Creating Lustre instance %+v", instance)
	op, err := sm.lustreClient.CreateInstance(ctx, req)
	if err != nil {
		return nil, err
	}
	klog.V(4).Infof("Waiting for the completion of creation op %q for instance %q", op.Name(), instance.Name)
	resp, err := op.Wait(ctx)
	if err != nil {
		return nil, err
	}

	return cloudInstanceToServiceInstance(resp)
}