diff --git a/Procfile b/Procfile new file mode 100644 index 0000000000000..8ac9f7874531a --- /dev/null +++ b/Procfile @@ -0,0 +1,3 @@ +controller: go run ./cmd/argocd-application-controller/main.go +api-server: go run ./cmd/argocd-server/main.go +repo-server: go run ./cmd/argocd-repo-server/main.go diff --git a/cmd/argocd-server/commands/root.go b/cmd/argocd-server/commands/root.go index b2d3c34d261ca..f181ec764a4b5 100644 --- a/cmd/argocd-server/commands/root.go +++ b/cmd/argocd-server/commands/root.go @@ -3,6 +3,7 @@ package commands import ( "github.com/argoproj/argo-cd/errors" appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned" + "github.com/argoproj/argo-cd/reposerver" "github.com/argoproj/argo-cd/server" "github.com/argoproj/argo-cd/util/cli" log "github.com/sirupsen/logrus" @@ -14,9 +15,10 @@ import ( // NewCommand returns a new instance of an argocd command func NewCommand() *cobra.Command { var ( - logLevel string - clientConfig clientcmd.ClientConfig - staticAssetsDir string + logLevel string + clientConfig clientcmd.ClientConfig + staticAssetsDir string + repoServerAddress string ) var command = &cobra.Command{ Use: cliName, @@ -35,8 +37,9 @@ func NewCommand() *cobra.Command { kubeclientset := kubernetes.NewForConfigOrDie(config) appclientset := appclientset.NewForConfigOrDie(config) + repoclientset := reposerver.NewRepositoryServerClientset(repoServerAddress) - argocd := server.NewServer(kubeclientset, appclientset, namespace, staticAssetsDir) + argocd := server.NewServer(kubeclientset, appclientset, repoclientset, namespace, staticAssetsDir) argocd.Run() }, } @@ -44,6 +47,7 @@ func NewCommand() *cobra.Command { clientConfig = cli.AddKubectlFlagsToCmd(command) command.Flags().StringVar(&staticAssetsDir, "staticassets", "", "Static assets directory path") command.Flags().StringVar(&logLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error") + command.Flags().StringVar(&repoServerAddress, "repo-server", "localhost:8081", "Repo server address.") command.AddCommand(cli.NewVersionCmd(cliName)) return command } diff --git a/controller/controller.go b/controller/controller.go index c32483c3f8bbf..deb3503f7fb07 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -156,13 +156,13 @@ func (ctrl *ApplicationController) tryRefreshAppStatus(app *appv1.Application) ( } targetObjs := make([]*unstructured.Unstructured, len(manifestInfo.Manifests)) for i, manifestStr := range manifestInfo.Manifests { - var obj map[string]interface{} + var obj unstructured.Unstructured if err := json.Unmarshal([]byte(manifestStr), &obj); err != nil { if err != nil { return nil, err } } - targetObjs[i] = &unstructured.Unstructured{Object: obj} + targetObjs[i] = &obj } comparisonResult, err := ctrl.appComparator.CompareAppState(manifestInfo.Server, manifestInfo.Namespace, targetObjs, app) if err != nil { diff --git a/install/manifests/03d_argocd-server-deployment.yaml b/install/manifests/03d_argocd-server-deployment.yaml index bbff8dba127be..30363fe7481d2 100644 --- a/install/manifests/03d_argocd-server-deployment.yaml +++ b/install/manifests/03d_argocd-server-deployment.yaml @@ -21,7 +21,7 @@ spec: - mountPath: /shared name: static-files containers: - - command: [/argocd-server, --staticassets, /shared/app] + - command: [/argocd-server, --staticassets, /shared/app, --repo-server, 'argocd-repo-server:8081'] image: argoproj/argocd-server:latest name: argocd-server volumeMounts: diff --git a/reposerver/repository/repository.pb.go b/reposerver/repository/repository.pb.go index f4bf058ca2ef8..2a324828a64ad 100644 --- a/reposerver/repository/repository.pb.go +++ b/reposerver/repository/repository.pb.go @@ -126,7 +126,7 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for RepositoryService service type RepositoryServiceClient interface { - // Generate manifest for specified repo name and sha + // Generate manifest for application in specified repo name and revision GenerateManifest(ctx context.Context, in *ManifestRequest, opts ...grpc.CallOption) (*ManifestResponse, error) } @@ -150,7 +150,7 @@ func (c *repositoryServiceClient) GenerateManifest(ctx context.Context, in *Mani // Server API for RepositoryService service type RepositoryServiceServer interface { - // Generate manifest for specified repo name and sha + // Generate manifest for application in specified repo name and revision GenerateManifest(context.Context, *ManifestRequest) (*ManifestResponse, error) } diff --git a/server/application/application.go b/server/application/application.go index 40e50e8fd8d08..8638b4e948598 100644 --- a/server/application/application.go +++ b/server/application/application.go @@ -5,13 +5,18 @@ import ( appv1 "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned" + "github.com/argoproj/argo-cd/reposerver" + "github.com/argoproj/argo-cd/reposerver/repository" "github.com/argoproj/argo-cd/server/cluster" + apirepository "github.com/argoproj/argo-cd/server/repository" + "github.com/argoproj/argo-cd/util" "github.com/argoproj/argo-cd/util/diff" "github.com/argoproj/argo-cd/util/kube" log "github.com/sirupsen/logrus" "golang.org/x/net/context" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/client-go/kubernetes" ) @@ -20,17 +25,28 @@ type Server struct { ns string kubeclientset kubernetes.Interface appclientset appclientset.Interface + repoClientset reposerver.Clientset // TODO(jessesuen): move common cluster code to shared libraries clusterService cluster.ClusterServiceServer + repoService apirepository.RepositoryServiceServer } // NewServer returns a new instance of the Application service -func NewServer(namespace string, kubeclientset kubernetes.Interface, appclientset appclientset.Interface, clusterService cluster.ClusterServiceServer) ApplicationServiceServer { +func NewServer( + namespace string, + kubeclientset kubernetes.Interface, + appclientset appclientset.Interface, + repoClientset reposerver.Clientset, + repoService apirepository.RepositoryServiceServer, + clusterService cluster.ClusterServiceServer) ApplicationServiceServer { + return &Server{ ns: namespace, appclientset: appclientset, kubeclientset: kubeclientset, clusterService: clusterService, + repoClientset: repoClientset, + repoService: repoService, } } @@ -102,27 +118,48 @@ func (s *Server) Sync(ctx context.Context, syncReq *ApplicationSyncRequest) (*Ap if err != nil { return nil, err } - var syncRes ApplicationSyncResult - switch app.Status.ComparisonResult.Status { - case appv1.ComparisonStatusSynced: - case appv1.ComparisonStatusOutOfSync: - default: - appState := app.Status.ComparisonResult.Status - if appState == "" { - appState = "Unknown" - } - return nil, fmt.Errorf("Cannot sync application '%s' while in an '%s' state", app.ObjectMeta.Name, appState) + + repo, err := s.repoService.Get(ctx, &apirepository.RepoQuery{Repo: app.Spec.Source.RepoURL}) + if err != nil { + return nil, err } - clst, err := s.clusterService.Get(ctx, &cluster.ClusterQuery{Server: app.Status.ComparisonResult.Server}) + + conn, repoClient, err := s.repoClientset.NewRepositoryClient() if err != nil { return nil, err } - config := clst.RESTConfig() - targetNamespace := app.Status.ComparisonResult.Namespace - targetObjs, err := app.Status.ComparisonResult.TargetObjects() + defer util.Close(conn) + revision := syncReq.Revision + if revision == "" { + revision = app.Spec.Source.TargetRevision + } + + manifestInfo, err := repoClient.GenerateManifest(ctx, &repository.ManifestRequest{ + Repo: repo, + Environment: app.Spec.Source.Environment, + Path: app.Spec.Source.Path, + Revision: revision, + }) if err != nil { return nil, err } + + clst, err := s.clusterService.Get(ctx, &cluster.ClusterQuery{Server: manifestInfo.Server}) + if err != nil { + return nil, err + } + config := clst.RESTConfig() + targetNamespace := manifestInfo.Namespace + + targetObjs := make([]*unstructured.Unstructured, len(manifestInfo.Manifests)) + for i, manifest := range manifestInfo.Manifests { + obj, err := appv1.UnmarshalToUnstructured(manifest) + if err != nil { + return nil, err + } + targetObjs[i] = obj + } + liveObjs, err := kube.GetLiveResources(config, targetObjs, targetNamespace) if err != nil { return nil, err @@ -131,6 +168,7 @@ func (s *Server) Sync(ctx context.Context, syncReq *ApplicationSyncRequest) (*Ap if err != nil { return nil, err } + var syncRes ApplicationSyncResult syncRes.Resources = make([]*ResourceDetails, 0) for i, diffRes := range diffResList.Diffs { resDetails := ResourceDetails{ diff --git a/server/application/application.pb.go b/server/application/application.pb.go index a3a9f1121c6f7..1172240dc99fe 100644 --- a/server/application/application.pb.go +++ b/server/application/application.pb.go @@ -71,8 +71,9 @@ func (*ApplicationResponse) Descriptor() ([]byte, []int) { return fileDescriptor // ApplicationSyncRequest is a request to apply the config state to live state type ApplicationSyncRequest struct { - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` - DryRun bool `protobuf:"varint,2,opt,name=dryRun" json:"dryRun,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Revision string `protobuf:"bytes,2,opt,name=revision" json:"revision,omitempty"` + DryRun bool `protobuf:"varint,3,opt,name=dryRun" json:"dryRun,omitempty"` } func (m *ApplicationSyncRequest) Reset() { *m = ApplicationSyncRequest{} } @@ -87,6 +88,13 @@ func (m *ApplicationSyncRequest) GetName() string { return "" } +func (m *ApplicationSyncRequest) GetRevision() string { + if m != nil { + return m.Revision + } + return "" +} + func (m *ApplicationSyncRequest) GetDryRun() bool { if m != nil { return m.DryRun @@ -517,44 +525,45 @@ var _ApplicationService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("server/application/application.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 622 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0xc1, 0x6e, 0x13, 0x3d, - 0x10, 0xc7, 0xb5, 0x6d, 0xbe, 0x7c, 0x8d, 0x7b, 0x00, 0x99, 0xb6, 0x0a, 0xdb, 0x54, 0x44, 0x6e, - 0x85, 0x42, 0x25, 0xbc, 0x4d, 0xb9, 0xa0, 0xde, 0x80, 0x02, 0x02, 0x71, 0x28, 0x8b, 0x10, 0x12, - 0x17, 0xe4, 0xee, 0x8e, 0xb6, 0x4b, 0x76, 0x6d, 0xd7, 0xf6, 0xae, 0x14, 0x21, 0x2e, 0xbc, 0x00, - 0x42, 0x3c, 0x00, 0xcf, 0xc1, 0x91, 0x23, 0x67, 0x5e, 0x81, 0x07, 0x41, 0x76, 0xb3, 0x64, 0xd3, - 0xa4, 0xc9, 0x25, 0x07, 0x6e, 0xb3, 0x9e, 0xd9, 0xf9, 0xff, 0x3c, 0x63, 0x8f, 0xd1, 0x9e, 0x06, - 0x55, 0x82, 0x0a, 0x98, 0x94, 0x59, 0x1a, 0x31, 0x93, 0x0a, 0x5e, 0xb7, 0xa9, 0x54, 0xc2, 0x08, - 0xbc, 0x5e, 0x5b, 0xf2, 0x37, 0x12, 0x91, 0x08, 0xb7, 0x1e, 0x58, 0xeb, 0x22, 0xc4, 0xef, 0x24, - 0x42, 0x24, 0x19, 0x04, 0x4c, 0xa6, 0x01, 0xe3, 0x5c, 0x18, 0x17, 0xac, 0x47, 0x5e, 0x32, 0xb8, - 0xaf, 0x69, 0x2a, 0x9c, 0x37, 0x12, 0x0a, 0x82, 0xb2, 0x1f, 0x24, 0xc0, 0x41, 0x31, 0x03, 0xf1, - 0x28, 0xe6, 0x59, 0x92, 0x9a, 0xb3, 0xe2, 0x94, 0x46, 0x22, 0x0f, 0x98, 0x72, 0x12, 0xef, 0x9d, - 0x71, 0x37, 0x8a, 0x03, 0x39, 0x48, 0xec, 0xcf, 0x7a, 0x02, 0xb4, 0xec, 0xb3, 0x4c, 0x9e, 0xb1, - 0xa9, 0x54, 0xe4, 0x36, 0xba, 0xfe, 0x60, 0x1c, 0xf7, 0xb2, 0x00, 0x35, 0xc4, 0x18, 0x35, 0x38, - 0xcb, 0xa1, 0xed, 0x75, 0xbd, 0x5e, 0x2b, 0x74, 0x36, 0xd9, 0x44, 0x37, 0x6a, 0x71, 0x21, 0x68, - 0x29, 0xb8, 0x06, 0x72, 0x8c, 0xb6, 0x6a, 0xcb, 0xaf, 0x86, 0x3c, 0x0a, 0xe1, 0xbc, 0x00, 0x6d, - 0x66, 0x25, 0xc1, 0x5b, 0xa8, 0x19, 0xab, 0x61, 0x58, 0xf0, 0xf6, 0x4a, 0xd7, 0xeb, 0xad, 0x85, - 0xa3, 0x2f, 0x92, 0xa3, 0xcd, 0xa9, 0x2c, 0xba, 0xc8, 0x0c, 0x6e, 0xa3, 0xff, 0x73, 0xd0, 0x9a, - 0x25, 0x55, 0x9e, 0xea, 0x13, 0x1f, 0x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x24, 0x33, 0x4b, 0x7b, - 0xe4, 0xed, 0xe3, 0x2f, 0x1e, 0x5a, 0x7d, 0x0a, 0x0b, 0xdb, 0xbd, 0x2c, 0x9e, 0xa9, 0x8a, 0xd6, - 0x79, 0x82, 0x0f, 0xf6, 0xe0, 0x7e, 0xc4, 0x3f, 0x3d, 0xd4, 0x7c, 0x2d, 0xe3, 0x7f, 0xb1, 0x9e, - 0x81, 0xe3, 0xbf, 0xe3, 0xef, 0xcd, 0xe6, 0xcf, 0xc1, 0xb0, 0x98, 0x19, 0x46, 0xdd, 0x46, 0x6c, - 0x7d, 0x39, 0x6a, 0x1e, 0x43, 0x06, 0x06, 0x16, 0x55, 0xb8, 0x7b, 0x95, 0xfb, 0xef, 0x64, 0x1b, - 0xd5, 0x6e, 0x7f, 0x6e, 0xed, 0x24, 0x5a, 0xb3, 0x77, 0xea, 0x44, 0xc4, 0x7a, 0x91, 0xe2, 0x36, - 0xbd, 0x18, 0xec, 0x76, 0xeb, 0xd4, 0x0e, 0x76, 0x5a, 0xf6, 0xe9, 0x89, 0x88, 0xdd, 0x9d, 0xec, - 0x39, 0x31, 0x82, 0xbb, 0x73, 0xc4, 0x02, 0x69, 0x55, 0x86, 0xa8, 0x61, 0xe7, 0x23, 0xde, 0xbd, - 0x4a, 0xad, 0x36, 0x83, 0x7d, 0x32, 0x3f, 0xc8, 0x8e, 0xd8, 0x4a, 0x9a, 0xcc, 0x95, 0xd6, 0x43, - 0x1e, 0x3d, 0x3c, 0x78, 0x4b, 0xe7, 0xbd, 0x3b, 0xd3, 0xcf, 0xe3, 0x69, 0xd3, 0xbd, 0x31, 0xf7, - 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x3d, 0x28, 0x52, 0x3b, 0x07, 0x00, 0x00, + // 635 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xc1, 0x6e, 0x13, 0x3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 0x4e, 0xed, 0xd2, 0xa7, 0x79, 0x97, 0x9e, 0x88, 0xd8, 0xfd, 0x93, 0x1d, 0x07, 0x46, 0x70, + 0x7b, 0x0e, 0x58, 0x20, 0x2d, 0xca, 0x08, 0xd5, 0xec, 0x7e, 0xc4, 0xbb, 0x57, 0xa1, 0x55, 0xf6, + 0xb3, 0x4f, 0xe6, 0x27, 0xd9, 0x15, 0x5b, 0x42, 0x93, 0xb9, 0xd0, 0x7a, 0xc4, 0xa3, 0x87, 0x07, + 0x6f, 0xe9, 0xbc, 0x37, 0x69, 0xfa, 0xe9, 0x3c, 0xad, 0xbb, 0xf7, 0xe7, 0xde, 0xdf, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x35, 0xab, 0xb5, 0x88, 0x57, 0x07, 0x00, 0x00, } diff --git a/server/application/application.proto b/server/application/application.proto index bd337ac85e4d1..d92cbf77b31a6 100644 --- a/server/application/application.proto +++ b/server/application/application.proto @@ -22,7 +22,8 @@ message ApplicationResponse {} // ApplicationSyncRequest is a request to apply the config state to live state message ApplicationSyncRequest { string name = 1; - bool dryRun = 2; + string revision = 2; + bool dryRun = 3; } // ApplicationSyncResult is a result of a sync requeswt diff --git a/server/server.go b/server/server.go index 30a3ec81ad9de..0049b5e51e881 100644 --- a/server/server.go +++ b/server/server.go @@ -10,6 +10,7 @@ import ( argocd "github.com/argoproj/argo-cd" appclientset "github.com/argoproj/argo-cd/pkg/client/clientset/versioned" + "github.com/argoproj/argo-cd/reposerver" "github.com/argoproj/argo-cd/server/application" "github.com/argoproj/argo-cd/server/cluster" "github.com/argoproj/argo-cd/server/repository" @@ -39,15 +40,18 @@ type ArgoCDServer struct { staticAssetsDir string kubeclientset kubernetes.Interface appclientset appclientset.Interface + repoclientset reposerver.Clientset log *log.Entry } // NewServer returns a new instance of the ArgoCD API server -func NewServer(kubeclientset kubernetes.Interface, appclientset appclientset.Interface, namespace string, staticAssetsDir string) *ArgoCDServer { +func NewServer( + kubeclientset kubernetes.Interface, appclientset appclientset.Interface, repoclientset reposerver.Clientset, namespace string, staticAssetsDir string) *ArgoCDServer { return &ArgoCDServer{ ns: namespace, kubeclientset: kubeclientset, appclientset: appclientset, + repoclientset: repoclientset, log: log.NewEntry(log.New()), staticAssetsDir: staticAssetsDir, } @@ -85,9 +89,10 @@ func (a *ArgoCDServer) Run() { ) version.RegisterVersionServiceServer(grpcS, &version.Server{}) clusterService := cluster.NewServer(a.ns, a.kubeclientset, a.appclientset) + repoService := repository.NewServer(a.ns, a.kubeclientset, a.appclientset) cluster.RegisterClusterServiceServer(grpcS, clusterService) - application.RegisterApplicationServiceServer(grpcS, application.NewServer(a.ns, a.kubeclientset, a.appclientset, clusterService)) - repository.RegisterRepositoryServiceServer(grpcS, repository.NewServer(a.ns, a.kubeclientset, a.appclientset)) + application.RegisterApplicationServiceServer(grpcS, application.NewServer(a.ns, a.kubeclientset, a.appclientset, a.repoclientset, repoService, clusterService)) + repository.RegisterRepositoryServiceServer(grpcS, repoService) // HTTP 1.1+JSON Server // grpc-ecosystem/grpc-gateway is used to proxy HTTP requests to the corresponding gRPC call