public async Task <V1Deployment> GetOrCreateAsync(HealthCheckResource resource)
        {
            var deployment = await Get(resource);

            if (deployment != null)
            {
                return(deployment);
            }

            try
            {
                var deploymentResource = Build(resource);
                var response           =
                    await _client.CreateNamespacedDeploymentWithHttpMessagesAsync(deploymentResource,
                                                                                  resource.Metadata.NamespaceProperty);

                deployment = response.Body;

                _operatorDiagnostics.DeploymentCreated(deployment.Metadata.Name);
            }
            catch (Exception ex)
            {
                _operatorDiagnostics.DeploymentOperationError(deployment.Metadata.Name, Deployment.Operation.ADD, ex.Message);
            }

            return(deployment);
        }
 public async Task DeleteAsync(HealthCheckResource resource)
 {
     try
     {
         await _client.DeleteNamespacedDeploymentAsync($"{resource.Spec.Name}-deploy",
                                                       resource.Metadata.NamespaceProperty);
     }
     catch (Exception ex)
     {
         _operatorDiagnostics.DeploymentOperationError(resource.Spec.Name, Deployment.Operation.DELETE, ex.Message);
     }
 }