Skip to content

Commit

Permalink
refactor: move pkg/resources to machinery
Browse files Browse the repository at this point in the history
Fixes #4420

No functional changes, just moving packages around.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Nov 15, 2021
1 parent 0102a64 commit 753a821
Show file tree
Hide file tree
Showing 272 changed files with 358 additions and 367 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ COPY --from=generate-build /api/storage/*.pb.go /pkg/machinery/api/storage/
COPY --from=generate-build /api/resource/*.pb.go /pkg/machinery/api/resource/
COPY --from=generate-build /api/resource/secrets/*.pb.go /pkg/machinery/api/resource/secrets/
COPY --from=generate-build /api/inspect/*.pb.go /pkg/machinery/api/inspect/
COPY --from=go-generate /src/pkg/resources/kubespan/ /pkg/resources/kubespan/
COPY --from=go-generate /src/pkg/resources/network/ /pkg/resources/network/
COPY --from=go-generate /src/pkg/machinery/resources/kubespan/ /pkg/machinery/resources/kubespan/
COPY --from=go-generate /src/pkg/machinery/resources/network/ /pkg/machinery/resources/network/
COPY --from=go-generate /src/pkg/machinery/config/types/v1alpha1/ /pkg/machinery/config/types/v1alpha1/
COPY --from=go-generate /src/pkg/machinery/nethelpers/ /pkg/machinery/nethelpers/

Expand Down
2 changes: 1 addition & 1 deletion cmd/talosctl/cmd/talos/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/talos-systems/talos/pkg/cli"
"github.com/talos-systems/talos/pkg/machinery/api/machine"
"github.com/talos-systems/talos/pkg/machinery/client"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
)

var editCmdFlags struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/talosctl/cmd/talos/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/talos-systems/talos/pkg/machinery/api/machine"
"github.com/talos-systems/talos/pkg/machinery/client"
"github.com/talos-systems/talos/pkg/machinery/config/configpatcher"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
)

var patchCmdFlags struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/talosctl/cmd/talos/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

"github.com/talos-systems/talos/pkg/cluster"
"github.com/talos-systems/talos/pkg/machinery/client"
clusterresource "github.com/talos-systems/talos/pkg/resources/cluster"
clusterresource "github.com/talos-systems/talos/pkg/machinery/resources/cluster"
)

var supportCmdFlags struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/app/apid/pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/cosi-project/runtime/pkg/state"
"github.com/talos-systems/crypto/tls"

"github.com/talos-systems/talos/pkg/resources/secrets"
"github.com/talos-systems/talos/pkg/machinery/resources/secrets"
)

// TLSConfig provides client & server TLS configs for apid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ import (
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/generate"
machinetype "github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/machinery/constants"
timeresource "github.com/talos-systems/talos/pkg/machinery/resources/time"
"github.com/talos-systems/talos/pkg/machinery/role"
timeresource "github.com/talos-systems/talos/pkg/resources/time"
"github.com/talos-systems/talos/pkg/version"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/app/machined/pkg/adapters/cluster/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/jxskiss/base62"

"github.com/talos-systems/talos/pkg/machinery/constants"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
)

// IdentitySpec adapter provides identity generation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/require"

clusteradapter "github.com/talos-systems/talos/internal/app/machined/pkg/adapters/cluster"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
)

func TestIdentityGenerate(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/app/machined/pkg/adapters/k8s/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/yaml"

"github.com/talos-systems/talos/pkg/resources/k8s"
"github.com/talos-systems/talos/pkg/machinery/resources/k8s"
)

// Manifest adapter provides conversion from procfs.
Expand Down
2 changes: 1 addition & 1 deletion internal/app/machined/pkg/adapters/k8s/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"

k8sadapter "github.com/talos-systems/talos/internal/app/machined/pkg/adapters/k8s"
"github.com/talos-systems/talos/pkg/resources/k8s"
"github.com/talos-systems/talos/pkg/machinery/resources/k8s"
)

func TestManifestSetYAML(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/app/machined/pkg/adapters/k8s/static_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

v1 "k8s.io/api/core/v1"

"github.com/talos-systems/talos/pkg/resources/k8s"
"github.com/talos-systems/talos/pkg/machinery/resources/k8s"
)

// StaticPod adapter provides conversion from *v1.Pod.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

v1 "k8s.io/api/core/v1"

"github.com/talos-systems/talos/pkg/resources/k8s"
"github.com/talos-systems/talos/pkg/machinery/resources/k8s"
)

// StaticPodStatus adapter provides conversion from *v1.PodStatus.
Expand Down
4 changes: 2 additions & 2 deletions internal/app/machined/pkg/adapters/kubespan/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"inet.af/netaddr"

"github.com/talos-systems/talos/pkg/resources/kubespan"
"github.com/talos-systems/talos/pkg/resources/network"
"github.com/talos-systems/talos/pkg/machinery/resources/kubespan"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
)

// IdentitySpec adapter provides identity generation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"

kubespanadapter "github.com/talos-systems/talos/internal/app/machined/pkg/adapters/kubespan"
"github.com/talos-systems/talos/pkg/resources/kubespan"
"github.com/talos-systems/talos/pkg/machinery/resources/kubespan"
)

func TestIdentityGenerateKey(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/app/machined/pkg/adapters/kubespan/peer_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"inet.af/netaddr"

"github.com/talos-systems/talos/pkg/resources/kubespan"
"github.com/talos-systems/talos/pkg/machinery/resources/kubespan"
)

// PeerStatusSpec adapter provides Wiregard integration and state management.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"inet.af/netaddr"

kubespanadapter "github.com/talos-systems/talos/internal/app/machined/pkg/adapters/kubespan"
"github.com/talos-systems/talos/pkg/resources/kubespan"
"github.com/talos-systems/talos/pkg/machinery/resources/kubespan"
)

func TestPeerStatus_PickNewEndpoint(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"golang.org/x/sys/unix"

"github.com/talos-systems/talos/pkg/machinery/nethelpers"
"github.com/talos-systems/talos/pkg/resources/network"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
)

// BondMasterSpec adapter provides encoding/decoding to netlink structures.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

networkadapter "github.com/talos-systems/talos/internal/app/machined/pkg/adapters/network"
"github.com/talos-systems/talos/pkg/machinery/nethelpers"
"github.com/talos-systems/talos/pkg/resources/network"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
)

func TestBondMasterSpec(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/app/machined/pkg/adapters/network/vlan_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"golang.org/x/sys/unix"

"github.com/talos-systems/talos/pkg/machinery/nethelpers"
"github.com/talos-systems/talos/pkg/resources/network"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
)

// VLANSpec adapter provides encoding/decoding to netlink structures.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

networkadapter "github.com/talos-systems/talos/internal/app/machined/pkg/adapters/network"
"github.com/talos-systems/talos/pkg/machinery/nethelpers"
"github.com/talos-systems/talos/pkg/resources/network"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
)

func TestVLANSpec(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
"inet.af/netaddr"

"github.com/talos-systems/talos/pkg/resources/network"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
)

// WireguardSpec adapter provides encoding/decoding to netlink structures.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"inet.af/netaddr"

networkadapter "github.com/talos-systems/talos/internal/app/machined/pkg/adapters/network"
"github.com/talos-systems/talos/pkg/resources/network"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
)

func TestWireguardSpecDecode(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/app/machined/pkg/adapters/perf/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package perf
import (
"github.com/prometheus/procfs"

"github.com/talos-systems/talos/pkg/resources/perf"
"github.com/talos-systems/talos/pkg/machinery/resources/perf"
)

// CPU adapter provides conversion from procfs.
Expand Down
2 changes: 1 addition & 1 deletion internal/app/machined/pkg/adapters/perf/mem.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/AlekSi/pointer"
"github.com/prometheus/procfs"

"github.com/talos-systems/talos/pkg/resources/perf"
"github.com/talos-systems/talos/pkg/machinery/resources/perf"
)

// Memory adapter provides conversion from procfs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/cosi-project/runtime/pkg/resource"
"go.uber.org/zap"

"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
)

// AffiliateMergeController merges raw Affiliates from the RawNamespaceName into final representation in the NamespaceName.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

clusterctrl "github.com/talos-systems/talos/internal/app/machined/pkg/controllers/cluster"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
)

type AffiliateMergeSuite struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/talos-systems/talos/pkg/logging"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
)

type ClusterSuite struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/app/machined/pkg/controllers/cluster/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"github.com/cosi-project/runtime/pkg/state"
"go.uber.org/zap"

"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
)

// ConfigController watches v1alpha1.Config, updates discovery config.
Expand Down
4 changes: 2 additions & 2 deletions internal/app/machined/pkg/controllers/cluster/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (

clusterctrl "github.com/talos-systems/talos/internal/app/machined/pkg/controllers/cluster"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
)

type ConfigSuite struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (

"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/machinery/proto"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/resources/kubespan"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/kubespan"
"github.com/talos-systems/talos/pkg/version"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import (
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/machinery/constants"
"github.com/talos-systems/talos/pkg/machinery/proto"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/resources/kubespan"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/kubespan"
)

type DiscoveryServiceSuite struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/app/machined/pkg/controllers/cluster/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"inet.af/netaddr"

"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/resources/k8s"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/k8s"
)

// EndpointController looks up control plane endpoints.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (

clusterctrl "github.com/talos-systems/talos/internal/app/machined/pkg/controllers/cluster"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/resources/k8s"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/k8s"
)

type EndpointSuite struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import (
"github.com/talos-systems/talos/pkg/conditions"
"github.com/talos-systems/talos/pkg/kubernetes"
"github.com/talos-systems/talos/pkg/machinery/constants"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/resources/k8s"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/k8s"
)

// KubernetesPullController pulls list of Affiliate resource from the Kubernetes registry.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/talos-systems/talos/pkg/conditions"
"github.com/talos-systems/talos/pkg/kubernetes"
"github.com/talos-systems/talos/pkg/machinery/constants"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
)

// KubernetesPushController pushes Affiliate resource to the Kubernetes registry.
Expand Down
10 changes: 5 additions & 5 deletions internal/app/machined/pkg/controllers/cluster/local_affiliate.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (
"inet.af/netaddr"

"github.com/talos-systems/talos/pkg/machinery/constants"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/resources/k8s"
"github.com/talos-systems/talos/pkg/resources/kubespan"
"github.com/talos-systems/talos/pkg/resources/network"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/k8s"
"github.com/talos-systems/talos/pkg/machinery/resources/kubespan"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
"github.com/talos-systems/talos/pkg/version"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import (
kubespanadapter "github.com/talos-systems/talos/internal/app/machined/pkg/adapters/kubespan"
clusterctrl "github.com/talos-systems/talos/internal/app/machined/pkg/controllers/cluster"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/resources/config"
"github.com/talos-systems/talos/pkg/resources/k8s"
"github.com/talos-systems/talos/pkg/resources/kubespan"
"github.com/talos-systems/talos/pkg/resources/network"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/config"
"github.com/talos-systems/talos/pkg/machinery/resources/k8s"
"github.com/talos-systems/talos/pkg/machinery/resources/kubespan"
"github.com/talos-systems/talos/pkg/machinery/resources/network"
)

type LocalAffiliateSuite struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/app/machined/pkg/controllers/cluster/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"go.uber.org/zap"
"inet.af/netaddr"

"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
)

// MemberController converts Affiliates which have Nodename set into Members.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

clusterctrl "github.com/talos-systems/talos/internal/app/machined/pkg/controllers/cluster"
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
"github.com/talos-systems/talos/pkg/resources/cluster"
"github.com/talos-systems/talos/pkg/machinery/resources/cluster"
)

type MemberSuite struct {
Expand Down

0 comments on commit 753a821

Please sign in to comment.