Skip to content

Commit

Permalink
v2tenancy: rename v1alpha1 -> v2beta1 (#19227)
Browse files Browse the repository at this point in the history
  • Loading branch information
analogue authored Oct 16, 2023
1 parent b81c862 commit 4c5a46e
Show file tree
Hide file tree
Showing 14 changed files with 201 additions and 201 deletions.
2 changes: 1 addition & 1 deletion internal/catalog/catalogtest/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func runInMemResourceServiceAndControllers(t *testing.T, deps controllers.Depend

func TestControllers_Integration(t *testing.T) {
client := runInMemResourceServiceAndControllers(t, catalog.DefaultControllerDependencies())
RunCatalogV1Alpha1IntegrationTest(t, client)
RunCatalogV2Beta1IntegrationTest(t, client)
}

func TestControllers_Lifecycle(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions internal/catalog/catalogtest/test_integration_v2beta1.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
testData embed.FS
)

// RunCatalogV1Alpha1IntegrationTest will push up a bunch of catalog related data and then
// RunCatalogV2Beta1IntegrationTest will push up a bunch of catalog related data and then
// verify that all the expected reconciliations happened correctly. This test is
// intended to exercise a large swathe of behavior of the overall catalog package.
// Besides just controller reconciliation behavior, the intent is also to verify
Expand All @@ -38,7 +38,7 @@ var (
// is another RunCatalogIntegrationTestLifeCycle function that can be used for those
// purposes. The two are distinct so that the data being published and the assertions
// made against the system can be reused in upgrade tests.
func RunCatalogV1Alpha1IntegrationTest(t *testing.T, client pbresource.ResourceServiceClient) {
func RunCatalogV2Beta1IntegrationTest(t *testing.T, client pbresource.ResourceServiceClient) {
t.Helper()

PublishCatalogV2Beta1IntegrationTestData(t, client)
Expand Down
10 changes: 5 additions & 5 deletions internal/tenancy/exports.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
var (
// API Group Information

APIGroup = types.GroupName
VersionV1Alpha1 = types.VersionV1Alpha1
CurrentVersion = types.CurrentVersion
APIGroup = types.GroupName
VersionV2Beta1 = types.VersionV2Beta1
CurrentVersion = types.CurrentVersion

// Resource Kind Names.

NamespaceKind = types.NamespaceKind
NamespaceV1Alpha1Type = types.NamespaceV1Alpha1Type
NamespaceKind = types.NamespaceKind
NamespaceV2Beta1Type = types.NamespaceV2Beta1Type
)

// RegisterTypes adds all resource types within the "tenancy" API group
Expand Down
17 changes: 9 additions & 8 deletions internal/tenancy/internal/types/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,31 @@ package types

import (
"fmt"
"strings"

"github.com/hashicorp/consul/agent/dns"
"github.com/hashicorp/consul/internal/resource"
"github.com/hashicorp/consul/proto-public/pbresource"
tenancyv1alpha1 "github.com/hashicorp/consul/proto-public/pbtenancy/v1alpha1"
"strings"
pbtenancy "github.com/hashicorp/consul/proto-public/pbtenancy/v2beta1"
)

const (
NamespaceKind = "Namespace"
)

var (
NamespaceV1Alpha1Type = &pbresource.Type{
NamespaceV2Beta1Type = &pbresource.Type{
Group: GroupName,
GroupVersion: VersionV1Alpha1,
GroupVersion: VersionV2Beta1,
Kind: NamespaceKind,
}
NamespaceType = NamespaceV1Alpha1Type
NamespaceType = NamespaceV2Beta1Type
)

func RegisterNamespace(r resource.Registry) {
r.Register(resource.Registration{
Type: NamespaceV1Alpha1Type,
Proto: &tenancyv1alpha1.Namespace{},
Type: NamespaceType,
Proto: &pbtenancy.Namespace{},
Scope: resource.ScopePartition,
Validate: ValidateNamespace,
Mutate: MutateNamespace,
Expand All @@ -42,7 +43,7 @@ func MutateNamespace(res *pbresource.Resource) error {
}

func ValidateNamespace(res *pbresource.Resource) error {
var ns tenancyv1alpha1.Namespace
var ns pbtenancy.Namespace

if err := res.Data.UnmarshalTo(&ns); err != nil {
return resource.NewErrDataParse(&ns, err)
Expand Down
4 changes: 2 additions & 2 deletions internal/tenancy/internal/types/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import (

"github.com/hashicorp/consul/internal/resource"
"github.com/hashicorp/consul/proto-public/pbresource"
pbtenancy "github.com/hashicorp/consul/proto-public/pbtenancy/v1alpha1"
pbtenancy "github.com/hashicorp/consul/proto-public/pbtenancy/v2beta1"
)

func createNamespaceResource(t *testing.T, data protoreflect.ProtoMessage) *pbresource.Resource {
res := &pbresource.Resource{
Id: &pbresource.ID{
Type: NamespaceV1Alpha1Type,
Type: NamespaceV2Beta1Type,
Tenancy: resource.DefaultPartitionedTenancy(),
Name: "ns1234",
},
Expand Down
6 changes: 3 additions & 3 deletions internal/tenancy/internal/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package types

const (
GroupName = "tenancy"
VersionV1Alpha1 = "v1alpha1"
CurrentVersion = VersionV1Alpha1
GroupName = "tenancy"
VersionV2Beta1 = "v2beta1"
CurrentVersion = VersionV2Beta1
)
172 changes: 0 additions & 172 deletions proto-public/pbtenancy/v1alpha1/namespace.pb.go

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4c5a46e

Please sign in to comment.