func (r *App) Install(ctx context.Context, name, namespace, version string, options map[string]string) error {
	manifest, err := getManifest(r.app.Repository.URL)
	if err != nil {
		return err
	}
	patchedManifest, err := patchManifest(manifest, r.app.Args)
	if err != nil {
		return err
	}
	if err := kube.CreateNamespace(ctx, r.kubeCli, namespace); err != nil && !k8sErrors.IsAlreadyExists(err) {
		return err
	}
	out, err := kubectlCommand(ctx, install, name, namespace, patchedManifest)
	if err != nil {
		r.log.Debug(out)
		return err
	}
	r.log.Debug(out)
	r.log.Debugf("Waiting for components to be ready for %s", name)
	return r.waitForReady(ctx, namespace)
}
Install installs the app specified by name, version and namespace.
package raw
import (
	"bytes"
	"context"
	"fmt"
	"io/ioutil"
	"net/http"
	"os"
	"os/exec"
	"regexp"
	"strings"
	"text/tabwriter"
	osappsv1 "github.com/openshift/api/apps/v1"
	osversioned "github.com/openshift/client-go/apps/clientset/versioned"
	"github.com/pkg/errors"
	appsv1 "k8s.io/api/apps/v1"
	corev1 "k8s.io/api/core/v1"
	k8sErrors "k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/kubernetes/scheme"
	_ "k8s.io/client-go/plugin/pkg/client/auth"
	"k8s.io/client-go/tools/clientcmd"
	"github.com/kbrew-dev/kbrew/pkg/config"
	"github.com/kbrew-dev/kbrew/pkg/kube"
	"github.com/kbrew-dev/kbrew/pkg/log"
	"github.com/kbrew-dev/kbrew/pkg/yaml"
)
type method string
const (
	install   method = "apply"
	uninstall method = "delete"
	evalExpression = `select(.kind  == "%s" and .metadata.name == "%s").%s |= %v`
)
var yamlDelimiter = regexp.MustCompile(`(?m)^---$`)
type App struct {
	app      config.App
	log      *log.Logger
	kubeCli  kubernetes.Interface
	osAppCli osversioned.Interface
}
func New(c config.App, log *log.Logger) (*App, error) {
	cfg, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
		clientcmd.NewDefaultClientConfigLoadingRules(),
		&clientcmd.ConfigOverrides{},
	).ClientConfig()
	if err != nil {
		return nil, errors.Wrapf(err, "Failed to load Kubernetes config")
	}
	cli, err := kubernetes.NewForConfig(cfg)
	if err != nil {
		return nil, errors.Wrapf(err, "Failed to create Kubernetes client")
	}
	osCli, err := osversioned.NewForConfig(cfg)
	if err != nil {
		return nil, errors.Wrapf(err, "Failed to create OpenShift client")
	}
	rApp := &App{
		app:      c,
		log:      log,
		kubeCli:  cli,
		osAppCli: osCli,
	}
	return rApp, nil
}