Repository: fluxcd/flux
Pull request #2464 (2019-09-23 13:47:47)

Move Flux packages to pkg dir
I've left the `integrations` package in place since renaming the top package needs the k8s code gen and Flux doesn't have this dependency anymore. At some point we should be able to remove the HelmRelease v1beta1 and FluxHelmRelease v1alpha1 from Flux.


Patch:
diff --git a/Makefile b/Makefile
index d1396109..056aea03 100644
--- a/Makefile
+++ b/Makefile
@@ -113,14 +113,14 @@ $(GOBIN)/fluxd: $(FLUXD_DEPS)
 integration-test: all
 	test/bin/test-flux
 
-generate-deploy: install/generated_templates.gogen.go
-	cd deploy && go run ../install/generate.go deploy
+generate-deploy: pkg/install/generated_templates.gogen.go
+	cd deploy && go run ../pkg/install/generate.go deploy
 
-install/generated_templates.gogen.go: install/templates/*
-	cd install && go run generate.go embedded-templates
+pkg/install/generated_templates.gogen.go: pkg/install/templates/*
+	cd pkg/install && go run generate.go embedded-templates
 
-check-generated: generate-deploy install/generated_templates.gogen.go
-	git diff --exit-code -- integrations/apis integrations/client install/generated_templates.gogen.go
+check-generated: generate-deploy pkg/install/generated_templates.gogen.go
+	git diff --exit-code -- integrations/apis integrations/client pkg/install/generated_templates.gogen.go
 
 build-docs:
 	@cd docs && docker build -t flux-docs .
diff --git a/cmd/fluxctl/args.go b/cmd/fluxctl/args.go
index 8fe2dfd6..04c69ebb 100644
--- a/cmd/fluxctl/args.go
+++ b/cmd/fluxctl/args.go
@@ -11,7 +11,7 @@ import (
 
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 func AddCauseFlags(cmd *cobra.Command, opts *update.Cause) {
diff --git a/cmd/fluxctl/automate_cmd.go b/cmd/fluxctl/automate_cmd.go
index b6d2cfbe..fd3a9648 100644
--- a/cmd/fluxctl/automate_cmd.go
+++ b/cmd/fluxctl/automate_cmd.go
@@ -3,7 +3,7 @@ package main
 import (
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type workloadAutomateOpts struct {
diff --git a/cmd/fluxctl/await.go b/cmd/fluxctl/await.go
index 63925c4e..1581bd53 100644
--- a/cmd/fluxctl/await.go
+++ b/cmd/fluxctl/await.go
@@ -7,9 +7,9 @@ import (
 	"io"
 	"time"
 
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 var ErrTimeout = errors.New("timeout")
diff --git a/cmd/fluxctl/deautomate_cmd.go b/cmd/fluxctl/deautomate_cmd.go
index bae54d5a..30d47873 100644
--- a/cmd/fluxctl/deautomate_cmd.go
+++ b/cmd/fluxctl/deautomate_cmd.go
@@ -3,7 +3,7 @@ package main
 import (
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type workloadDeautomateOpts struct {
diff --git a/cmd/fluxctl/install_cmd.go b/cmd/fluxctl/install_cmd.go
index 538912b7..f271f1fa 100644
--- a/cmd/fluxctl/install_cmd.go
+++ b/cmd/fluxctl/install_cmd.go
@@ -6,7 +6,7 @@ import (
 
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/install"
+	"github.com/fluxcd/flux/pkg/install"
 )
 
 type installOpts install.TemplateParameters
diff --git a/cmd/fluxctl/list_images_cmd.go b/cmd/fluxctl/list_images_cmd.go
index afcec252..b2ece425 100644
--- a/cmd/fluxctl/list_images_cmd.go
+++ b/cmd/fluxctl/list_images_cmd.go
@@ -8,11 +8,11 @@ import (
 
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/registry"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/registry"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type imageListOpts struct {
diff --git a/cmd/fluxctl/list_workloads_cmd.go b/cmd/fluxctl/list_workloads_cmd.go
index 53d30a09..0fe7e176 100644
--- a/cmd/fluxctl/list_workloads_cmd.go
+++ b/cmd/fluxctl/list_workloads_cmd.go
@@ -8,8 +8,8 @@ import (
 
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/policy"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/policy"
 )
 
 type workloadListOpts struct {
diff --git a/cmd/fluxctl/lock_cmd.go b/cmd/fluxctl/lock_cmd.go
index 699c2d5f..873fffe8 100644
--- a/cmd/fluxctl/lock_cmd.go
+++ b/cmd/fluxctl/lock_cmd.go
@@ -3,7 +3,7 @@ package main
 import (
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type workloadLockOpts struct {
diff --git a/cmd/fluxctl/main.go b/cmd/fluxctl/main.go
index 154505ad..b87e8799 100644
--- a/cmd/fluxctl/main.go
+++ b/cmd/fluxctl/main.go
@@ -5,7 +5,7 @@ import (
 
 	"github.com/pkg/errors"
 
-	fluxerr "github.com/fluxcd/flux/errors"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
 )
 
 func run(args []string) int {
diff --git a/cmd/fluxctl/policy_cmd.go b/cmd/fluxctl/policy_cmd.go
index 17ab1839..66d10443 100644
--- a/cmd/fluxctl/policy_cmd.go
+++ b/cmd/fluxctl/policy_cmd.go
@@ -7,9 +7,9 @@ import (
 
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type workloadPolicyOpts struct {
diff --git a/cmd/fluxctl/release_cmd.go b/cmd/fluxctl/release_cmd.go
index 6927d2fa..5c8e01ea 100644
--- a/cmd/fluxctl/release_cmd.go
+++ b/cmd/fluxctl/release_cmd.go
@@ -8,12 +8,12 @@ import (
 
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type workloadReleaseOpts struct {
diff --git a/cmd/fluxctl/root_cmd.go b/cmd/fluxctl/root_cmd.go
index 225facbe..11490eff 100644
--- a/cmd/fluxctl/root_cmd.go
+++ b/cmd/fluxctl/root_cmd.go
@@ -12,9 +12,9 @@ import (
 	"github.com/spf13/cobra"
 	"github.com/spf13/pflag"
 
-	"github.com/fluxcd/flux/api"
-	transport "github.com/fluxcd/flux/http"
-	"github.com/fluxcd/flux/http/client"
+	"github.com/fluxcd/flux/pkg/api"
+	transport "github.com/fluxcd/flux/pkg/http"
+	"github.com/fluxcd/flux/pkg/http/client"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
 
diff --git a/cmd/fluxctl/sync_cmd.go b/cmd/fluxctl/sync_cmd.go
index 5728df30..c3d3880f 100644
--- a/cmd/fluxctl/sync_cmd.go
+++ b/cmd/fluxctl/sync_cmd.go
@@ -7,8 +7,8 @@ import (
 
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type syncOpts struct {
diff --git a/cmd/fluxctl/unlock_cmd.go b/cmd/fluxctl/unlock_cmd.go
index 7c24cad9..1c439394 100644
--- a/cmd/fluxctl/unlock_cmd.go
+++ b/cmd/fluxctl/unlock_cmd.go
@@ -3,7 +3,7 @@ package main
 import (
 	"github.com/spf13/cobra"
 
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type workloadUnlockOpts struct {
diff --git a/cmd/fluxd/main.go b/cmd/fluxd/main.go
index a992bf0a..9fdea0e3 100644
--- a/cmd/fluxd/main.go
+++ b/cmd/fluxd/main.go
@@ -30,26 +30,26 @@ import (
 	"k8s.io/client-go/tools/clientcmd"
 	"k8s.io/klog"
 
-	"github.com/fluxcd/flux/checkpoint"
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/cluster/kubernetes"
-	"github.com/fluxcd/flux/daemon"
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/gpg"
-	transport "github.com/fluxcd/flux/http"
-	"github.com/fluxcd/flux/http/client"
-	daemonhttp "github.com/fluxcd/flux/http/daemon"
-	"github.com/fluxcd/flux/image"
 	hrclient "github.com/fluxcd/flux/integrations/client/clientset/versioned"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/manifests"
-	"github.com/fluxcd/flux/registry"
-	"github.com/fluxcd/flux/registry/cache"
-	registryMemcache "github.com/fluxcd/flux/registry/cache/memcached"
-	registryMiddleware "github.com/fluxcd/flux/registry/middleware"
-	"github.com/fluxcd/flux/remote"
-	"github.com/fluxcd/flux/ssh"
-	fluxsync "github.com/fluxcd/flux/sync"
+	"github.com/fluxcd/flux/pkg/checkpoint"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes"
+	"github.com/fluxcd/flux/pkg/daemon"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/gpg"
+	transport "github.com/fluxcd/flux/pkg/http"
+	"github.com/fluxcd/flux/pkg/http/client"
+	daemonhttp "github.com/fluxcd/flux/pkg/http/daemon"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/manifests"
+	"github.com/fluxcd/flux/pkg/registry"
+	"github.com/fluxcd/flux/pkg/registry/cache"
+	registryMemcache "github.com/fluxcd/flux/pkg/registry/cache/memcached"
+	registryMiddleware "github.com/fluxcd/flux/pkg/registry/middleware"
+	"github.com/fluxcd/flux/pkg/remote"
+	"github.com/fluxcd/flux/pkg/ssh"
+	fluxsync "github.com/fluxcd/flux/pkg/sync"
 )
 
 var version = "unversioned"
diff --git a/integrations/apis/flux.weave.works/v1beta1/types.go b/integrations/apis/flux.weave.works/v1beta1/types.go
index c9e789d7..e88e3b54 100644
--- a/integrations/apis/flux.weave.works/v1beta1/types.go
+++ b/integrations/apis/flux.weave.works/v1beta1/types.go
@@ -9,7 +9,7 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/helm/pkg/chartutil"
 
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // +genclient
diff --git a/api/api.go b/pkg/api/api.go
similarity index 84%
rename from api/api.go
rename to pkg/api/api.go
index aaeeea36..41429368 100644
--- a/api/api.go
+++ b/pkg/api/api.go
@@ -1,6 +1,6 @@
 package api
 
-import "github.com/fluxcd/flux/api/v11"
+import "github.com/fluxcd/flux/pkg/api/v11"
 
 // Server defines the minimal interface a Flux must satisfy to adequately serve a
 // connecting fluxctl. This interface specifically does not facilitate connecting
diff --git a/api/v10/api.go b/pkg/api/v10/api.go
similarity index 79%
rename from api/v10/api.go
rename to pkg/api/v10/api.go
index 1930e098..864378cf 100644
--- a/api/v10/api.go
+++ b/pkg/api/v10/api.go
@@ -4,9 +4,9 @@ package v10
 import (
 	"context"
 
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/api/v9"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type ListImagesOptions struct {
diff --git a/api/v11/api.go b/pkg/api/v11/api.go
similarity index 79%
rename from api/v11/api.go
rename to pkg/api/v11/api.go
index 5da46545..846dd705 100644
--- a/api/v11/api.go
+++ b/pkg/api/v11/api.go
@@ -4,9 +4,9 @@ package v11
 import (
 	"context"
 
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type ListServicesOptions struct {
diff --git a/api/v6/api.go b/pkg/api/v6/api.go
similarity index 90%
rename from api/v6/api.go
rename to pkg/api/v6/api.go
index 01c0311f..bf4662bf 100644
--- a/api/v6/api.go
+++ b/pkg/api/v6/api.go
@@ -3,12 +3,12 @@ package v6
 import (
 	"context"
 
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/ssh"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/ssh"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type ImageStatus struct {
diff --git a/api/v6/container.go b/pkg/api/v6/container.go
similarity index 96%
rename from api/v6/container.go
rename to pkg/api/v6/container.go
index 7902e2b2..fb578833 100644
--- a/api/v6/container.go
+++ b/pkg/api/v6/container.go
@@ -1,11 +1,11 @@
 package v6
 
 import (
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/registry"
+	"github.com/fluxcd/flux/pkg/update"
 	"github.com/pkg/errors"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/registry"
-	"github.com/fluxcd/flux/update"
 )
 
 // Container describes an individual container including current image info and
diff --git a/api/v9/api.go b/pkg/api/v9/api.go
similarity index 91%
rename from api/v9/api.go
rename to pkg/api/v9/api.go
index d9e62fb3..51dca064 100644
--- a/api/v9/api.go
+++ b/pkg/api/v9/api.go
@@ -4,7 +4,7 @@ package v9
 import (
 	"context"
 
-	"github.com/fluxcd/flux/api/v6"
+	"github.com/fluxcd/flux/pkg/api/v6"
 )
 
 type Server interface {
diff --git a/api/v9/change.go b/pkg/api/v9/change.go
similarity index 96%
rename from api/v9/change.go
rename to pkg/api/v9/change.go
index 279a0dbf..8cf8e9dd 100644
--- a/api/v9/change.go
+++ b/pkg/api/v9/change.go
@@ -4,7 +4,7 @@ import (
 	"encoding/json"
 	"errors"
 
-	"github.com/fluxcd/flux/image"
+	"github.com/fluxcd/flux/pkg/image"
 )
 
 type ChangeKind string
diff --git a/checkpoint/checkpoint.go b/pkg/checkpoint/checkpoint.go
similarity index 100%
rename from checkpoint/checkpoint.go
rename to pkg/checkpoint/checkpoint.go
diff --git a/checkpoint/checkpoint_darwin.go b/pkg/checkpoint/checkpoint_darwin.go
similarity index 100%
rename from checkpoint/checkpoint_darwin.go
rename to pkg/checkpoint/checkpoint_darwin.go
diff --git a/checkpoint/checkpoint_linux_amd64.go b/pkg/checkpoint/checkpoint_linux_amd64.go
similarity index 100%
rename from checkpoint/checkpoint_linux_amd64.go
rename to pkg/checkpoint/checkpoint_linux_amd64.go
diff --git a/checkpoint/checkpoint_linux_arm.go b/pkg/checkpoint/checkpoint_linux_arm.go
similarity index 100%
rename from checkpoint/checkpoint_linux_arm.go
rename to pkg/checkpoint/checkpoint_linux_arm.go
diff --git a/checkpoint/checkpoint_linux_arm64.go b/pkg/checkpoint/checkpoint_linux_arm64.go
similarity index 100%
rename from checkpoint/checkpoint_linux_arm64.go
rename to pkg/checkpoint/checkpoint_linux_arm64.go
diff --git a/cluster/cluster.go b/pkg/cluster/cluster.go
similarity index 96%
rename from cluster/cluster.go
rename to pkg/cluster/cluster.go
index 73a0b647..1525f4d9 100644
--- a/cluster/cluster.go
+++ b/pkg/cluster/cluster.go
@@ -4,9 +4,9 @@ import (
 	"context"
 	"errors"
 
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/ssh"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/ssh"
 )
 
 // Constants for workload ready status. These are defined here so that
diff --git a/cluster/kubernetes/cached_disco.go b/pkg/cluster/kubernetes/cached_disco.go
similarity index 100%
rename from cluster/kubernetes/cached_disco.go
rename to pkg/cluster/kubernetes/cached_disco.go
diff --git a/cluster/kubernetes/cached_disco_test.go b/pkg/cluster/kubernetes/cached_disco_test.go
similarity index 100%
rename from cluster/kubernetes/cached_disco_test.go
rename to pkg/cluster/kubernetes/cached_disco_test.go
diff --git a/cluster/kubernetes/doc.go b/pkg/cluster/kubernetes/doc.go
similarity index 100%
rename from cluster/kubernetes/doc.go
rename to pkg/cluster/kubernetes/doc.go
diff --git a/cluster/kubernetes/errors.go b/pkg/cluster/kubernetes/errors.go
similarity index 95%
rename from cluster/kubernetes/errors.go
rename to pkg/cluster/kubernetes/errors.go
index 74437605..347dfd1a 100644
--- a/cluster/kubernetes/errors.go
+++ b/pkg/cluster/kubernetes/errors.go
@@ -3,7 +3,7 @@ package kubernetes
 import (
 	"fmt"
 
-	fluxerr "github.com/fluxcd/flux/errors"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
 )
 
 func ObjectMissingError(obj string, err error) *fluxerr.Error {
diff --git a/cluster/kubernetes/images.go b/pkg/cluster/kubernetes/images.go
similarity index 97%
rename from cluster/kubernetes/images.go
rename to pkg/cluster/kubernetes/images.go
index 6a95d5cb..44db1c3c 100644
--- a/cluster/kubernetes/images.go
+++ b/pkg/cluster/kubernetes/images.go
@@ -11,9 +11,9 @@ import (
 	apierrors "k8s.io/apimachinery/pkg/api/errors"
 	meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/registry"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/registry"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 func mergeCredentials(log func(...interface{}) error,
diff --git a/cluster/kubernetes/kubernetes.go b/pkg/cluster/kubernetes/kubernetes.go
similarity index 97%
rename from cluster/kubernetes/kubernetes.go
rename to pkg/cluster/kubernetes/kubernetes.go
index 3a1222d4..2df97da5 100644
--- a/cluster/kubernetes/kubernetes.go
+++ b/pkg/cluster/kubernetes/kubernetes.go
@@ -18,11 +18,11 @@ import (
 	k8sclientdynamic "k8s.io/client-go/dynamic"
 	k8sclient "k8s.io/client-go/kubernetes"
 
-	"github.com/fluxcd/flux/cluster"
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
 	fhrclient "github.com/fluxcd/flux/integrations/client/clientset/versioned"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/ssh"
+	"github.com/fluxcd/flux/pkg/cluster"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/ssh"
 )
 
 type coreClient k8sclient.Interface
@@ -43,9 +43,9 @@ func MakeClusterClientset(core coreClient, dyn dynamicClient, fluxhelm fluxHelmC
 	helmop helmOperatorClient, disco discoveryClient) ExtendedClient {
 
 	return ExtendedClient{
-		coreClient:      	core,
-		dynamicClient:   	dyn,
-		fluxHelmClient:  	fluxhelm,
+		coreClient:         core,
+		dynamicClient:      dyn,
+		fluxHelmClient:     fluxhelm,
 		helmOperatorClient: helmop,
 		discoveryClient:    disco,
 	}
diff --git a/cluster/kubernetes/kubernetes_test.go b/pkg/cluster/kubernetes/kubernetes_test.go
similarity index 100%
rename from cluster/kubernetes/kubernetes_test.go
rename to pkg/cluster/kubernetes/kubernetes_test.go
diff --git a/cluster/kubernetes/kubeyaml.go b/pkg/cluster/kubernetes/kubeyaml.go
similarity index 100%
rename from cluster/kubernetes/kubeyaml.go
rename to pkg/cluster/kubernetes/kubeyaml.go
diff --git a/cluster/kubernetes/manifests.go b/pkg/cluster/kubernetes/manifests.go
similarity index 98%
rename from cluster/kubernetes/manifests.go
rename to pkg/cluster/kubernetes/manifests.go
index 1f72b26a..2c333b11 100644
--- a/cluster/kubernetes/manifests.go
+++ b/pkg/cluster/kubernetes/manifests.go
@@ -10,9 +10,9 @@ import (
 	"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
 	"k8s.io/apimachinery/pkg/runtime/schema"
 
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // ResourceScopes maps resource definitions (GroupVersionKind) to whether they are namespaced or not
diff --git a/cluster/kubernetes/mock.go b/pkg/cluster/kubernetes/mock.go
similarity index 71%
rename from cluster/kubernetes/mock.go
rename to pkg/cluster/kubernetes/mock.go
index cf9097fe..7e0ee475 100644
--- a/cluster/kubernetes/mock.go
+++ b/pkg/cluster/kubernetes/mock.go
@@ -1,6 +1,6 @@
 package kubernetes
 
-import kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
+import kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
 
 type ConstNamespacer string
 
diff --git a/cluster/kubernetes/namespacer.go b/pkg/cluster/kubernetes/namespacer.go
similarity index 97%
rename from cluster/kubernetes/namespacer.go
rename to pkg/cluster/kubernetes/namespacer.go
index 2c68e14e..db2c3ecc 100644
--- a/cluster/kubernetes/namespacer.go
+++ b/pkg/cluster/kubernetes/namespacer.go
@@ -8,7 +8,7 @@ import (
 	"k8s.io/client-go/discovery"
 	"k8s.io/client-go/tools/clientcmd"
 
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
 )
 
 // The namespace to presume if something doesn't have one, and we
diff --git a/cluster/kubernetes/patch.go b/pkg/cluster/kubernetes/patch.go
similarity index 98%
rename from cluster/kubernetes/patch.go
rename to pkg/cluster/kubernetes/patch.go
index b9ae5c67..94f215dc 100644
--- a/cluster/kubernetes/patch.go
+++ b/pkg/cluster/kubernetes/patch.go
@@ -15,8 +15,8 @@ import (
 	"k8s.io/apimachinery/pkg/util/strategicpatch"
 	k8sscheme "k8s.io/client-go/kubernetes/scheme"
 
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
-	"github.com/fluxcd/flux/resource"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 func createManifestPatch(originalManifests, modifiedManifests []byte, originalSource, modifiedSource string) ([]byte, error) {
diff --git a/cluster/kubernetes/policies.go b/pkg/cluster/kubernetes/policies.go
similarity index 91%
rename from cluster/kubernetes/policies.go
rename to pkg/cluster/kubernetes/policies.go
index a7b2fb27..ed5db75a 100644
--- a/cluster/kubernetes/policies.go
+++ b/pkg/cluster/kubernetes/policies.go
@@ -3,8 +3,8 @@ package kubernetes
 import (
 	"fmt"
 
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
-	"github.com/fluxcd/flux/resource"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 func (m *manifests) UpdateWorkloadPolicies(def []byte, id resource.ID, update resource.PolicyUpdate) ([]byte, error) {
diff --git a/cluster/kubernetes/resource/cronjob.go b/pkg/cluster/kubernetes/resource/cronjob.go
similarity index 87%
rename from cluster/kubernetes/resource/cronjob.go
rename to pkg/cluster/kubernetes/resource/cronjob.go
index d9c23026..5e80bf3c 100644
--- a/cluster/kubernetes/resource/cronjob.go
+++ b/pkg/cluster/kubernetes/resource/cronjob.go
@@ -1,8 +1,8 @@
 package resource
 
 import (
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type CronJob struct {
diff --git a/cluster/kubernetes/resource/daemonset.go b/pkg/cluster/kubernetes/resource/daemonset.go
similarity index 83%
rename from cluster/kubernetes/resource/daemonset.go
rename to pkg/cluster/kubernetes/resource/daemonset.go
index 4e27b148..ba76a2e6 100644
--- a/cluster/kubernetes/resource/daemonset.go
+++ b/pkg/cluster/kubernetes/resource/daemonset.go
@@ -1,8 +1,8 @@
 package resource
 
 import (
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type DaemonSet struct {
diff --git a/cluster/kubernetes/resource/deployment.go b/pkg/cluster/kubernetes/resource/deployment.go
similarity index 85%
rename from cluster/kubernetes/resource/deployment.go
rename to pkg/cluster/kubernetes/resource/deployment.go
index 29cff33b..79f92a75 100644
--- a/cluster/kubernetes/resource/deployment.go
+++ b/pkg/cluster/kubernetes/resource/deployment.go
@@ -1,8 +1,8 @@
 package resource
 
 import (
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type Deployment struct {
diff --git a/cluster/kubernetes/resource/doc.go b/pkg/cluster/kubernetes/resource/doc.go
similarity index 100%
rename from cluster/kubernetes/resource/doc.go
rename to pkg/cluster/kubernetes/resource/doc.go
diff --git a/cluster/kubernetes/resource/helmrelease.go b/pkg/cluster/kubernetes/resource/helmrelease.go
similarity index 98%
rename from cluster/kubernetes/resource/helmrelease.go
rename to pkg/cluster/kubernetes/resource/helmrelease.go
index 403f1861..4da61104 100644
--- a/cluster/kubernetes/resource/helmrelease.go
+++ b/pkg/cluster/kubernetes/resource/helmrelease.go
@@ -6,8 +6,8 @@ import (
 	"sort"
 	"strings"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 const (
@@ -21,20 +21,20 @@ const (
 	//     image: some/image:version
 	//
 	// The name refers to the source of the image value.
-	ReleaseContainerName  = "chart-image"
+	ReleaseContainerName = "chart-image"
 
 	// ImageBasePath is the default base path for image path mappings
 	// in a HelmRelease resource.
 	ImageBasePath = "spec.values."
 	// ImageRegistryPrefix is the annotation key prefix for image
 	// registry path mappings.
-	ImageRegistryPrefix   = "registry.fluxcd.io/"
+	ImageRegistryPrefix = "registry.fluxcd.io/"
 	// ImageRepositoryPrefix is the annotation key prefix for image
 	// repository path mappings.
 	ImageRepositoryPrefix = "repository.fluxcd.io/"
 	// ImageRepositoryPrefix is the annotation key prefix for image
 	// tag path mappings.
-	ImageTagPrefix        = "tag.fluxcd.io/"
+	ImageTagPrefix = "tag.fluxcd.io/"
 )
 
 // ContainerImageMap holds the YAML dot notation paths to a
diff --git a/cluster/kubernetes/resource/namespace.go b/pkg/cluster/kubernetes/resource/namespace.go
similarity index 100%
rename from cluster/kubernetes/resource/namespace.go
rename to pkg/cluster/kubernetes/resource/namespace.go
diff --git a/cluster/kubernetes/resource/resource.go b/pkg/cluster/kubernetes/resource/resource.go
similarity index 98%
rename from cluster/kubernetes/resource/resource.go
rename to pkg/cluster/kubernetes/resource/resource.go
index d7659616..6c4b3ef9 100644
--- a/cluster/kubernetes/resource/resource.go
+++ b/pkg/cluster/kubernetes/resource/resource.go
@@ -6,9 +6,9 @@ import (
 	jsonyaml "github.com/ghodss/yaml"
 	"gopkg.in/yaml.v2"
 
-	fluxerr "github.com/fluxcd/flux/errors"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/resource"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 const (
diff --git a/cluster/kubernetes/resource/spec.go b/pkg/cluster/kubernetes/resource/spec.go
similarity index 96%
rename from cluster/kubernetes/resource/spec.go
rename to pkg/cluster/kubernetes/resource/spec.go
index 8a0f1477..b42713af 100644
--- a/cluster/kubernetes/resource/spec.go
+++ b/pkg/cluster/kubernetes/resource/spec.go
@@ -3,8 +3,8 @@ package resource
 import (
 	"fmt"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // Types that daemonsets, deployments, and other things have in
diff --git a/cluster/kubernetes/resource/statefulset.go b/pkg/cluster/kubernetes/resource/statefulset.go
similarity index 85%
rename from cluster/kubernetes/resource/statefulset.go
rename to pkg/cluster/kubernetes/resource/statefulset.go
index 2bba9111..79b01973 100644
--- a/cluster/kubernetes/resource/statefulset.go
+++ b/pkg/cluster/kubernetes/resource/statefulset.go
@@ -1,8 +1,8 @@
 package resource
 
 import (
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type StatefulSet struct {
diff --git a/cluster/kubernetes/resourcekinds.go b/pkg/cluster/kubernetes/resourcekinds.go
similarity index 98%
rename from cluster/kubernetes/resourcekinds.go
rename to pkg/cluster/kubernetes/resourcekinds.go
index fc1a455b..0509afcc 100644
--- a/cluster/kubernetes/resourcekinds.go
+++ b/pkg/cluster/kubernetes/resourcekinds.go
@@ -10,13 +10,13 @@ import (
 	apiv1 "k8s.io/api/core/v1"
 	meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
-	"github.com/fluxcd/flux/cluster"
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
-	"github.com/fluxcd/flux/image"
 	hr_v1beta1 "github.com/fluxcd/flux/integrations/apis/flux.weave.works/v1beta1"
 	fhr_v1alpha2 "github.com/fluxcd/flux/integrations/apis/helm.integrations.flux.weave.works/v1alpha2"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/cluster"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // AntecedentAnnotation is an annotation on a resource indicating that
diff --git a/cluster/kubernetes/sshkeyring.go b/pkg/cluster/kubernetes/sshkeyring.go
similarity index 99%
rename from cluster/kubernetes/sshkeyring.go
rename to pkg/cluster/kubernetes/sshkeyring.go
index 331118ac..9d30a8ce 100644
--- a/cluster/kubernetes/sshkeyring.go
+++ b/pkg/cluster/kubernetes/sshkeyring.go
@@ -11,7 +11,7 @@ import (
 	"k8s.io/apimachinery/pkg/types"
 	"k8s.io/client-go/kubernetes/typed/core/v1"
 
-	"github.com/fluxcd/flux/ssh"
+	"github.com/fluxcd/flux/pkg/ssh"
 )
 
 const (
diff --git a/cluster/kubernetes/sync.go b/pkg/cluster/kubernetes/sync.go
similarity index 98%
rename from cluster/kubernetes/sync.go
rename to pkg/cluster/kubernetes/sync.go
index f4333741..01790f13 100644
--- a/cluster/kubernetes/sync.go
+++ b/pkg/cluster/kubernetes/sync.go
@@ -25,10 +25,10 @@ import (
 	"k8s.io/client-go/discovery"
 	"k8s.io/client-go/rest"
 
-	"github.com/fluxcd/flux/cluster"
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/cluster"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 const (
diff --git a/cluster/kubernetes/testfiles/data_test.go b/pkg/cluster/kubernetes/testfiles/data_test.go
similarity index 100%
rename from cluster/kubernetes/testfiles/data_test.go
rename to pkg/cluster/kubernetes/testfiles/data_test.go
diff --git a/cluster/kubernetes/update.go b/pkg/cluster/kubernetes/update.go
similarity index 92%
rename from cluster/kubernetes/update.go
rename to pkg/cluster/kubernetes/update.go
index 54cd0131..78eeb6c0 100644
--- a/cluster/kubernetes/update.go
+++ b/pkg/cluster/kubernetes/update.go
@@ -4,9 +4,9 @@ import (
 	"fmt"
 	"strings"
 
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // updateWorkloadContainer takes a YAML document stream (one or more
diff --git a/cluster/mock/mock.go b/pkg/cluster/mock/mock.go
similarity index 94%
rename from cluster/mock/mock.go
rename to pkg/cluster/mock/mock.go
index d78c6e0c..7d2853ca 100644
--- a/cluster/mock/mock.go
+++ b/pkg/cluster/mock/mock.go
@@ -4,11 +4,11 @@ import (
 	"bytes"
 	"context"
 
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/manifests"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/ssh"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/manifests"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/ssh"
 )
 
 // Doubles as a cluster.Cluster and cluster.Manifests implementation
diff --git a/cluster/sync.go b/pkg/cluster/sync.go
similarity index 96%
rename from cluster/sync.go
rename to pkg/cluster/sync.go
index b82a0dc7..5045c86a 100644
--- a/cluster/sync.go
+++ b/pkg/cluster/sync.go
@@ -3,7 +3,7 @@ package cluster
 import (
 	"strings"
 
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // Definitions for use in synchronising a cluster with a git repo.
diff --git a/daemon/daemon.go b/pkg/daemon/daemon.go
similarity index 97%
rename from daemon/daemon.go
rename to pkg/daemon/daemon.go
index 9112e9a3..d05a8ca3 100644
--- a/daemon/daemon.go
+++ b/pkg/daemon/daemon.go
@@ -11,24 +11,24 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/api/v9"
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/event"
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/guid"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/manifests"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/registry"
-	"github.com/fluxcd/flux/release"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/sync"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/event"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/guid"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/manifests"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/registry"
+	"github.com/fluxcd/flux/pkg/release"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/sync"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 const (
diff --git a/daemon/errors.go b/pkg/daemon/errors.go
similarity index 94%
rename from daemon/errors.go
rename to pkg/daemon/errors.go
index 23461f76..4883555c 100644
--- a/daemon/errors.go
+++ b/pkg/daemon/errors.go
@@ -4,9 +4,9 @@ import (
 	"fmt"
 	"sync"
 
-	fluxerr "github.com/fluxcd/flux/errors"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/resource"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type SyncErrors struct {
diff --git a/daemon/images.go b/pkg/daemon/images.go
similarity index 96%
rename from daemon/images.go
rename to pkg/daemon/images.go
index dc564541..c2fd6e61 100644
--- a/daemon/images.go
+++ b/pkg/daemon/images.go
@@ -7,10 +7,10 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 func (d *Daemon) pollForNewAutomatedWorkloadImages(logger log.Logger) {
diff --git a/daemon/loop.go b/pkg/daemon/loop.go
similarity index 98%
rename from daemon/loop.go
rename to pkg/daemon/loop.go
index b25394fb..3a6dfe69 100644
--- a/daemon/loop.go
+++ b/pkg/daemon/loop.go
@@ -8,9 +8,9 @@ import (
 
 	"github.com/go-kit/kit/log"
 
-	"github.com/fluxcd/flux/git"
-	fluxmetrics "github.com/fluxcd/flux/metrics"
-	fluxsync "github.com/fluxcd/flux/sync"
+	"github.com/fluxcd/flux/pkg/git"
+	fluxmetrics "github.com/fluxcd/flux/pkg/metrics"
+	fluxsync "github.com/fluxcd/flux/pkg/sync"
 )
 
 type LoopVars struct {
diff --git a/daemon/metrics.go b/pkg/daemon/metrics.go
similarity index 97%
rename from daemon/metrics.go
rename to pkg/daemon/metrics.go
index dfe4f369..7cad9a16 100644
--- a/daemon/metrics.go
+++ b/pkg/daemon/metrics.go
@@ -4,7 +4,7 @@ import (
 	"github.com/go-kit/kit/metrics/prometheus"
 	stdprometheus "github.com/prometheus/client_golang/prometheus"
 
-	fluxmetrics "github.com/fluxcd/flux/metrics"
+	fluxmetrics "github.com/fluxcd/flux/pkg/metrics"
 )
 
 var (
diff --git a/daemon/note.go b/pkg/daemon/note.go
similarity index 69%
rename from daemon/note.go
rename to pkg/daemon/note.go
index f4e068e2..25ffe8c3 100644
--- a/daemon/note.go
+++ b/pkg/daemon/note.go
@@ -1,8 +1,8 @@
 package daemon
 
 import (
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type note struct {
diff --git a/daemon/sync.go b/pkg/daemon/sync.go
similarity index 97%
rename from daemon/sync.go
rename to pkg/daemon/sync.go
index 43dc656e..0c7877bd 100644
--- a/daemon/sync.go
+++ b/pkg/daemon/sync.go
@@ -9,13 +9,13 @@ import (
 	"path/filepath"
 	"time"
 
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/event"
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/manifests"
-	"github.com/fluxcd/flux/resource"
-	fluxsync "github.com/fluxcd/flux/sync"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/event"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/manifests"
+	"github.com/fluxcd/flux/pkg/resource"
+	fluxsync "github.com/fluxcd/flux/pkg/sync"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 // revisionRatchet is for keeping track of transitions between
diff --git a/errors/errors.go b/pkg/errors/errors.go
similarity index 100%
rename from errors/errors.go
rename to pkg/errors/errors.go
diff --git a/errors/errors_test.go b/pkg/errors/errors_test.go
similarity index 100%
rename from errors/errors_test.go
rename to pkg/errors/errors_test.go
diff --git a/event/event.go b/pkg/event/event.go
similarity index 99%
rename from event/event.go
rename to pkg/event/event.go
index 7fe61c41..8866b4a4 100644
--- a/event/event.go
+++ b/pkg/event/event.go
@@ -7,9 +7,9 @@ import (
 	"strings"
 	"time"
 
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 	"github.com/pkg/errors"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
 )
 
 // These are all the types of events.
diff --git a/git/errors.go b/pkg/git/errors.go
similarity index 98%
rename from git/errors.go
rename to pkg/git/errors.go
index 96bca1ef..4feb1611 100644
--- a/git/errors.go
+++ b/pkg/git/errors.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"strings"
 
-	fluxerr "github.com/fluxcd/flux/errors"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
 )
 
 var NoRepoError = &fluxerr.Error{
diff --git a/guid/guid.go b/pkg/guid/guid.go
similarity index 100%
rename from guid/guid.go
rename to pkg/guid/guid.go
diff --git a/http/accept.go b/pkg/http/accept.go
similarity index 100%
rename from http/accept.go
rename to pkg/http/accept.go
diff --git a/http/accept_test.go b/pkg/http/accept_test.go
similarity index 100%
rename from http/accept_test.go
rename to pkg/http/accept_test.go
diff --git a/http/client/client.go b/pkg/http/client/client.go
similarity index 95%
rename from http/client/client.go
rename to pkg/http/client/client.go
index a676fab7..32be770d 100644
--- a/http/client/client.go
+++ b/pkg/http/client/client.go
@@ -12,16 +12,16 @@ import (
 	"github.com/gorilla/mux"
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/api/v9"
-	fluxerr "github.com/fluxcd/flux/errors"
-	"github.com/fluxcd/flux/event"
-	transport "github.com/fluxcd/flux/http"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
+	"github.com/fluxcd/flux/pkg/event"
+	transport "github.com/fluxcd/flux/pkg/http"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 var (
diff --git a/http/daemon/server.go b/pkg/http/daemon/server.go
similarity index 96%
rename from http/daemon/server.go
rename to pkg/http/daemon/server.go
index fbe3ed30..451e9814 100644
--- a/http/daemon/server.go
+++ b/pkg/http/daemon/server.go
@@ -9,16 +9,16 @@ import (
 	"github.com/pkg/errors"
 	stdprometheus "github.com/prometheus/client_golang/prometheus"
 
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	transport "github.com/fluxcd/flux/pkg/http"
+	"github.com/fluxcd/flux/pkg/job"
+	fluxmetrics "github.com/fluxcd/flux/pkg/metrics"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 	"github.com/weaveworks/common/middleware"
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v9"
-	transport "github.com/fluxcd/flux/http"
-	"github.com/fluxcd/flux/job"
-	fluxmetrics "github.com/fluxcd/flux/metrics"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
 )
 
 var (
diff --git a/http/daemon/upstream.go b/pkg/http/daemon/upstream.go
similarity index 94%
rename from http/daemon/upstream.go
rename to pkg/http/daemon/upstream.go
index 2f5e9e03..d2e76c5d 100644
--- a/http/daemon/upstream.go
+++ b/pkg/http/daemon/upstream.go
@@ -16,12 +16,12 @@ import (
 	"github.com/pkg/errors"
 	stdprometheus "github.com/prometheus/client_golang/prometheus"
 
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/event"
-	transport "github.com/fluxcd/flux/http"
-	fluxclient "github.com/fluxcd/flux/http/client"
-	"github.com/fluxcd/flux/http/websocket"
-	"github.com/fluxcd/flux/remote/rpc"
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/event"
+	transport "github.com/fluxcd/flux/pkg/http"
+	fluxclient "github.com/fluxcd/flux/pkg/http/client"
+	"github.com/fluxcd/flux/pkg/http/websocket"
+	"github.com/fluxcd/flux/pkg/remote/rpc"
 )
 
 // Upstream handles communication from the daemon to a service
diff --git a/http/daemon/upstream_test.go b/pkg/http/daemon/upstream_test.go
similarity index 100%
rename from http/daemon/upstream_test.go
rename to pkg/http/daemon/upstream_test.go
diff --git a/http/errors.go b/pkg/http/errors.go
similarity index 96%
rename from http/errors.go
rename to pkg/http/errors.go
index c5e90ecb..ef445b76 100644
--- a/http/errors.go
+++ b/pkg/http/errors.go
@@ -3,7 +3,7 @@ package http
 import (
 	"errors"
 
-	fluxerr "github.com/fluxcd/flux/errors"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
 )
 
 var ErrorDeprecated = &fluxerr.Error{
diff --git a/http/httperror/api_error.go b/pkg/http/httperror/api_error.go
similarity index 100%
rename from http/httperror/api_error.go
rename to pkg/http/httperror/api_error.go
diff --git a/http/routes.go b/pkg/http/routes.go
similarity index 100%
rename from http/routes.go
rename to pkg/http/routes.go
diff --git a/http/transport.go b/pkg/http/transport.go
similarity index 99%
rename from http/transport.go
rename to pkg/http/transport.go
index d6805b02..58338f7a 100644
--- a/http/transport.go
+++ b/pkg/http/transport.go
@@ -10,7 +10,7 @@ import (
 	"github.com/gorilla/mux"
 	"github.com/pkg/errors"
 
-	fluxerr "github.com/fluxcd/flux/errors"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
 )
 
 func DeprecateVersions(r *mux.Router, versions ...string) {
diff --git a/http/validate.go b/pkg/http/validate.go
similarity index 100%
rename from http/validate.go
rename to pkg/http/validate.go
diff --git a/http/websocket/client.go b/pkg/http/websocket/client.go
similarity index 97%
rename from http/websocket/client.go
rename to pkg/http/websocket/client.go
index 7905aae9..0a07165b 100644
--- a/http/websocket/client.go
+++ b/pkg/http/websocket/client.go
@@ -9,7 +9,7 @@ import (
 	"github.com/gorilla/websocket"
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/http/client"
+	"github.com/fluxcd/flux/pkg/http/client"
 )
 
 type DialErr struct {
diff --git a/image/image.go b/pkg/image/image.go
similarity index 100%
rename from image/image.go
rename to pkg/image/image.go
diff --git a/image/image_test.go b/pkg/image/image_test.go
similarity index 100%
rename from image/image_test.go
rename to pkg/image/image_test.go
diff --git a/install/generate.go b/pkg/install/generate.go
similarity index 96%
rename from install/generate.go
rename to pkg/install/generate.go
index 680162ff..e77da276 100644
--- a/install/generate.go
+++ b/pkg/install/generate.go
@@ -11,7 +11,7 @@ import (
 
 	"github.com/shurcooL/vfsgen"
 
-	"github.com/fluxcd/flux/install"
+	"github.com/fluxcd/flux/pkg/install"
 )
 
 func main() {
diff --git a/install/generated_templates.gogen.go b/pkg/install/generated_templates.gogen.go
similarity index 100%
rename from install/generated_templates.gogen.go
rename to pkg/install/generated_templates.gogen.go
diff --git a/install/install.go b/pkg/install/install.go
similarity index 100%
rename from install/install.go
rename to pkg/install/install.go
diff --git a/install/install_test.go b/pkg/install/install_test.go
similarity index 100%
rename from install/install_test.go
rename to pkg/install/install_test.go
diff --git a/install/templates/flux-account.yaml.tmpl b/pkg/install/templates/flux-account.yaml.tmpl
similarity index 100%
rename from install/templates/flux-account.yaml.tmpl
rename to pkg/install/templates/flux-account.yaml.tmpl
diff --git a/install/templates/flux-deployment.yaml.tmpl b/pkg/install/templates/flux-deployment.yaml.tmpl
similarity index 100%
rename from install/templates/flux-deployment.yaml.tmpl
rename to pkg/install/templates/flux-deployment.yaml.tmpl
diff --git a/install/templates/flux-secret.yaml.tmpl b/pkg/install/templates/flux-secret.yaml.tmpl
similarity index 100%
rename from install/templates/flux-secret.yaml.tmpl
rename to pkg/install/templates/flux-secret.yaml.tmpl
diff --git a/install/templates/memcache-dep.yaml.tmpl b/pkg/install/templates/memcache-dep.yaml.tmpl
similarity index 100%
rename from install/templates/memcache-dep.yaml.tmpl
rename to pkg/install/templates/memcache-dep.yaml.tmpl
diff --git a/install/templates/memcache-svc.yaml.tmpl b/pkg/install/templates/memcache-svc.yaml.tmpl
similarity index 100%
rename from install/templates/memcache-svc.yaml.tmpl
rename to pkg/install/templates/memcache-svc.yaml.tmpl
diff --git a/job/job.go b/pkg/job/job.go
similarity index 99%
rename from job/job.go
rename to pkg/job/job.go
index a59be284..10fe838e 100644
--- a/job/job.go
+++ b/pkg/job/job.go
@@ -5,7 +5,7 @@ import (
 
 	"github.com/go-kit/kit/log"
 
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type ID string
diff --git a/job/job_test.go b/pkg/job/job_test.go
similarity index 100%
rename from job/job_test.go
rename to pkg/job/job_test.go
diff --git a/job/status_cache.go b/pkg/job/status_cache.go
similarity index 100%
rename from job/status_cache.go
rename to pkg/job/status_cache.go
diff --git a/manifests/configaware.go b/pkg/manifests/configaware.go
similarity index 99%
rename from manifests/configaware.go
rename to pkg/manifests/configaware.go
index 4c61f405..814ce7e1 100644
--- a/manifests/configaware.go
+++ b/pkg/manifests/configaware.go
@@ -11,8 +11,8 @@ import (
 	"strings"
 	"sync"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type resourceWithOrigin struct {
diff --git a/manifests/configfile.go b/pkg/manifests/configfile.go
similarity index 99%
rename from manifests/configfile.go
rename to pkg/manifests/configfile.go
index 87c17df9..a9ff84f2 100644
--- a/manifests/configfile.go
+++ b/pkg/manifests/configfile.go
@@ -13,7 +13,7 @@ import (
 	"github.com/pkg/errors"
 	"gopkg.in/yaml.v2"
 
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 const (
diff --git a/manifests/manifests.go b/pkg/manifests/manifests.go
similarity index 96%
rename from manifests/manifests.go
rename to pkg/manifests/manifests.go
index e775f829..814ae7a0 100644
--- a/manifests/manifests.go
+++ b/pkg/manifests/manifests.go
@@ -3,8 +3,8 @@ package manifests
 import (
 	"bytes"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // Manifests represents a format for files or chunks of bytes
diff --git a/manifests/rawfiles.go b/pkg/manifests/rawfiles.go
similarity index 97%
rename from manifests/rawfiles.go
rename to pkg/manifests/rawfiles.go
index 310f510b..9945ba73 100644
--- a/manifests/rawfiles.go
+++ b/pkg/manifests/rawfiles.go
@@ -7,8 +7,8 @@ import (
 	"os"
 	"path/filepath"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type rawFiles struct {
diff --git a/manifests/store.go b/pkg/manifests/store.go
similarity index 93%
rename from manifests/store.go
rename to pkg/manifests/store.go
index 6ac37e2c..090f86bd 100644
--- a/manifests/store.go
+++ b/pkg/manifests/store.go
@@ -4,8 +4,8 @@ import (
 	"context"
 	"fmt"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type StoreError struct {
diff --git a/metrics/metrics.go b/pkg/metrics/metrics.go
similarity index 100%
rename from metrics/metrics.go
rename to pkg/metrics/metrics.go
diff --git a/policy/pattern.go b/pkg/policy/pattern.go
similarity index 98%
rename from policy/pattern.go
rename to pkg/policy/pattern.go
index c5a638c4..888bad6a 100644
--- a/policy/pattern.go
+++ b/pkg/policy/pattern.go
@@ -5,8 +5,8 @@ import (
 	"strings"
 
 	"github.com/Masterminds/semver"
+	"github.com/fluxcd/flux/pkg/image"
 	"github.com/ryanuber/go-glob"
-	"github.com/fluxcd/flux/image"
 )
 
 const (
diff --git a/policy/pattern_test.go b/pkg/policy/pattern_test.go
similarity index 100%
rename from policy/pattern_test.go
rename to pkg/policy/pattern_test.go
diff --git a/policy/policy.go b/pkg/policy/policy.go
similarity index 100%
rename from policy/policy.go
rename to pkg/policy/policy.go
diff --git a/policy/policy_test.go b/pkg/policy/policy_test.go
similarity index 100%
rename from policy/policy_test.go
rename to pkg/policy/policy_test.go
diff --git a/registry/aws.go b/pkg/registry/aws.go
similarity index 100%
rename from registry/aws.go
rename to pkg/registry/aws.go
diff --git a/registry/azure.go b/pkg/registry/azure.go
similarity index 100%
rename from registry/azure.go
rename to pkg/registry/azure.go
diff --git a/registry/azure_test.go b/pkg/registry/azure_test.go
similarity index 100%
rename from registry/azure_test.go
rename to pkg/registry/azure_test.go
diff --git a/registry/cache/cache.go b/pkg/registry/cache/cache.go
similarity index 97%
rename from registry/cache/cache.go
rename to pkg/registry/cache/cache.go
index 331191e9..64326ed1 100644
--- a/registry/cache/cache.go
+++ b/pkg/registry/cache/cache.go
@@ -4,7 +4,7 @@ import (
 	"strings"
 	"time"
 
-	"github.com/fluxcd/flux/image"
+	"github.com/fluxcd/flux/pkg/image"
 )
 
 type Reader interface {
diff --git a/registry/cache/memcached/memcached.go b/pkg/registry/cache/memcached/memcached.go
similarity index 99%
rename from registry/cache/memcached/memcached.go
rename to pkg/registry/cache/memcached/memcached.go
index 7ff5235e..001bbf33 100644
--- a/registry/cache/memcached/memcached.go
+++ b/pkg/registry/cache/memcached/memcached.go
@@ -23,7 +23,7 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/registry/cache"
+	"github.com/fluxcd/flux/pkg/registry/cache"
 )
 
 const (
diff --git a/registry/cache/memcached/memcached_test.go b/pkg/registry/cache/memcached/memcached_test.go
similarity index 100%
rename from registry/cache/memcached/memcached_test.go
rename to pkg/registry/cache/memcached/memcached_test.go
diff --git a/registry/cache/monitoring.go b/pkg/registry/cache/monitoring.go
similarity index 96%
rename from registry/cache/monitoring.go
rename to pkg/registry/cache/monitoring.go
index f57973ef..bc75171f 100644
--- a/registry/cache/monitoring.go
+++ b/pkg/registry/cache/monitoring.go
@@ -7,7 +7,7 @@ import (
 	"github.com/go-kit/kit/metrics/prometheus"
 	stdprometheus "github.com/prometheus/client_golang/prometheus"
 
-	fluxmetrics "github.com/fluxcd/flux/metrics"
+	fluxmetrics "github.com/fluxcd/flux/pkg/metrics"
 )
 
 var (
diff --git a/registry/cache/registry.go b/pkg/registry/cache/registry.go
similarity index 97%
rename from registry/cache/registry.go
rename to pkg/registry/cache/registry.go
index 3a6c9edc..850f8d8e 100644
--- a/registry/cache/registry.go
+++ b/pkg/registry/cache/registry.go
@@ -7,9 +7,9 @@ import (
 	"github.com/pkg/errors"
 	"github.com/ryanuber/go-glob"
 
-	fluxerr "github.com/fluxcd/flux/errors"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/registry"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/registry"
 )
 
 var (
diff --git a/registry/cache/repocachemanager.go b/pkg/registry/cache/repocachemanager.go
similarity index 99%
rename from registry/cache/repocachemanager.go
rename to pkg/registry/cache/repocachemanager.go
index 526339f0..948479e2 100644
--- a/registry/cache/repocachemanager.go
+++ b/pkg/registry/cache/repocachemanager.go
@@ -12,8 +12,8 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/registry"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/registry"
 )
 
 type imageToUpdate struct {
diff --git a/registry/cache/warming.go b/pkg/registry/cache/warming.go
similarity index 99%
rename from registry/cache/warming.go
rename to pkg/registry/cache/warming.go
index 1e2666fc..41846911 100644
--- a/registry/cache/warming.go
+++ b/pkg/registry/cache/warming.go
@@ -9,8 +9,8 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/registry"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/registry"
 )
 
 const askForNewImagesInterval = time.Minute
diff --git a/registry/client.go b/pkg/registry/client.go
similarity index 99%
rename from registry/client.go
rename to pkg/registry/client.go
index 9e256a36..44f80d57 100644
--- a/registry/client.go
+++ b/pkg/registry/client.go
@@ -15,7 +15,7 @@ import (
 	"github.com/docker/distribution/registry/client"
 	"github.com/opencontainers/go-digest"
 
-	"github.com/fluxcd/flux/image"
+	"github.com/fluxcd/flux/pkg/image"
 )
 
 type Excluded struct {
diff --git a/registry/client_factory.go b/pkg/registry/client_factory.go
similarity index 98%
rename from registry/client_factory.go
rename to pkg/registry/client_factory.go
index 12a131e3..2935a7f3 100644
--- a/registry/client_factory.go
+++ b/pkg/registry/client_factory.go
@@ -14,8 +14,8 @@ import (
 	"github.com/docker/distribution/registry/client/transport"
 	"github.com/go-kit/kit/log"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/registry/middleware"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/registry/middleware"
 )
 
 type RemoteClientFactory struct {
diff --git a/registry/middleware/rate_limiter.go b/pkg/registry/middleware/rate_limiter.go
similarity index 100%
rename from registry/middleware/rate_limiter.go
rename to pkg/registry/middleware/rate_limiter.go
diff --git a/registry/mock/mock.go b/pkg/registry/mock/mock.go
similarity index 95%
rename from registry/mock/mock.go
rename to pkg/registry/mock/mock.go
index 48fb7cb5..94b014ee 100644
--- a/registry/mock/mock.go
+++ b/pkg/registry/mock/mock.go
@@ -5,8 +5,8 @@ import (
 
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/registry"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/registry"
 )
 
 type Client struct {
diff --git a/registry/monitoring.go b/pkg/registry/monitoring.go
similarity index 96%
rename from registry/monitoring.go
rename to pkg/registry/monitoring.go
index bdca062c..5f31b18d 100644
--- a/registry/monitoring.go
+++ b/pkg/registry/monitoring.go
@@ -10,8 +10,8 @@ import (
 	"github.com/go-kit/kit/metrics/prometheus"
 	stdprometheus "github.com/prometheus/client_golang/prometheus"
 
-	"github.com/fluxcd/flux/image"
-	fluxmetrics "github.com/fluxcd/flux/metrics"
+	"github.com/fluxcd/flux/pkg/image"
+	fluxmetrics "github.com/fluxcd/flux/pkg/metrics"
 )
 
 const (
diff --git a/registry/registry.go b/pkg/registry/registry.go
similarity index 92%
rename from registry/registry.go
rename to pkg/registry/registry.go
index 100cbab9..4bec69e5 100644
--- a/registry/registry.go
+++ b/pkg/registry/registry.go
@@ -3,7 +3,7 @@ package registry
 import (
 	"errors"
 
-	"github.com/fluxcd/flux/image"
+	"github.com/fluxcd/flux/pkg/image"
 )
 
 var (
diff --git a/release/context.go b/pkg/release/context.go
similarity index 95%
rename from release/context.go
rename to pkg/release/context.go
index 1dfff5c0..38a37b6e 100644
--- a/release/context.go
+++ b/pkg/release/context.go
@@ -6,11 +6,11 @@ import (
 
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/manifests"
-	"github.com/fluxcd/flux/registry"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/manifests"
+	"github.com/fluxcd/flux/pkg/registry"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type ReleaseContext struct {
diff --git a/release/errors.go b/pkg/release/errors.go
similarity index 93%
rename from release/errors.go
rename to pkg/release/errors.go
index d453d26e..28b36d62 100644
--- a/release/errors.go
+++ b/pkg/release/errors.go
@@ -1,7 +1,7 @@
 package release
 
 import (
-	fluxerr "github.com/fluxcd/flux/errors"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
 )
 
 func MakeReleaseError(err error) *fluxerr.Error {
diff --git a/release/releaser.go b/pkg/release/releaser.go
similarity index 98%
rename from release/releaser.go
rename to pkg/release/releaser.go
index 02b94fbb..d2691b87 100644
--- a/release/releaser.go
+++ b/pkg/release/releaser.go
@@ -9,8 +9,8 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type Changes interface {
diff --git a/remote/doc.go b/pkg/remote/doc.go
similarity index 100%
rename from remote/doc.go
rename to pkg/remote/doc.go
diff --git a/remote/errors.go b/pkg/remote/errors.go
similarity index 98%
rename from remote/errors.go
rename to pkg/remote/errors.go
index 76c40049..851f3e5d 100644
--- a/remote/errors.go
+++ b/pkg/remote/errors.go
@@ -1,7 +1,7 @@
 package remote
 
 import (
-	fluxerr "github.com/fluxcd/flux/errors"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
 )
 
 func UnavailableError(err error) error {
diff --git a/remote/logging.go b/pkg/remote/logging.go
similarity index 92%
rename from remote/logging.go
rename to pkg/remote/logging.go
index 2e208d1c..0c657837 100644
--- a/remote/logging.go
+++ b/pkg/remote/logging.go
@@ -5,13 +5,13 @@ import (
 
 	"github.com/go-kit/kit/log"
 
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/api/v9"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 var _ api.Server = &ErrorLoggingServer{}
diff --git a/remote/metrics.go b/pkg/remote/metrics.go
similarity index 94%
rename from remote/metrics.go
rename to pkg/remote/metrics.go
index 7d14cd3a..5fe0cb2a 100644
--- a/remote/metrics.go
+++ b/pkg/remote/metrics.go
@@ -8,14 +8,14 @@ import (
 	"github.com/go-kit/kit/metrics/prometheus"
 	stdprometheus "github.com/prometheus/client_golang/prometheus"
 
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/api/v9"
-	"github.com/fluxcd/flux/job"
-	fluxmetrics "github.com/fluxcd/flux/metrics"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	"github.com/fluxcd/flux/pkg/job"
+	fluxmetrics "github.com/fluxcd/flux/pkg/metrics"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 var (
diff --git a/remote/mock.go b/pkg/remote/mock.go
similarity index 94%
rename from remote/mock.go
rename to pkg/remote/mock.go
index 83506c93..61ebd396 100644
--- a/remote/mock.go
+++ b/pkg/remote/mock.go
@@ -8,16 +8,16 @@ import (
 	"testing"
 	"time"
 
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/api/v9"
-	"github.com/fluxcd/flux/guid"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	"github.com/fluxcd/flux/pkg/guid"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type MockServer struct {
diff --git a/remote/rpc/baseclient.go b/pkg/remote/rpc/baseclient.go
similarity index 88%
rename from remote/rpc/baseclient.go
rename to pkg/remote/rpc/baseclient.go
index 4b48d47c..02dc3ae2 100644
--- a/remote/rpc/baseclient.go
+++ b/pkg/remote/rpc/baseclient.go
@@ -5,14 +5,14 @@ import (
 
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/api/v9"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/remote"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/remote"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type baseClient struct{}
diff --git a/remote/rpc/clientV10.go b/pkg/remote/rpc/clientV10.go
similarity index 91%
rename from remote/rpc/clientV10.go
rename to pkg/remote/rpc/clientV10.go
index d4a57694..35b062a7 100644
--- a/remote/rpc/clientV10.go
+++ b/pkg/remote/rpc/clientV10.go
@@ -5,9 +5,9 @@ import (
 	"io"
 	"net/rpc"
 
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/remote"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/remote"
 )
 
 // RPCClientV10 is the rpc-backed implementation of a server, for
diff --git a/remote/rpc/clientV11.go b/pkg/remote/rpc/clientV11.go
similarity index 91%
rename from remote/rpc/clientV11.go
rename to pkg/remote/rpc/clientV11.go
index 15da88ff..c1c4f34d 100644
--- a/remote/rpc/clientV11.go
+++ b/pkg/remote/rpc/clientV11.go
@@ -5,9 +5,9 @@ import (
 	"io"
 	"net/rpc"
 
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/remote"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/remote"
 )
 
 // RPCClientV11 is the rpc-backed implementation of a server, for
diff --git a/remote/rpc/clientV6.go b/pkg/remote/rpc/clientV6.go
similarity index 95%
rename from remote/rpc/clientV6.go
rename to pkg/remote/rpc/clientV6.go
index 4f75e3fe..80b9b518 100644
--- a/remote/rpc/clientV6.go
+++ b/pkg/remote/rpc/clientV6.go
@@ -6,13 +6,13 @@ import (
 	"net/rpc"
 	"net/rpc/jsonrpc"
 
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	fluxerr "github.com/fluxcd/flux/errors"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/remote"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/remote"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 // RPCClient is the rpc-backed implementation of a server, for
diff --git a/remote/rpc/clientV7.go b/pkg/remote/rpc/clientV7.go
similarity index 94%
rename from remote/rpc/clientV7.go
rename to pkg/remote/rpc/clientV7.go
index 3cf51303..264a0165 100644
--- a/remote/rpc/clientV7.go
+++ b/pkg/remote/rpc/clientV7.go
@@ -5,13 +5,13 @@ import (
 	"io"
 	"net/rpc"
 
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	fluxerr "github.com/fluxcd/flux/errors"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/remote"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/remote"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 // RPCClient is the rpc-backed implementation of a server, for
diff --git a/remote/rpc/clientV8.go b/pkg/remote/rpc/clientV8.go
similarity index 90%
rename from remote/rpc/clientV8.go
rename to pkg/remote/rpc/clientV8.go
index 1b601f11..3db8a38e 100644
--- a/remote/rpc/clientV8.go
+++ b/pkg/remote/rpc/clientV8.go
@@ -5,12 +5,12 @@ import (
 	"io"
 	"net/rpc"
 
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/remote"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/remote"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 // RPCClient is the rpc-backed implementation of a server, for
diff --git a/remote/rpc/clientV9.go b/pkg/remote/rpc/clientV9.go
similarity index 89%
rename from remote/rpc/clientV9.go
rename to pkg/remote/rpc/clientV9.go
index 6e1d2224..1f3c0371 100644
--- a/remote/rpc/clientV9.go
+++ b/pkg/remote/rpc/clientV9.go
@@ -5,8 +5,8 @@ import (
 	"io"
 	"net/rpc"
 
-	"github.com/fluxcd/flux/api/v9"
-	"github.com/fluxcd/flux/remote"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	"github.com/fluxcd/flux/pkg/remote"
 )
 
 type RPCClientV9 struct {
diff --git a/remote/rpc/compat.go b/pkg/remote/rpc/compat.go
similarity index 94%
rename from remote/rpc/compat.go
rename to pkg/remote/rpc/compat.go
index 18bdaae3..561c705a 100644
--- a/remote/rpc/compat.go
+++ b/pkg/remote/rpc/compat.go
@@ -5,15 +5,15 @@ import (
 	"errors"
 	"fmt"
 
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/remote"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/remote"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 func requireServiceSpecKinds(ss update.ResourceSpec, kinds []string) error {
diff --git a/remote/rpc/server.go b/pkg/remote/rpc/server.go
similarity index 95%
rename from remote/rpc/server.go
rename to pkg/remote/rpc/server.go
index 1f3bafd6..7f38250f 100644
--- a/remote/rpc/server.go
+++ b/pkg/remote/rpc/server.go
@@ -7,16 +7,16 @@ import (
 	"net/rpc/jsonrpc"
 	"time"
 
-	"github.com/fluxcd/flux/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v10"
 
 	"github.com/pkg/errors"
 
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/api/v9"
-	fluxerr "github.com/fluxcd/flux/errors"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 // Server takes an api.Server and makes it available over RPC.
diff --git a/resource/id.go b/pkg/resource/id.go
similarity index 100%
rename from resource/id.go
rename to pkg/resource/id.go
diff --git a/resource/id_test.go b/pkg/resource/id_test.go
similarity index 100%
rename from resource/id_test.go
rename to pkg/resource/id_test.go
diff --git a/resource/policy.go b/pkg/resource/policy.go
similarity index 97%
rename from resource/policy.go
rename to pkg/resource/policy.go
index 0427f0d8..7bb1a13d 100644
--- a/resource/policy.go
+++ b/pkg/resource/policy.go
@@ -3,7 +3,7 @@ package resource
 import (
 	"fmt"
 
-	"github.com/fluxcd/flux/policy"
+	"github.com/fluxcd/flux/pkg/policy"
 )
 
 // ChangeForPolicyUpdate evaluates a policy update with respect to a
@@ -52,4 +52,3 @@ type PolicyUpdate struct {
 	Add    policy.Set `json:"add"`
 	Remove policy.Set `json:"remove"`
 }
-
diff --git a/resource/resource.go b/pkg/resource/resource.go
similarity index 91%
rename from resource/resource.go
rename to pkg/resource/resource.go
index 5b41f04a..74c8955d 100644
--- a/resource/resource.go
+++ b/pkg/resource/resource.go
@@ -1,8 +1,8 @@
 package resource
 
 import (
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/policy"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
 )
 
 // For the minute we just care about
diff --git a/ssh/keygen.go b/pkg/ssh/keygen.go
similarity index 100%
rename from ssh/keygen.go
rename to pkg/ssh/keygen.go
diff --git a/ssh/keyring.go b/pkg/ssh/keyring.go
similarity index 100%
rename from ssh/keyring.go
rename to pkg/ssh/keyring.go
diff --git a/sync/git.go b/pkg/sync/git.go
similarity index 98%
rename from sync/git.go
rename to pkg/sync/git.go
index e2821f56..d50babe9 100644
--- a/sync/git.go
+++ b/pkg/sync/git.go
@@ -4,7 +4,7 @@ import (
 	"context"
 	"strings"
 
-	"github.com/fluxcd/flux/git"
+	"github.com/fluxcd/flux/pkg/git"
 )
 
 // GitTagSyncProvider is the mechanism by which a Git tag is used to keep track of the current point fluxd has synced to.
diff --git a/sync/mock.go b/pkg/sync/mock.go
similarity index 92%
rename from sync/mock.go
rename to pkg/sync/mock.go
index 5efc4aa4..5711d7e2 100644
--- a/sync/mock.go
+++ b/pkg/sync/mock.go
@@ -1,8 +1,8 @@
 package sync
 
 import (
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type rsc struct {
diff --git a/sync/provider.go b/pkg/sync/provider.go
similarity index 100%
rename from sync/provider.go
rename to pkg/sync/provider.go
diff --git a/sync/secret.go b/pkg/sync/secret.go
similarity index 100%
rename from sync/secret.go
rename to pkg/sync/secret.go
diff --git a/sync/sync.go b/pkg/sync/sync.go
similarity index 89%
rename from sync/sync.go
rename to pkg/sync/sync.go
index 30328607..6a9f98fc 100644
--- a/sync/sync.go
+++ b/pkg/sync/sync.go
@@ -1,8 +1,8 @@
 package sync
 
 import (
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // Syncer has the methods we need to be able to compile and run a sync
diff --git a/update/automated.go b/pkg/update/automated.go
similarity index 98%
rename from update/automated.go
rename to pkg/update/automated.go
index 36a93baa..e7e2ae96 100644
--- a/update/automated.go
+++ b/pkg/update/automated.go
@@ -7,8 +7,8 @@ import (
 
 	"github.com/go-kit/kit/log"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type Automated struct {
diff --git a/update/filter.go b/pkg/update/filter.go
similarity index 95%
rename from update/filter.go
rename to pkg/update/filter.go
index d065691d..23ccd402 100644
--- a/update/filter.go
+++ b/pkg/update/filter.go
@@ -1,9 +1,9 @@
 package update
 
 import (
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 const (
diff --git a/update/images.go b/pkg/update/images.go
similarity index 96%
rename from update/images.go
rename to pkg/update/images.go
index 77b3e742..523587d1 100644
--- a/update/images.go
+++ b/pkg/update/images.go
@@ -7,11 +7,11 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/pkg/errors"
 
-	fluxerr "github.com/fluxcd/flux/errors"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/registry"
-	"github.com/fluxcd/flux/resource"
+	fluxerr "github.com/fluxcd/flux/pkg/errors"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/registry"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type imageReposMap map[image.CanonicalName]image.RepositoryMetadata
diff --git a/update/menu.go b/pkg/update/menu.go
similarity index 99%
rename from update/menu.go
rename to pkg/update/menu.go
index 92807da4..d05e0ba8 100644
--- a/update/menu.go
+++ b/pkg/update/menu.go
@@ -7,7 +7,7 @@ import (
 	"io"
 	"text/tabwriter"
 
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 const (
diff --git a/update/menu_unix.go b/pkg/update/menu_unix.go
similarity index 100%
rename from update/menu_unix.go
rename to pkg/update/menu_unix.go
diff --git a/update/menu_win.go b/pkg/update/menu_win.go
similarity index 100%
rename from update/menu_win.go
rename to pkg/update/menu_win.go
diff --git a/update/metrics.go b/pkg/update/metrics.go
similarity index 96%
rename from update/metrics.go
rename to pkg/update/metrics.go
index 85c82629..3f8882e8 100644
--- a/update/metrics.go
+++ b/pkg/update/metrics.go
@@ -4,10 +4,10 @@ import (
 	"fmt"
 	"time"
 
+	fluxmetrics "github.com/fluxcd/flux/pkg/metrics"
 	"github.com/go-kit/kit/metrics"
 	"github.com/go-kit/kit/metrics/prometheus"
 	stdprometheus "github.com/prometheus/client_golang/prometheus"
-	fluxmetrics "github.com/fluxcd/flux/metrics"
 )
 
 var (
diff --git a/update/release_containers.go b/pkg/update/release_containers.go
similarity index 98%
rename from update/release_containers.go
rename to pkg/update/release_containers.go
index e77ceedd..48bf0079 100644
--- a/update/release_containers.go
+++ b/pkg/update/release_containers.go
@@ -9,8 +9,8 @@ import (
 
 	"github.com/go-kit/kit/log"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 var zeroImageRef = image.Ref{}
diff --git a/update/release_image.go b/pkg/update/release_image.go
similarity index 98%
rename from update/release_image.go
rename to pkg/update/release_image.go
index 08c32c9d..bb4f50c9 100644
--- a/update/release_image.go
+++ b/pkg/update/release_image.go
@@ -7,11 +7,11 @@ import (
 
 	"github.com/pkg/errors"
 
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/registry"
+	"github.com/fluxcd/flux/pkg/resource"
 	"github.com/go-kit/kit/log"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/registry"
-	"github.com/fluxcd/flux/resource"
 )
 
 const (
diff --git a/update/result.go b/pkg/update/result.go
similarity index 96%
rename from update/result.go
rename to pkg/update/result.go
index 48305ff8..2a8912cd 100644
--- a/update/result.go
+++ b/pkg/update/result.go
@@ -5,8 +5,8 @@ import (
 	"sort"
 	"strings"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type WorkloadUpdateStatus string
diff --git a/update/spec.go b/pkg/update/spec.go
similarity index 97%
rename from update/spec.go
rename to pkg/update/spec.go
index ad747fa1..07c099ee 100644
--- a/update/spec.go
+++ b/pkg/update/spec.go
@@ -4,7 +4,7 @@ import (
 	"encoding/json"
 	"errors"
 
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 const (
diff --git a/update/spec_test.go b/pkg/update/spec_test.go
similarity index 100%
rename from update/spec_test.go
rename to pkg/update/spec_test.go
diff --git a/update/sync.go b/pkg/update/sync.go
similarity index 100%
rename from update/sync.go
rename to pkg/update/sync.go
diff --git a/update/workload.go b/pkg/update/workload.go
similarity index 85%
rename from update/workload.go
rename to pkg/update/workload.go
index 5ba28096..f58ce03b 100644
--- a/update/workload.go
+++ b/pkg/update/workload.go
@@ -1,8 +1,8 @@
 package update
 
 import (
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type WorkloadUpdate struct {


Test patch:
diff --git a/cmd/fluxctl/main_test.go b/cmd/fluxctl/main_test.go
index e620c775..51d5c463 100644
--- a/cmd/fluxctl/main_test.go
+++ b/cmd/fluxctl/main_test.go
@@ -11,11 +11,11 @@ import (
 	"testing"
 	"time"
 
+	"github.com/fluxcd/flux/pkg/http/client"
 	"github.com/gorilla/mux"
-	"github.com/fluxcd/flux/http/client"
 
-	transport "github.com/fluxcd/flux/http"
-	"github.com/fluxcd/flux/job"
+	transport "github.com/fluxcd/flux/pkg/http"
+	"github.com/fluxcd/flux/pkg/job"
 )
 
 func mockServiceOpts(trip *genericMockRoundTripper) *rootOpts {
@@ -24,8 +24,8 @@ func mockServiceOpts(trip *genericMockRoundTripper) *rootOpts {
 	}
 	mockAPI := client.New(&c, transport.NewAPIRouter(), "", "")
 	return &rootOpts{
-		API: mockAPI,
-		Timeout: 10*time.Second,
+		API:     mockAPI,
+		Timeout: 10 * time.Second,
 	}
 }
 
diff --git a/cmd/fluxctl/release_cmd_test.go b/cmd/fluxctl/release_cmd_test.go
index 10c8d34a..7dd1c270 100644
--- a/cmd/fluxctl/release_cmd_test.go
+++ b/cmd/fluxctl/release_cmd_test.go
@@ -5,8 +5,8 @@ import (
 	"reflect"
 	"testing"
 
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 func TestReleaseCommand_CLIConversion(t *testing.T) {
diff --git a/api/v6/container_test.go b/pkg/api/v6/container_test.go
similarity index 97%
rename from api/v6/container_test.go
rename to pkg/api/v6/container_test.go
index 48c1d9cf..932dd50a 100644
--- a/api/v6/container_test.go
+++ b/pkg/api/v6/container_test.go
@@ -5,9 +5,9 @@ import (
 
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 type justSlice []image.Info
diff --git a/api/v9/change_test.go b/pkg/api/v9/change_test.go
similarity index 94%
rename from api/v9/change_test.go
rename to pkg/api/v9/change_test.go
index 5c9acc6a..c378df47 100644
--- a/api/v9/change_test.go
+++ b/pkg/api/v9/change_test.go
@@ -5,7 +5,7 @@ import (
 	"reflect"
 	"testing"
 
-	"github.com/fluxcd/flux/image"
+	"github.com/fluxcd/flux/pkg/image"
 )
 
 func TestChangeEncoding(t *testing.T) {
diff --git a/cluster/kubernetes/images_test.go b/pkg/cluster/kubernetes/images_test.go
similarity index 97%
rename from cluster/kubernetes/images_test.go
rename to pkg/cluster/kubernetes/images_test.go
index 5cf93cfa..018734f0 100644
--- a/cluster/kubernetes/images_test.go
+++ b/pkg/cluster/kubernetes/images_test.go
@@ -9,8 +9,8 @@ import (
 	apiv1 "k8s.io/api/core/v1"
 	"k8s.io/client-go/kubernetes/fake"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/registry"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/registry"
 )
 
 func noopLog(...interface{}) error {
diff --git a/cluster/kubernetes/manifests_test.go b/pkg/cluster/kubernetes/manifests_test.go
similarity index 98%
rename from cluster/kubernetes/manifests_test.go
rename to pkg/cluster/kubernetes/manifests_test.go
index 35457b15..43c2a8e7 100644
--- a/cluster/kubernetes/manifests_test.go
+++ b/pkg/cluster/kubernetes/manifests_test.go
@@ -11,7 +11,7 @@ import (
 	"github.com/stretchr/testify/assert"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
-	"github.com/fluxcd/flux/cluster/kubernetes/testfiles"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes/testfiles"
 )
 
 func TestLocalCRDScope(t *testing.T) {
diff --git a/cluster/kubernetes/namespacer_test.go b/pkg/cluster/kubernetes/namespacer_test.go
similarity index 97%
rename from cluster/kubernetes/namespacer_test.go
rename to pkg/cluster/kubernetes/namespacer_test.go
index a2ddd802..62861342 100644
--- a/cluster/kubernetes/namespacer_test.go
+++ b/pkg/cluster/kubernetes/namespacer_test.go
@@ -8,7 +8,7 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	corefake "k8s.io/client-go/kubernetes/fake"
 
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
 )
 
 var getAndList = metav1.Verbs([]string{"get", "list"})
diff --git a/cluster/kubernetes/patch_test.go b/pkg/cluster/kubernetes/patch_test.go
similarity index 98%
rename from cluster/kubernetes/patch_test.go
rename to pkg/cluster/kubernetes/patch_test.go
index 2894e6dd..7ff8e286 100644
--- a/cluster/kubernetes/patch_test.go
+++ b/pkg/cluster/kubernetes/patch_test.go
@@ -6,7 +6,7 @@ import (
 	"github.com/stretchr/testify/assert"
 	"gopkg.in/yaml.v2"
 
-	"github.com/fluxcd/flux/cluster/kubernetes/resource"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
 )
 
 func TestPatchAndApply(t *testing.T) {
diff --git a/cluster/kubernetes/policies_test.go b/pkg/cluster/kubernetes/policies_test.go
similarity index 97%
rename from cluster/kubernetes/policies_test.go
rename to pkg/cluster/kubernetes/policies_test.go
index 503b20e9..0c621911 100644
--- a/cluster/kubernetes/policies_test.go
+++ b/pkg/cluster/kubernetes/policies_test.go
@@ -9,8 +9,8 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 func TestUpdatePolicies(t *testing.T) {
@@ -170,8 +170,8 @@ func TestUpdatePolicies(t *testing.T) {
 		},
 		{
 			name: "add tag policy with alternative prefix does not change existing prefix",
-			in: []string{"filter.fluxcd.io/nginx", "glob:*"},
-			out: []string{"filter.fluxcd.io/nginx", "glob:*"},
+			in:   []string{"filter.fluxcd.io/nginx", "glob:*"},
+			out:  []string{"filter.fluxcd.io/nginx", "glob:*"},
 			update: resource.PolicyUpdate{
 				Add: policy.Set{policy.TagPrefix("nginx"): "glob:*"},
 			},
diff --git a/cluster/kubernetes/resource/helmrelease_test.go b/pkg/cluster/kubernetes/resource/helmrelease_test.go
similarity index 99%
rename from cluster/kubernetes/resource/helmrelease_test.go
rename to pkg/cluster/kubernetes/resource/helmrelease_test.go
index 4819c7a1..4d145d47 100644
--- a/cluster/kubernetes/resource/helmrelease_test.go
+++ b/pkg/cluster/kubernetes/resource/helmrelease_test.go
@@ -5,7 +5,7 @@ import (
 	"github.com/stretchr/testify/assert"
 	"testing"
 
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 func TestSortedContainers(t *testing.T) {
diff --git a/cluster/kubernetes/resource/list.go b/pkg/cluster/kubernetes/resource/list.go
similarity index 100%
rename from cluster/kubernetes/resource/list.go
rename to pkg/cluster/kubernetes/resource/list.go
diff --git a/cluster/kubernetes/resource/load.go b/pkg/cluster/kubernetes/resource/load.go
similarity index 100%
rename from cluster/kubernetes/resource/load.go
rename to pkg/cluster/kubernetes/resource/load.go
diff --git a/cluster/kubernetes/resource/load_test.go b/pkg/cluster/kubernetes/resource/load_test.go
similarity index 98%
rename from cluster/kubernetes/resource/load_test.go
rename to pkg/cluster/kubernetes/resource/load_test.go
index 9d90bf94..fb1af603 100644
--- a/cluster/kubernetes/resource/load_test.go
+++ b/pkg/cluster/kubernetes/resource/load_test.go
@@ -8,8 +8,8 @@ import (
 
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/cluster/kubernetes/testfiles"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes/testfiles"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // for convenience
diff --git a/cluster/kubernetes/sync_test.go b/pkg/cluster/kubernetes/sync_test.go
similarity index 99%
rename from cluster/kubernetes/sync_test.go
rename to pkg/cluster/kubernetes/sync_test.go
index 9a0c69d2..8dfc78c7 100644
--- a/cluster/kubernetes/sync_test.go
+++ b/pkg/cluster/kubernetes/sync_test.go
@@ -25,11 +25,11 @@ import (
 	corefake "k8s.io/client-go/kubernetes/fake"
 	k8s_testing "k8s.io/client-go/testing"
 
-	"github.com/fluxcd/flux/cluster"
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
 	fhrfake "github.com/fluxcd/flux/integrations/client/clientset/versioned/fake"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/sync"
+	"github.com/fluxcd/flux/pkg/cluster"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/sync"
 )
 
 const (
diff --git a/cluster/kubernetes/testfiles/data.go b/pkg/cluster/kubernetes/testfiles/data.go
similarity index 99%
rename from cluster/kubernetes/testfiles/data.go
rename to pkg/cluster/kubernetes/testfiles/data.go
index e0501558..9e479a6f 100644
--- a/cluster/kubernetes/testfiles/data.go
+++ b/pkg/cluster/kubernetes/testfiles/data.go
@@ -7,7 +7,7 @@ import (
 	"strings"
 	"testing"
 
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 func TempDir(t *testing.T) (string, func()) {
diff --git a/cluster/kubernetes/update_test.go b/pkg/cluster/kubernetes/update_test.go
similarity index 99%
rename from cluster/kubernetes/update_test.go
rename to pkg/cluster/kubernetes/update_test.go
index 07d7dc58..46b30fd5 100644
--- a/cluster/kubernetes/update_test.go
+++ b/pkg/cluster/kubernetes/update_test.go
@@ -3,9 +3,9 @@ package kubernetes
 import (
 	"testing"
 
-	kresource "github.com/fluxcd/flux/cluster/kubernetes/resource"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	kresource "github.com/fluxcd/flux/pkg/cluster/kubernetes/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 type update struct {
@@ -975,6 +975,7 @@ spec:
 `
 
 const case14resource = "maria:helmrelease/mariadb"
+
 var case14ImageMap = kresource.ContainerImageMap{
 	BasePath:   kresource.ImageBasePath,
 	Repository: "mariadb.customImage",
diff --git a/daemon/daemon_test.go b/pkg/daemon/daemon_test.go
similarity index 96%
rename from daemon/daemon_test.go
rename to pkg/daemon/daemon_test.go
index e3b1d02e..ad55a0b9 100644
--- a/daemon/daemon_test.go
+++ b/pkg/daemon/daemon_test.go
@@ -15,25 +15,25 @@ import (
 
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/api/v10"
-	"github.com/fluxcd/flux/api/v11"
-	"github.com/fluxcd/flux/api/v6"
-	"github.com/fluxcd/flux/api/v9"
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/cluster/kubernetes"
-	"github.com/fluxcd/flux/cluster/mock"
-	"github.com/fluxcd/flux/event"
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/git/gittest"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/manifests"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/registry"
-	registryMock "github.com/fluxcd/flux/registry/mock"
-	"github.com/fluxcd/flux/resource"
-	fluxsync "github.com/fluxcd/flux/sync"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/api/v10"
+	"github.com/fluxcd/flux/pkg/api/v11"
+	"github.com/fluxcd/flux/pkg/api/v6"
+	"github.com/fluxcd/flux/pkg/api/v9"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes"
+	"github.com/fluxcd/flux/pkg/cluster/mock"
+	"github.com/fluxcd/flux/pkg/event"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/git/gittest"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/manifests"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/registry"
+	registryMock "github.com/fluxcd/flux/pkg/registry/mock"
+	"github.com/fluxcd/flux/pkg/resource"
+	fluxsync "github.com/fluxcd/flux/pkg/sync"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 const (
diff --git a/daemon/images_test.go b/pkg/daemon/images_test.go
similarity index 95%
rename from daemon/images_test.go
rename to pkg/daemon/images_test.go
index 736302db..00ed7465 100644
--- a/daemon/images_test.go
+++ b/pkg/daemon/images_test.go
@@ -6,13 +6,13 @@ import (
 
 	"github.com/go-kit/kit/log"
 
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/registry"
-	registryMock "github.com/fluxcd/flux/registry/mock"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/registry"
+	registryMock "github.com/fluxcd/flux/pkg/registry/mock"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 const (
diff --git a/daemon/sync_test.go b/pkg/daemon/sync_test.go
similarity index 94%
rename from daemon/sync_test.go
rename to pkg/daemon/sync_test.go
index 364148e9..39525a02 100644
--- a/daemon/sync_test.go
+++ b/pkg/daemon/sync_test.go
@@ -14,18 +14,18 @@ import (
 
 	"github.com/go-kit/kit/log"
 
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/cluster/kubernetes"
-	"github.com/fluxcd/flux/cluster/kubernetes/testfiles"
-	"github.com/fluxcd/flux/cluster/mock"
-	"github.com/fluxcd/flux/event"
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/git/gittest"
-	"github.com/fluxcd/flux/job"
-	"github.com/fluxcd/flux/manifests"
-	registryMock "github.com/fluxcd/flux/registry/mock"
-	"github.com/fluxcd/flux/resource"
-	fluxsync "github.com/fluxcd/flux/sync"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes/testfiles"
+	"github.com/fluxcd/flux/pkg/cluster/mock"
+	"github.com/fluxcd/flux/pkg/event"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/git/gittest"
+	"github.com/fluxcd/flux/pkg/job"
+	"github.com/fluxcd/flux/pkg/manifests"
+	registryMock "github.com/fluxcd/flux/pkg/registry/mock"
+	"github.com/fluxcd/flux/pkg/resource"
+	fluxsync "github.com/fluxcd/flux/pkg/sync"
 )
 
 const (
diff --git a/event/event_test.go b/pkg/event/event_test.go
similarity index 98%
rename from event/event_test.go
rename to pkg/event/event_test.go
index 21f3f76d..a09a4334 100644
--- a/event/event_test.go
+++ b/pkg/event/event_test.go
@@ -4,7 +4,7 @@ import (
 	"encoding/json"
 	"testing"
 
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 var (
diff --git a/git/export.go b/pkg/git/export.go
similarity index 100%
rename from git/export.go
rename to pkg/git/export.go
diff --git a/git/export_test.go b/pkg/git/export_test.go
similarity index 93%
rename from git/export_test.go
rename to pkg/git/export_test.go
index fc9fe30f..676dd00e 100644
--- a/git/export_test.go
+++ b/pkg/git/export_test.go
@@ -5,7 +5,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/fluxcd/flux/cluster/kubernetes/testfiles"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes/testfiles"
 )
 
 func TestExportAtRevision(t *testing.T) {
diff --git a/git/gittest/repo.go b/pkg/git/gittest/repo.go
similarity index 96%
rename from git/gittest/repo.go
rename to pkg/git/gittest/repo.go
index d8237e6e..c3149538 100644
--- a/git/gittest/repo.go
+++ b/pkg/git/gittest/repo.go
@@ -7,9 +7,9 @@ import (
 	"path/filepath"
 	"testing"
 
-	"github.com/fluxcd/flux/cluster/kubernetes/testfiles"
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes/testfiles"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // Repo creates a new clone-able git repo, pre-populated with some kubernetes
diff --git a/git/gittest/repo_test.go b/pkg/git/gittest/repo_test.go
similarity index 97%
rename from git/gittest/repo_test.go
rename to pkg/git/gittest/repo_test.go
index 678544b2..50b9c92e 100644
--- a/git/gittest/repo_test.go
+++ b/pkg/git/gittest/repo_test.go
@@ -11,9 +11,9 @@ import (
 
 	"context"
 
-	"github.com/fluxcd/flux/cluster/kubernetes/testfiles"
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/gpg/gpgtest"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes/testfiles"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/gpg/gpgtest"
 )
 
 type Note struct {
diff --git a/git/mirrors.go b/pkg/git/mirrors.go
similarity index 100%
rename from git/mirrors.go
rename to pkg/git/mirrors.go
diff --git a/git/operations.go b/pkg/git/operations.go
similarity index 100%
rename from git/operations.go
rename to pkg/git/operations.go
diff --git a/git/operations_test.go b/pkg/git/operations_test.go
similarity index 99%
rename from git/operations_test.go
rename to pkg/git/operations_test.go
index b927e6b0..5b5e7d2e 100644
--- a/git/operations_test.go
+++ b/pkg/git/operations_test.go
@@ -11,8 +11,8 @@ import (
 	"testing"
 	"time"
 
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes/testfiles"
 	"github.com/stretchr/testify/assert"
-	"github.com/fluxcd/flux/cluster/kubernetes/testfiles"
 )
 
 const (
diff --git a/git/repo.go b/pkg/git/repo.go
similarity index 100%
rename from git/repo.go
rename to pkg/git/repo.go
diff --git a/git/signature.go b/pkg/git/signature.go
similarity index 100%
rename from git/signature.go
rename to pkg/git/signature.go
diff --git a/git/url.go b/pkg/git/url.go
similarity index 100%
rename from git/url.go
rename to pkg/git/url.go
diff --git a/git/url_test.go b/pkg/git/url_test.go
similarity index 100%
rename from git/url_test.go
rename to pkg/git/url_test.go
diff --git a/git/working.go b/pkg/git/working.go
similarity index 100%
rename from git/working.go
rename to pkg/git/working.go
diff --git a/gpg/gpg.go b/pkg/gpg/gpg.go
similarity index 100%
rename from gpg/gpg.go
rename to pkg/gpg/gpg.go
diff --git a/gpg/gpgtest/gpg.go b/pkg/gpg/gpgtest/gpg.go
similarity index 96%
rename from gpg/gpgtest/gpg.go
rename to pkg/gpg/gpgtest/gpg.go
index 32759771..11881f91 100644
--- a/gpg/gpgtest/gpg.go
+++ b/pkg/gpg/gpgtest/gpg.go
@@ -7,7 +7,7 @@ import (
 	"strings"
 	"testing"
 
-	"github.com/fluxcd/flux/cluster/kubernetes/testfiles"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes/testfiles"
 )
 
 // GPGKey creates a new, temporary GPG home directory and a public/private key
diff --git a/http/daemon/server_test.go b/pkg/http/daemon/server_test.go
similarity index 88%
rename from http/daemon/server_test.go
rename to pkg/http/daemon/server_test.go
index a0036ea8..f948af98 100644
--- a/http/daemon/server_test.go
+++ b/pkg/http/daemon/server_test.go
@@ -3,7 +3,7 @@ package daemon
 import (
 	"testing"
 
-	"github.com/fluxcd/flux/http"
+	"github.com/fluxcd/flux/pkg/http"
 )
 
 func TestRouterImplementsServer(t *testing.T) {
diff --git a/http/websocket/ping.go b/pkg/http/websocket/ping.go
similarity index 100%
rename from http/websocket/ping.go
rename to pkg/http/websocket/ping.go
diff --git a/http/websocket/server.go b/pkg/http/websocket/server.go
similarity index 100%
rename from http/websocket/server.go
rename to pkg/http/websocket/server.go
diff --git a/http/websocket/websocket.go b/pkg/http/websocket/websocket.go
similarity index 100%
rename from http/websocket/websocket.go
rename to pkg/http/websocket/websocket.go
diff --git a/http/websocket/websocket_test.go b/pkg/http/websocket/websocket_test.go
similarity index 97%
rename from http/websocket/websocket_test.go
rename to pkg/http/websocket/websocket_test.go
index 961ad364..0948dd48 100644
--- a/http/websocket/websocket_test.go
+++ b/pkg/http/websocket/websocket_test.go
@@ -9,7 +9,7 @@ import (
 	"sync"
 	"testing"
 
-	"github.com/fluxcd/flux/http/client"
+	"github.com/fluxcd/flux/pkg/http/client"
 )
 
 func TestToken(t *testing.T) {
diff --git a/manifests/configaware_test.go b/pkg/manifests/configaware_test.go
similarity index 96%
rename from manifests/configaware_test.go
rename to pkg/manifests/configaware_test.go
index 212a0881..499b6a8b 100644
--- a/manifests/configaware_test.go
+++ b/pkg/manifests/configaware_test.go
@@ -10,11 +10,11 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/cluster/kubernetes"
-	"github.com/fluxcd/flux/cluster/kubernetes/testfiles"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes/testfiles"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 func TestFindConfigFilePaths(t *testing.T) {
diff --git a/manifests/configfile_test.go b/pkg/manifests/configfile_test.go
similarity index 99%
rename from manifests/configfile_test.go
rename to pkg/manifests/configfile_test.go
index 3d0cc9ee..736a13e1 100644
--- a/manifests/configfile_test.go
+++ b/pkg/manifests/configfile_test.go
@@ -7,7 +7,7 @@ import (
 	"github.com/stretchr/testify/assert"
 	"gopkg.in/yaml.v2"
 
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 const patchUpdatedConfigFile = `---
diff --git a/registry/cache/doc.go b/pkg/registry/cache/doc.go
similarity index 100%
rename from registry/cache/doc.go
rename to pkg/registry/cache/doc.go
diff --git a/registry/cache/memcached/integration_test.go b/pkg/registry/cache/memcached/integration_test.go
similarity index 94%
rename from registry/cache/memcached/integration_test.go
rename to pkg/registry/cache/memcached/integration_test.go
index 55b06ced..b5e989ef 100644
--- a/registry/cache/memcached/integration_test.go
+++ b/pkg/registry/cache/memcached/integration_test.go
@@ -12,10 +12,10 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/registry"
-	"github.com/fluxcd/flux/registry/cache"
-	"github.com/fluxcd/flux/registry/middleware"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/registry"
+	"github.com/fluxcd/flux/pkg/registry/cache"
+	"github.com/fluxcd/flux/pkg/registry/middleware"
 )
 
 // memcachedIPs flag from memcached_test.go
diff --git a/registry/cache/registry_test.go b/pkg/registry/cache/registry_test.go
similarity index 96%
rename from registry/cache/registry_test.go
rename to pkg/registry/cache/registry_test.go
index 8c8203bc..708bb1cd 100644
--- a/registry/cache/registry_test.go
+++ b/pkg/registry/cache/registry_test.go
@@ -5,8 +5,8 @@ import (
 	"testing"
 	"time"
 
+	"github.com/fluxcd/flux/pkg/image"
 	"github.com/stretchr/testify/assert"
-	"github.com/fluxcd/flux/image"
 )
 
 // mockStorage holds a fixed ImageRepository item.
@@ -36,7 +36,7 @@ func mockReader() *mockStorage {
 	return &mockStorage{
 		Item: ImageRepository{
 			RepositoryMetadata: image.RepositoryMetadata{
-				Tags: []string{},
+				Tags:   []string{},
 				Images: map[string]image.Info{},
 			},
 			LastUpdate: time.Now(),
diff --git a/registry/cache/repocachemanager_test.go b/pkg/registry/cache/repocachemanager_test.go
similarity index 93%
rename from registry/cache/repocachemanager_test.go
rename to pkg/registry/cache/repocachemanager_test.go
index 802139dc..d7434141 100644
--- a/registry/cache/repocachemanager_test.go
+++ b/pkg/registry/cache/repocachemanager_test.go
@@ -12,8 +12,8 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/registry"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/registry"
 )
 
 func Test_ClientTimeouts(t *testing.T) {
diff --git a/registry/cache/warming_test.go b/pkg/registry/cache/warming_test.go
similarity index 97%
rename from registry/cache/warming_test.go
rename to pkg/registry/cache/warming_test.go
index 8a8a1476..2d6575aa 100644
--- a/registry/cache/warming_test.go
+++ b/pkg/registry/cache/warming_test.go
@@ -10,9 +10,9 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/registry"
-	"github.com/fluxcd/flux/registry/mock"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/registry"
+	"github.com/fluxcd/flux/pkg/registry/mock"
 )
 
 type entry struct {
diff --git a/registry/credentials.go b/pkg/registry/credentials.go
similarity index 100%
rename from registry/credentials.go
rename to pkg/registry/credentials.go
diff --git a/registry/credentials_test.go b/pkg/registry/credentials_test.go
similarity index 100%
rename from registry/credentials_test.go
rename to pkg/registry/credentials_test.go
diff --git a/registry/doc.go b/pkg/registry/doc.go
similarity index 100%
rename from registry/doc.go
rename to pkg/registry/doc.go
diff --git a/registry/gcp.go b/pkg/registry/gcp.go
similarity index 100%
rename from registry/gcp.go
rename to pkg/registry/gcp.go
diff --git a/registry/imageentry_test.go b/pkg/registry/imageentry_test.go
similarity index 97%
rename from registry/imageentry_test.go
rename to pkg/registry/imageentry_test.go
index 9e37f271..e464d251 100644
--- a/registry/imageentry_test.go
+++ b/pkg/registry/imageentry_test.go
@@ -7,7 +7,7 @@ import (
 
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/image"
+	"github.com/fluxcd/flux/pkg/image"
 )
 
 // Check that the ImageEntry type can be round-tripped via JSON.
diff --git a/release/releaser_test.go b/pkg/release/releaser_test.go
similarity index 98%
rename from release/releaser_test.go
rename to pkg/release/releaser_test.go
index 4cc9b2bb..f63c021f 100644
--- a/release/releaser_test.go
+++ b/pkg/release/releaser_test.go
@@ -13,16 +13,16 @@ import (
 
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/cluster/kubernetes"
-	"github.com/fluxcd/flux/cluster/mock"
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/git/gittest"
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/manifests"
-	registryMock "github.com/fluxcd/flux/registry/mock"
-	"github.com/fluxcd/flux/resource"
-	"github.com/fluxcd/flux/update"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes"
+	"github.com/fluxcd/flux/pkg/cluster/mock"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/git/gittest"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/manifests"
+	registryMock "github.com/fluxcd/flux/pkg/registry/mock"
+	"github.com/fluxcd/flux/pkg/resource"
+	"github.com/fluxcd/flux/pkg/update"
 )
 
 var (
diff --git a/remote/mock_test.go b/pkg/remote/mock_test.go
similarity index 84%
rename from remote/mock_test.go
rename to pkg/remote/mock_test.go
index cfa10f88..696206f2 100644
--- a/remote/mock_test.go
+++ b/pkg/remote/mock_test.go
@@ -3,7 +3,7 @@ package remote
 import (
 	"testing"
 
-	"github.com/fluxcd/flux/api"
+	"github.com/fluxcd/flux/pkg/api"
 )
 
 // Just test that the mock does its job.
diff --git a/remote/rpc/doc.go b/pkg/remote/rpc/doc.go
similarity index 100%
rename from remote/rpc/doc.go
rename to pkg/remote/rpc/doc.go
diff --git a/remote/rpc/rpc_test.go b/pkg/remote/rpc/rpc_test.go
similarity index 95%
rename from remote/rpc/rpc_test.go
rename to pkg/remote/rpc/rpc_test.go
index 022ce19c..c88045cf 100644
--- a/remote/rpc/rpc_test.go
+++ b/pkg/remote/rpc/rpc_test.go
@@ -8,8 +8,8 @@ import (
 	"testing"
 	"time"
 
-	"github.com/fluxcd/flux/api"
-	"github.com/fluxcd/flux/remote"
+	"github.com/fluxcd/flux/pkg/api"
+	"github.com/fluxcd/flux/pkg/remote"
 )
 
 func pipes() (io.ReadWriteCloser, io.ReadWriteCloser) {
diff --git a/sync/sync_test.go b/pkg/sync/sync_test.go
similarity index 89%
rename from sync/sync_test.go
rename to pkg/sync/sync_test.go
index bc69f9cf..a41eea23 100644
--- a/sync/sync_test.go
+++ b/pkg/sync/sync_test.go
@@ -8,12 +8,12 @@ import (
 	"github.com/go-kit/kit/log"
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/cluster"
-	"github.com/fluxcd/flux/cluster/kubernetes"
-	"github.com/fluxcd/flux/git"
-	"github.com/fluxcd/flux/git/gittest"
-	"github.com/fluxcd/flux/manifests"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/cluster"
+	"github.com/fluxcd/flux/pkg/cluster/kubernetes"
+	"github.com/fluxcd/flux/pkg/git"
+	"github.com/fluxcd/flux/pkg/git/gittest"
+	"github.com/fluxcd/flux/pkg/manifests"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 // Test that cluster.Sync gets called with the appropriate things when
diff --git a/update/images_test.go b/pkg/update/images_test.go
similarity index 97%
rename from update/images_test.go
rename to pkg/update/images_test.go
index f5773571..3201d31e 100644
--- a/update/images_test.go
+++ b/pkg/update/images_test.go
@@ -6,9 +6,9 @@ import (
 
 	"github.com/stretchr/testify/assert"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/policy"
-	"github.com/fluxcd/flux/registry/mock"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/policy"
+	"github.com/fluxcd/flux/pkg/registry/mock"
 )
 
 var (
diff --git a/update/print.go b/pkg/update/print.go
similarity index 100%
rename from update/print.go
rename to pkg/update/print.go
diff --git a/update/print_test.go b/pkg/update/print_test.go
similarity index 97%
rename from update/print_test.go
rename to pkg/update/print_test.go
index 57b94f7f..38d4b5c6 100644
--- a/update/print_test.go
+++ b/pkg/update/print_test.go
@@ -4,8 +4,8 @@ import (
 	"bytes"
 	"testing"
 
-	"github.com/fluxcd/flux/image"
-	"github.com/fluxcd/flux/resource"
+	"github.com/fluxcd/flux/pkg/image"
+	"github.com/fluxcd/flux/pkg/resource"
 )
 
 func mustParseRef(s string) image.Ref {