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

Issue #19 - Add repo-server into installer #22

Merged
merged 1 commit into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# a user's workspace, and are only building off of what is locked by dep.
vendor
Dockerfile-argocd
dist
2 changes: 1 addition & 1 deletion cmd/argocd-application-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func newCommand() *cobra.Command {

clientConfig = cli.AddKubectlFlagsToCmd(&command)
command.Flags().Int64Var(&appResyncPeriod, "app-resync", defaultAppResyncPeriod, "Time period in seconds for application resync.")
command.Flags().StringVar(&repoServerAddress, "reposerveraddr", "localhost:8081", "Repo server address.")
command.Flags().StringVar(&repoServerAddress, "repo-server", "localhost:8081", "Repo server address.")
return &command
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/argocd-repo-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

const (
// CLIName is the name of the CLI
cliName = "argocd-manifest-server"
cliName = "argocd-repo-server"
port = 8081
)

Expand Down Expand Up @@ -52,10 +52,10 @@ func newCommand() *cobra.Command {
nativeGitClient, err := git.NewNativeGitClient()
errors.CheckError(err)
grpc := server.CreateGRPC(nativeGitClient)
listener, err := net.Listen("tcp", fmt.Sprintf("127.0.0.1:%d", port))
listener, err := net.Listen("tcp", fmt.Sprintf("0.0.0.0:%d", port))
errors.CheckError(err)

log.Infof("argocd-repo-server %s serving on port %d (namespace: %s)", argocd.GetVersion(), port, namespace)
log.Infof("argocd-repo-server %s serving on %s (namespace: %s)", argocd.GetVersion(), listener.Addr(), namespace)
err = grpc.Serve(listener)
errors.CheckError(err)
return nil
Expand Down
1 change: 1 addition & 0 deletions cmd/argocd/commands/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func NewInstallCommand() *cobra.Command {
command.Flags().StringVar(&installOpts.ControllerImage, "controller-image", DefaultControllerImage, "use a specified controller image")
command.Flags().StringVar(&installOpts.ServerImage, "server-image", DefaultServerImage, "use a specified api server image")
command.Flags().StringVar(&installOpts.UIImage, "ui-image", DefaultUiImage, "use a specified ui image")
command.Flags().StringVar(&installOpts.RepoServerImage, "repo-server-image", DefaultServerImage, "use a specified repo server image")
command.Flags().StringVar(&installOpts.ImagePullPolicy, "image-pull-policy", "", "set the image pull policy of the pod specs")
clientConfig = cli.AddKubectlFlagsToCmd(command)
return command
Expand Down
1 change: 1 addition & 0 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func (ctrl *ApplicationController) tryRefreshAppStatus(app *appv1.Application) (
Environment: app.Spec.Source.Environment,
})
if err != nil {
log.Errorf("Failed to load application manifest %v", err)
return nil, err
}
targetObjs := make([]*unstructured.Unstructured, len(manifestInfo.Manifests))
Expand Down
13 changes: 13 additions & 0 deletions install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type InstallOptions struct {
ControllerImage string
UIImage string
ServerImage string
RepoServerImage string
ImagePullPolicy string
}

Expand Down Expand Up @@ -75,6 +76,7 @@ func (i *Installer) Install() {
i.InstallApplicationCRD()
i.InstallApplicationController()
i.InstallArgoCDServer()
i.InstallArgoCDRepoServer()
}

func (i *Installer) InstallNamespace() {
Expand Down Expand Up @@ -129,6 +131,17 @@ func (i *Installer) InstallArgoCDServer() {
i.MustInstallResource(kube.MustToUnstructured(&argoCDServerService))
}

func (i *Installer) InstallArgoCDRepoServer() {
var argoCDRepoServerControllerDeployment appsv1beta2.Deployment
var argoCDRepoServerService apiv1.Service
i.unmarshalManifest("04a_argocd-repo-server-deployment.yaml", &argoCDRepoServerControllerDeployment)
i.unmarshalManifest("04b_argocd-repo-server-service.yaml", &argoCDRepoServerService)
argoCDRepoServerControllerDeployment.Spec.Template.Spec.Containers[0].Image = i.RepoServerImage
argoCDRepoServerControllerDeployment.Spec.Template.Spec.Containers[0].ImagePullPolicy = apiv1.PullPolicy(i.ImagePullPolicy)
i.MustInstallResource(kube.MustToUnstructured(&argoCDRepoServerControllerDeployment))
i.MustInstallResource(kube.MustToUnstructured(&argoCDRepoServerService))
}

func (i *Installer) unmarshalManifest(fileName string, obj interface{}) {
yamlBytes, err := i.box.MustBytes(fileName)
errors.CheckError(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ spec:
app: application-controller
spec:
containers:
- command:
- /argocd-application-controller
- command: [/argocd-application-controller, --repo-server, 'argocd-repo-server:8081']
image: argoproj/argocd-application-controller:latest
name: application-controller
serviceAccountName: application-controller
20 changes: 20 additions & 0 deletions install/manifests/04a_argocd-repo-server-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: argocd-repo-server
namespace: argocd
spec:
selector:
matchLabels:
app: argocd-repo-server
template:
metadata:
labels:
app: argocd-repo-server
spec:
containers:
- command: [/argocd-repo-server]
image: argoproj/argocd-repo-server:latest
name: argocd-repo-server
ports:
- containerPort: 8081
10 changes: 10 additions & 0 deletions install/manifests/04b_argocd-repo-server-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: argocd-repo-server
namespace: argocd
spec:
ports:
- port: 8081
selector:
app: argocd-repo-server
2 changes: 2 additions & 0 deletions reposerver/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package reposerver
import (
"github.com/argoproj/argo-cd/reposerver/repository"
"github.com/argoproj/argo-cd/util"
log "github.com/sirupsen/logrus"
"google.golang.org/grpc"
)

Expand All @@ -18,6 +19,7 @@ type clientSet struct {
func (c *clientSet) NewRepositoryClient() (util.Closer, repository.RepositoryServiceClient, error) {
conn, err := grpc.Dial(c.address, grpc.WithInsecure())
if err != nil {
log.Errorf("Unable to connect to repository service with address %s", c.address)
return nil, nil, err
}
return conn, repository.NewRepositoryServiceClient(conn), nil
Expand Down