Skip to content

Commit

Permalink
remove test and template commands
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Dec 10, 2024
1 parent 54c14a1 commit 46bbbb6
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 334 deletions.
25 changes: 0 additions & 25 deletions cmd/command/plural/plural.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,31 +84,6 @@ func (p *Plural) getCommands() []cli.Command {
Action: common.LatestVersion(common.HandleServe),
Category: "Workspace",
},
{
Name: "test",
Usage: "validate a values templace",
Action: common.LatestVersion(common.TestTemplate),
Category: "Publishing",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "templateType",
Usage: "Determines the template type. Go template by default",
},
},
},
{
Name: "template",
Aliases: []string{"tpl"},
Usage: "templates a helm chart to be uploaded to plural",
Flags: []cli.Flag{
cli.StringFlag{
Name: "values",
Usage: "the values file",
},
},
Action: common.LatestVersion(common.HandleHelmTemplate),
Category: "Publishing",
},
}
}

Expand Down
1 change: 0 additions & 1 deletion pkg/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type Client interface {
CreateDomain(name string) error
CreateInstallation(id string) (string, error)
GetInstallation(name string) (*Installation, error)
GetInstallations() ([]*Installation, error)
OIDCProvider(id string, attributes *OidcProviderAttributes) error
CreateKeyBackup(attrs KeyBackupAttributes) error
GetKeyBackup(name string) (*KeyBackup, error)
Expand Down
20 changes: 0 additions & 20 deletions pkg/api/installations.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ func (client *client) GetInstallation(name string) (*Installation, error) {

}

func (client *client) DeleteInstallation(id string) error {
_, err := client.pluralClient.DeleteInstallation(client.ctx, id)
return err
}

func (client *client) CreateInstallation(id string) (string, error) {
resp, err := client.pluralClient.CreateInstallation(client.ctx, id)
if err != nil {
Expand Down Expand Up @@ -110,21 +105,6 @@ func convertInstallation(installation *gqlclient.InstallationFragment) *Installa
return i
}

func (client *client) GetInstallations() ([]*Installation, error) {
result := make([]*Installation, 0)

resp, err := client.pluralClient.GetInstallations(client.ctx)
if err != nil {
return result, err
}

for _, edge := range resp.Installations.Edges {
result = append(result, convertInstallation(edge.Node))
}

return result, err
}

func (client *client) OIDCProvider(id string, attributes *OidcProviderAttributes) error {
bindings := make([]*gqlclient.BindingAttributes, 0)
for _, bind := range attributes.Bindings {
Expand Down
52 changes: 0 additions & 52 deletions pkg/common/helm.go

This file was deleted.

105 changes: 0 additions & 105 deletions pkg/common/template.go

This file was deleted.

4 changes: 1 addition & 3 deletions pkg/console/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ func IsAlreadyAgentInstalled(k8sClient *kubernetes.Clientset) (bool, error) {
func InstallAgent(url, token, namespace, version string, values map[string]interface{}) error {
settings := cli.New()
vals := map[string]interface{}{
"secrets": map[string]string{
"deployToken": token,
},
"secrets": map[string]string{"deployToken": token},
"consoleUrl": url,
}
vals = algorithms.Merge(vals, values)
Expand Down
26 changes: 0 additions & 26 deletions pkg/helm/helm.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package helm

import (
"bytes"
"context"
"fmt"
"log"
Expand All @@ -14,7 +13,6 @@ import (
"github.com/pluralsh/plural-cli/pkg/utils"
"gopkg.in/yaml.v2"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/getter"
"helm.sh/helm/v3/pkg/helmpath"
Expand Down Expand Up @@ -48,30 +46,6 @@ func GetActionConfig(namespace string) (*action.Configuration, error) {
return actionConfig, nil
}

func Template(conf *action.Configuration, name, namespace, path string, isUpgrade, validate bool, values map[string]interface{}) ([]byte, error) {
// load chart from the path
chart, err := loader.Load(path)
if err != nil {
return nil, err
}

client := action.NewInstall(conf)
client.DryRun = true
client.ReleaseName = name
client.Replace = true // Skip the name check
client.ClientOnly = !validate
client.IsUpgrade = isUpgrade
client.Namespace = namespace
client.IncludeCRDs = false
rel, err := client.Run(chart, values)
if err != nil {
return nil, err
}
var manifests bytes.Buffer
fmt.Fprintln(&manifests, strings.TrimSpace(rel.Manifest))
return manifests.Bytes(), nil
}

func AddRepo(repoName, repoUrl string) error {
repoFile := getEnvVar("HELM_REPOSITORY_CONFIG", helmpath.ConfigPath("repositories.yaml"))
err := os.MkdirAll(filepath.Dir(repoFile), os.ModePerm)
Expand Down
102 changes: 0 additions & 102 deletions pkg/scaffold/template/template.go

This file was deleted.

0 comments on commit 46bbbb6

Please sign in to comment.