Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for Helm 1st-class. Closes #1145 #1865

Merged
merged 107 commits into from
Sep 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
fce444f
Adds support for Helm 1st-class. Closes #1145
alexec Jul 2, 2019
47a36df
Removes ListRepoURLs
alexec Jul 2, 2019
c551a7e
Adds type field
alexec Jul 2, 2019
3a2983b
tidy up
alexec Jul 3, 2019
c14ebdb
clean up code
alexec Jul 3, 2019
af175df
refactor
alexec Jul 3, 2019
92b7378
Merge branch 'master' into helm-1st-class
alexec Jul 3, 2019
b9117ee
""title": "Repository is a repository holding appli..." to swagger.json
alexec Jul 3, 2019
45d73d4
""format": "boolean"," to swagger.json
alexec Jul 3, 2019
a21d524
"Either empty, "git" or "helm"." to repos-list.tsx
alexec Jul 3, 2019
b74212a
Merge branch 'master' into helm-1st-class
alexec Jul 3, 2019
78183cb
"" to Gopkg.lock
alexec Jul 3, 2019
6f1ce81
"for _, repo := range repos {" to repository.go
alexec Jul 8, 2019
d06706e
"out, err := m.runCmd("show", "-s", "--format=%an <..." to client.go
alexec Jul 8, 2019
9f718e3
"Example: `" to repo.go
alexec Jul 8, 2019
6aab157
"s.repoLock.Lock(client.LockKey())" to repository.go
alexec Jul 8, 2019
23df52f
"mockClient.On("LockKey").Return(root)" to repository_test.go
alexec Jul 8, 2019
2296017
"command.Flags().StringVar(&opts.revision, "revisio..." to app.go
alexec Jul 8, 2019
90d352d
"// return a key suitable for use for locking this ..." to client.go
alexec Jul 8, 2019
9f23468
""k8s.io/apimachinery/pkg/selection"," to Gopkg.lock
alexec Jul 8, 2019
ab3ead1
"return client.Revision(path)" to repository.go
alexec Jul 8, 2019
8f36c38
"revision, err := repo.Revision("wordpress")..." to client_test.go
alexec Jul 8, 2019
7d25e54
"client, err := s.clientFactory.NewClient(repo)..." to repository.go
alexec Jul 8, 2019
c1bb421
"Expect(OperationPhaseIs(OperationSucceeded))...." to helm_test.go
alexec Jul 8, 2019
1445725
works
alexec Jul 9, 2019
e2b88ff
helm
alexec Jul 9, 2019
5b57326
"- https://github.com/alexec/argo-cd/blob/helm-1st-..." to index.yaml
alexec Jul 9, 2019
eac5c4b
"Name: "testrepo"," to helm_test.go
alexec Jul 9, 2019
2bc7d63
"Name: "testrepo"," to helm_test.go
alexec Jul 9, 2019
d91964d
"action: () => props.syncApplication(app.metadata.n..." to applicatio…
alexec Jul 9, 2019
e67a39c
Merge branch 'master' into helm-1st-class
alexec Jul 12, 2019
4c95072
""operationId": "ListMixin6"," to swagger.json
alexec Jul 12, 2019
0d22ecb
"setString: map[string]string{}," to helm.go
alexec Jul 12, 2019
5888b7f
"Type: repo.Type," to repo.go
alexec Jul 12, 2019
5c5d558
"string type = 6;" to repository.proto
alexec Jul 12, 2019
cd0a480
"return fileDescriptor_repository_14cf0cb00b2c9f4b,..." to repository…
alexec Jul 12, 2019
b423194
Merge branch 'master' into helm-1st-class
alexec Jul 22, 2019
a3db83b
codegen
alexec Jul 22, 2019
ef50a8f
"_, _ = fmt.Fprintf(w, "TYPE\nREPO\tINSECURE\tLFS\t..." to repo.go
alexec Jul 22, 2019
6973412
"RepoURLTypeHelm = "helm"" to fixture.go
alexec Jul 22, 2019
0658fb0
"log.SetLevel(log.DebugLevel)" to client.go
alexec Jul 22, 2019
0e018c7
""github.com/argoproj/argo-cd/test/fixture/testrepo..." to fixture.go
alexec Jul 22, 2019
be910f9
Merge branch 'master' into helm-1st-class
alexec Aug 1, 2019
0c54819
""type": {" to swagger.json
alexec Aug 1, 2019
594a911
""tlsClientCaData": {" to swagger.json
alexec Aug 1, 2019
f3c05c9
"Repo: q.Repo," to repository.go
alexec Aug 1, 2019
e5514ba
"threshold: 10" to .codecov.yml
alexec Aug 1, 2019
d6b7993
"func (w *clientWrapper) Root() string {" to clientwrapper.go
alexec Aug 1, 2019
dfe7534
"" to helm.go
alexec Aug 1, 2019
942f008
Merge branch 'master' into helm-1st-class
alexec Aug 5, 2019
f6d09cc
"API rule violation: names_match,github.com/argopro..." to violation_…
alexec Aug 5, 2019
c638472
"repoclient "github.com/argoproj/argo-cd/util/depot..." to clientwrap…
alexec Aug 5, 2019
680ed13
"repofactory "github.com/argoproj/argo-cd/util/repo..." to main.go
alexec Aug 5, 2019
fb8a981
Merge branch 'master' into helm-1st-class
alexec Aug 12, 2019
fabfeda
""operationId": "ListMixin6"," to swagger.json
alexec Aug 12, 2019
2f933cd
"h, err := NewHelmApp("./testdata/redis", argoappv1..." to helm_test.go
alexec Aug 12, 2019
5bf8889
Merge branch 'master' into helm-1st-class
alexec Aug 17, 2019
30c92b6
"type RevisionMetadata struct {" to client.go
alexec Aug 17, 2019
fd74094
""github.com/argoproj/argo-cd/util/repofactory"..." to main.go
alexec Aug 17, 2019
25e7117
"if revision == "" {" to client.go
alexec Aug 17, 2019
2e8a905
"mockClient := gitmocks.Repo{}" to repository_test.go
alexec Aug 17, 2019
6336d32
Merge branch 'helm-1st-class' of github.com:alexec/argo-cd into helm-…
alexec Aug 17, 2019
50beb6f
"import (" to Client.go
alexec Aug 17, 2019
de8ccf0
""github.com/argoproj/argo-cd/util/repo/factory"..." to main.go
alexec Aug 19, 2019
f834709
""title": "HelmAppSpec contains helm app name in so..." to swagger.json
alexec Aug 20, 2019
454c410
"fmt.Printf(printOpFmtStr, "Sync Revision:", opStat..." to app.go
alexec Aug 20, 2019
0c831d9
"ctrl.normalizeApplication(origApp, app)" to appcontroller.go
alexec Aug 20, 2019
a80fa77
Merge branch 'master' into helm-1st-class
alexec Aug 20, 2019
ba43e6e
"return fileDescriptor_generated_fa7ecc5a98a60b16, ..." to generated.…
alexec Aug 20, 2019
b2f78e2
"<i className={'icon argo-icon-' + repo.type}/> <Re..." to repos-list…
alexec Aug 20, 2019
c8ecdb7
"res, err := repository.GenerateManifests(local, &r..." to app.go
alexec Aug 20, 2019
2735787
"res1, err = GenerateManifests("./testdata/empty-li..." to repository…
alexec Aug 20, 2019
27489f1
""path/filepath"" to cmd.go
alexec Aug 20, 2019
81bd450
"func (g gitRepo) Init() error {" to repo.go
alexec Aug 20, 2019
ec2d0ac
"return c.run("init", "--client-only", "--skip-refr..." to cmd.go
alexec Aug 20, 2019
0c81250
"func (w *repoWrapper) Init() error {" to repowrapper.go
alexec Aug 20, 2019
6bd41e0
"h := helm.NewHelmApp(appPath, q.Repos)" to repository.go
alexec Aug 20, 2019
db80ab6
"h, err := helm.NewHelmApp(appPath, q.Repos)..." to repository.go
alexec Aug 20, 2019
2f8a032
"plugins, err := s.plugins()" to application.go
alexec Aug 20, 2019
5eec4f8
""k8s.io/utils/pointer"," to Gopkg.lock
alexec Aug 20, 2019
0a5c657
"Expect(Error("", "unable to access 'https://localh..." to repo_creds…
alexec Aug 20, 2019
25a9c90
"Expect(Error("", "unable to access"))" to repo_creds_test.go
alexec Aug 20, 2019
93f81fa
Merge branch 'master' into helm-1st-class
alexec Sep 4, 2019
d142b88
"ctrl.normalizeApplication(origApp, app)" to appcontroller.go
alexec Sep 4, 2019
1b4a9f5
"import (" to account.pb.go
alexec Sep 4, 2019
a3608bc
Merge branch 'master' into helm-1st-class
alexec Sep 5, 2019
58dfe82
""github.com/argoproj/argo-cd/util/app/discovery"..." to repository.go
alexec Sep 5, 2019
df054a2
"// ListRepositories lists configured repositories..." to db.go
alexec Sep 5, 2019
b2acdbd
"inRepos, err := db.settingsMgr.GetRepositories()..." to repository.go
alexec Sep 5, 2019
a1cb2a9
"helmrepo "github.com/argoproj/argo-cd/util/helm/re..." to factory.go
alexec Sep 5, 2019
25176e0
"workDir, err := repo.WorkDir(url)" to repo.go
alexec Sep 5, 2019
89fc394
Merge branch 'master' into helm-1st-class
alexec Sep 5, 2019
f2eb226
"import (" to account.pb.go
alexec Sep 5, 2019
2e89655
"" to .golangci.yml
alexec Sep 5, 2019
f35e9fa
Merge branch 'master' into helm-1st-class
alexec Sep 5, 2019
0fccb1b
"factory factory.Factory" to metrics.go
alexec Sep 5, 2019
3a1fef5
"import (" to Factory.go
alexec Sep 6, 2019
8006421
rm
alexec Sep 6, 2019
6a57104
"conditions, err := argo.ValidateRepo(ctx, &app.Spe..." to applicatio…
alexec Sep 6, 2019
e5f66cd
"// ListApps returns list of apps in the repo..." to state.go
alexec Sep 6, 2019
f774b24
"// ListRepositories lists repositories" to db.go
alexec Sep 6, 2019
d50b886
"log.WithFields(log.Fields{"url": url}).Debug("helm..." to repo_facto…
alexec Sep 6, 2019
8fcae1e
"Repos: repos," to state.go
alexec Sep 6, 2019
33455fa
"import proto "github.com/gogo/protobuf/proto"..." to account.pb.go
alexec Sep 6, 2019
024c4f7
"mockRepoServiceClient.On("GetAppDetails", mock.Any..." to applicatio…
alexec Sep 6, 2019
11dd11e
"// Null out dest server to verify that destination..." to app_manage…
alexec Sep 6, 2019
46b2e4f
"import (" to account.pb.go
alexec Sep 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@ run:
skip-dirs:
- pkg/client
- vendor
linter-settings:
goimports:
local-prefixes: github.com/argoproj/argo-cd
linters:
enable:
- vet
- gofmt
- goimports
- deadcode
- varcheck
- structcheck
- ineffassign
- unconvert
- misspell
- unparam
43 changes: 21 additions & 22 deletions assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,7 @@
},
"repositoryHelmAppSpec": {
"type": "object",
"title": "HelmAppSpec contains helm app name and path in source repo",
"title": "HelmAppSpec contains helm app name in source repo",
"properties": {
"name": {
"type": "string"
Expand All @@ -1948,9 +1948,6 @@
"$ref": "#/definitions/v1alpha1HelmParameter"
}
},
"path": {
"type": "string"
},
"valueFiles": {
"type": "array",
"items": {
Expand Down Expand Up @@ -1989,9 +1986,6 @@
"items": {
"$ref": "#/definitions/v1alpha1KsonnetParameter"
}
},
"path": {
"type": "string"
}
}
},
Expand All @@ -2008,10 +2002,6 @@
"name": {
"type": "string",
"title": "Name is the user defined name of an environment"
},
"path": {
"description": "Path is the relative project path containing metadata for this environment.",
"type": "string"
}
}
},
Expand All @@ -2030,17 +2020,14 @@
},
"repositoryKustomizeAppSpec": {
"type": "object",
"title": "KustomizeAppSpec contains kustomize app name and path in source repo",
"title": "KustomizeAppSpec contains kustomize images",
"properties": {
"images": {
"description": "images is a list of available images.",
"type": "array",
"items": {
"type": "string"
}
},
"path": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -2713,7 +2700,7 @@
},
"sourceRepos": {
"type": "array",
"title": "SourceRepos contains list of git repository URLs which can be used for deployment",
"title": "SourceRepos contains list of repository URLs which can be used for deployment",
"items": {
"type": "string"
}
Expand Down Expand Up @@ -2806,7 +2793,7 @@
},
"repoURL": {
"type": "string",
"title": "RepoURL is the git repository URL of the application manifests"
"title": "RepoURL is the repository URL of the application manifests"
},
"targetRevision": {
"type": "string",
Expand Down Expand Up @@ -3350,7 +3337,7 @@
},
"v1alpha1Repository": {
"type": "object",
"title": "Repository is a Git repository holding application configurations",
"title": "Repository is a repository holding application configurations",
"properties": {
"connectionState": {
"$ref": "#/definitions/v1alpha1ConnectionState"
Expand All @@ -3368,7 +3355,11 @@
"insecureIgnoreHostKey": {
"type": "boolean",
"format": "boolean",
"title": "InsecureIgnoreHostKey should not be used anymore, Insecure is favoured"
"title": "InsecureIgnoreHostKey should not be used anymore, Insecure is favoured\nonly for Git repos"
},
"name": {
"type": "string",
"title": "only for Helm repos"
},
"password": {
"type": "string",
Expand All @@ -3380,7 +3371,11 @@
},
"sshPrivateKey": {
"type": "string",
"title": "SSH private key data for authenticating at the repo server"
"title": "SSH private key data for authenticating at the repo server\nonly for Git repos"
},
"tlsClientCaData": {
"type": "string",
"title": "only for Helm repos"
},
"tlsClientCertData": {
"type": "string",
Expand All @@ -3390,6 +3385,10 @@
"type": "string",
"title": "TLS client cert key for authenticating at the repo server"
},
"type": {
"type": "string",
"title": "type of the repo, maybe \"git or \"helm, \"git\" is assumed if empty or absent"
},
"username": {
"type": "string",
"title": "Username for authenticating at the repo server"
Expand Down Expand Up @@ -3800,7 +3799,7 @@
}
},
"revision": {
"description": "Revision is the git revision in which to sync the application to.\nIf omitted, will use the revision specified in app spec.",
"description": "Revision is the revision in which to sync the application to.\nIf omitted, will use the revision specified in app spec.",
"type": "string"
},
"source": {
Expand Down Expand Up @@ -3839,7 +3838,7 @@
},
"revision": {
"type": "string",
"title": "Revision holds the git commit SHA of the sync"
"title": "Revision holds the revision of the sync"
},
"source": {
"$ref": "#/definitions/v1alpha1ApplicationSource"
Expand Down
4 changes: 2 additions & 2 deletions cmd/argocd-repo-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/argoproj/argo-cd/reposerver"
"github.com/argoproj/argo-cd/util/cache"
"github.com/argoproj/argo-cd/util/cli"
"github.com/argoproj/argo-cd/util/git"
"github.com/argoproj/argo-cd/util/repo/factory"
"github.com/argoproj/argo-cd/util/stats"
"github.com/argoproj/argo-cd/util/tls"
)
Expand Down Expand Up @@ -48,7 +48,7 @@ func newCommand() *cobra.Command {
cache, err := cacheSrc()
errors.CheckError(err)

metricsServer := metrics.NewMetricsServer(git.NewFactory())
metricsServer := metrics.NewMetricsServer(factory.NewFactory())
server, err := reposerver.NewServer(metricsServer, cache, tlsConfigCustomizer, parallelismLimit)
errors.CheckError(err)

Expand Down
23 changes: 2 additions & 21 deletions cmd/argocd-util/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,27 +447,8 @@ func getReferencedSecrets(un unstructured.Unstructured) map[string]bool {
if cred.TLSClientCertKeySecret != nil {
referencedSecrets[cred.TLSClientCertKeySecret.Name] = true
}
}
}
if helmReposRAW, ok := cm.Data["helm.repositories"]; ok {
helmRepoCreds := make([]settings.HelmRepoCredentials, 0)
err := yaml.Unmarshal([]byte(helmReposRAW), &helmRepoCreds)
errors.CheckError(err)
for _, cred := range helmRepoCreds {
if cred.CASecret != nil {
referencedSecrets[cred.CASecret.Name] = true
}
if cred.CertSecret != nil {
referencedSecrets[cred.CertSecret.Name] = true
}
if cred.KeySecret != nil {
referencedSecrets[cred.KeySecret.Name] = true
}
if cred.UsernameSecret != nil {
referencedSecrets[cred.UsernameSecret.Name] = true
}
if cred.PasswordSecret != nil {
referencedSecrets[cred.PasswordSecret.Name] = true
if cred.TLSClientCASecret != nil {
referencedSecrets[cred.TLSClientCASecret.Name] = true
}
}
}
Expand Down
11 changes: 3 additions & 8 deletions cmd/argocd/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"os"
"os/exec"
"path"
"path/filepath"
"reflect"
"sort"
"strconv"
Expand Down Expand Up @@ -104,7 +103,7 @@ func NewApplicationCreateCommand(clientOpts *argocdclient.ClientOptions) *cobra.
)
var command = &cobra.Command{
Use: "create APPNAME",
Short: "Create an application from a git location",
Short: "Create an application",
Run: func(c *cobra.Command, args []string) {
var app argoappv1.Application
argocdClient := argocdclient.NewClientOrDie(clientOpts)
Expand Down Expand Up @@ -592,7 +591,7 @@ func addAppFlags(command *cobra.Command, opts *appOptions) {
command.Flags().StringVar(&opts.repoURL, "repo", "", "Repository URL, ignored if a file is set")
command.Flags().StringVar(&opts.appPath, "path", "", "Path in repository to the ksonnet app directory, ignored if a file is set")
command.Flags().StringVar(&opts.env, "env", "", "Application environment to monitor")
command.Flags().StringVar(&opts.revision, "revision", "HEAD", "The tracking source branch, tag, or commit the application will sync to")
command.Flags().StringVar(&opts.revision, "revision", "", "The tracking source branch, tag, or commit the application will sync to")
command.Flags().StringVar(&opts.destServer, "dest-server", "", "K8s cluster URL (overrides the server URL specified in the ksonnet app.yaml)")
command.Flags().StringVar(&opts.destNamespace, "dest-namespace", "", "K8s target namespace (overrides the namespace specified in the ksonnet app.yaml)")
command.Flags().StringArrayVarP(&opts.parameters, "parameter", "p", []string{}, "set a parameter override (e.g. -p guestbook=image=example/guestbook:latest)")
Expand Down Expand Up @@ -726,7 +725,7 @@ func getLocalObjects(app *argoappv1.Application, local string, appLabelKey strin
}

func getLocalObjectsString(app *argoappv1.Application, local string, appLabelKey string, kustomizeOptions *argoappv1.KustomizeOptions) []string {
res, err := repository.GenerateManifests(filepath.Dir(local), filepath.Base(local), &repoapiclient.ManifestRequest{
res, err := repository.GenerateManifests(local, &repoapiclient.ManifestRequest{
ApplicationSource: &app.Spec.Source,
AppLabelKey: appLabelKey,
AppLabelValue: app.Name,
Expand Down Expand Up @@ -1214,10 +1213,6 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
if len(selectedLabels) > 0 {
ctx := context.Background()

if revision == "" {
revision = "HEAD"
}

q := applicationpkg.ApplicationManifestQuery{
Name: &appName,
Revision: revision,
Expand Down
2 changes: 1 addition & 1 deletion cmd/argocd/commands/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func addProjFlags(command *cobra.Command, opts *projectOpts) {
command.Flags().StringVarP(&opts.description, "description", "", "", "Project description")
command.Flags().StringArrayVarP(&opts.destinations, "dest", "d", []string{},
"Permitted destination server and namespace (e.g. https://192.168.99.100:8443,default)")
command.Flags().StringArrayVarP(&opts.sources, "src", "s", []string{}, "Permitted git source repository URL")
command.Flags().StringArrayVarP(&opts.sources, "src", "s", []string{}, "Permitted source repository URL")
command.Flags().BoolVar(&opts.orphanedResourcesEnabled, "orphaned-resources", false, "Enables orphaned resources monitoring")
command.Flags().BoolVar(&opts.orphanedResourcesWarn, "orphaned-resources-warn", false, "Specifies if applications should be a warning condition when orphaned resources detected")
}
Expand Down
16 changes: 10 additions & 6 deletions cmd/argocd/commands/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
func NewRepoCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "repo",
Short: "Manage git repository connection parameters",
Short: "Manage repository connection parameters",
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
Expand Down Expand Up @@ -127,6 +127,8 @@ Add a HTTPS repository using username/password without verifying the server's TL
// that were supplied, we bail out.
repoAccessReq := repositorypkg.RepoAccessQuery{
Repo: repo.Repo,
Type: repo.Type,
Name: repo.Name,
Username: repo.Username,
Password: repo.Password,
SshPrivateKey: repo.SSHPrivateKey,
Expand All @@ -146,6 +148,8 @@ Add a HTTPS repository using username/password without verifying the server's TL
fmt.Printf("repository '%s' added\n", createdRepo.Repo)
},
}
command.Flags().StringVar(&repo.Type, "type", "", "type of the repository, \"git\" or \"helm\"")
command.Flags().StringVar(&repo.Name, "name", "", "name of the repository")
command.Flags().StringVar(&repo.Username, "username", "", "username to the repository")
command.Flags().StringVar(&repo.Password, "password", "", "password to the repository")
command.Flags().StringVar(&sshPrivateKeyPath, "ssh-private-key-path", "", "path to the private ssh key (e.g. ~/.ssh/id_rsa)")
Expand All @@ -162,7 +166,7 @@ Add a HTTPS repository using username/password without verifying the server's TL
func NewRepoRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "rm REPO",
Short: "Remove git repository credentials",
Short: "Remove repository credentials",
Run: func(c *cobra.Command, args []string) {
if len(args) == 0 {
c.HelpFunc()(c, args)
Expand All @@ -180,23 +184,23 @@ func NewRepoRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command
}

// Print table of repo info
func printRepoTable(repos []appsv1.Repository) {
func printRepoTable(repos appsv1.Repositories) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "REPO\tINSECURE\tLFS\tUSER\tSTATUS\tMESSAGE\n")
_, _ = fmt.Fprintf(w, "TYPE\nNAME\nREPO\tINSECURE\tLFS\tUSER\tSTATUS\tMESSAGE\n")
for _, r := range repos {
var username string
if r.Username == "" {
username = "-"
} else {
username = r.Username
}
fmt.Fprintf(w, "%s\t%v\t%v\t%s\t%s\t%s\n", r.Repo, r.IsInsecure(), r.EnableLFS, username, r.ConnectionState.Status, r.ConnectionState.Message)
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%v\t%v\t%s\t%s\t%s\n", r.Type, r.Name, r.Repo, r.IsInsecure(), r.EnableLFS, username, r.ConnectionState.Status, r.ConnectionState.Message)
}
_ = w.Flush()
}

// Print list of repo urls
func printRepoUrls(repos []appsv1.Repository) {
func printRepoUrls(repos appsv1.Repositories) {
for _, r := range repos {
fmt.Println(r.Repo)
}
Expand Down
6 changes: 3 additions & 3 deletions controller/appcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ func (ctrl *ApplicationController) processAppRefreshQueueItem() (processNext boo

compareResult := ctrl.appStateManager.CompareAppState(app, revision, app.Spec.Source, refreshType == appv1.RefreshTypeHard, localManifests)

ctrl.normalizeApplication(origApp, app, compareResult.appSourceType)
ctrl.normalizeApplication(origApp, app)

app.Status.Conditions = append(app.Status.Conditions, compareResult.conditions...)

Expand Down Expand Up @@ -872,9 +872,9 @@ func (ctrl *ApplicationController) refreshAppConditions(app *appv1.Application)
}

// normalizeApplication normalizes an application.spec and additionally persists updates if it changed
func (ctrl *ApplicationController) normalizeApplication(orig, app *appv1.Application, sourceType appv1.ApplicationSourceType) {
func (ctrl *ApplicationController) normalizeApplication(orig, app *appv1.Application) {
logCtx := log.WithFields(log.Fields{"application": app.Name})
app.Spec = *argo.NormalizeApplicationSpec(&app.Spec, sourceType)
app.Spec = *argo.NormalizeApplicationSpec(&app.Spec)
patch, modified, err := diff.CreateTwoWayMergePatch(orig, app, appv1.Application{})
if err != nil {
logCtx.Errorf("error constructing app spec patch: %v", err)
Expand Down
4 changes: 2 additions & 2 deletions controller/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type appStateManager struct {
}

func (m *appStateManager) getRepoObjs(app *v1alpha1.Application, source v1alpha1.ApplicationSource, appLabelKey, revision string, noCache bool) ([]*unstructured.Unstructured, []*unstructured.Unstructured, *apiclient.ManifestResponse, error) {
helmRepos, err := m.db.ListHelmRepos(context.Background())
repos, err := m.db.ListRepositories(context.Background())
if err != nil {
return nil, nil, nil, err
}
Expand Down Expand Up @@ -122,7 +122,7 @@ func (m *appStateManager) getRepoObjs(app *v1alpha1.Application, source v1alpha1
}
manifestInfo, err := repoClient.GenerateManifest(context.Background(), &apiclient.ManifestRequest{
Repo: repo,
HelmRepos: helmRepos,
Copy link
Collaborator

@alexmt alexmt Sep 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove Repo field, since now we are passing all repositories and repo server just need to find matching one by URL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry - don't think it works like that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repos field now contains all repositories ( git and helm ). Repository server already filters give repos by type for helm applications. In the same way repo server might filter repo by URL. Is not it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repos: repos,
Revision: revision,
NoCache: noCache,
AppLabelKey: appLabelKey,
Expand Down
2 changes: 1 addition & 1 deletion controller/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestCompareAppStateEmpty(t *testing.T) {
assert.Equal(t, 0, len(compRes.conditions))
}

// TestCompareAppStateMissing tests when there is a manifest defined in git which doesn't exist in live
// TestCompareAppStateMissing tests when there is a manifest defined in the repo which doesn't exist in live
func TestCompareAppStateMissing(t *testing.T) {
app := newFakeApp()
data := fakeData{
Expand Down
5 changes: 3 additions & 2 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ uses only internally available Helm repositories. Even if the chart uses only de

```yaml
data:
helm.repositories: |
- url: http://<internal-helm-repo-host>:8080
repositories: |
- type: helm
url: http://<internal-helm-repo-host>:8080
name: stable
```

Expand Down
Loading