Skip to content

Commit 0a78fdb

Browse files
committed
chore: rename version from v1alpha1 to v1
1 parent f40fff1 commit 0a78fdb

27 files changed

+72
-72
lines changed

PROJECT

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ repo: github.com/nais/azureator
33
resources:
44
- group: nais.io
55
kind: AzureAdApplication
6-
version: v1alpha1
6+
version: v1
77
version: "2"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ kubectl apply -f ./config/samples/AzureAdApplication.yaml
5151

5252
## 3. CRD
5353

54-
The operator introduces a new Kind `AzureAdApplication` (shortname `azuread`), and acts upon changes to resources of this kind.
54+
The operator introduces a new Kind `AzureAdApplication` (shortname `azureapp`), and acts upon changes to resources of this kind.
5555

5656
See the spec in [config/crd/bases/nais.io_azureadapplications.yaml](./config/crd/bases/nais.io_azureadapplications.yaml) for details.
5757

api/v1alpha1/azureadapplication_types.go api/v1/azureadapplication_types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package v1alpha1
1+
package v1
22

33
// +groupName="nais.io"
44

api/v1alpha1/azureadapplication_types_test.go api/v1/azureadapplication_types_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package v1alpha1
1+
package v1
22

33
import (
44
"testing"

api/v1alpha1/groupversion_info.go api/v1/groupversion_info.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Package v1alpha1 contains API Schema definitions for the nais.io v1alpha1 API group
1+
// Package v1 contains API Schema definitions for the nais.io v1 API group
22
// +kubebuilder:object:generate=true
33
// +groupName=nais.io
4-
package v1alpha1
4+
package v1
55

66
import (
77
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -10,7 +10,7 @@ import (
1010

1111
var (
1212
// GroupVersion is group version used to register these objects
13-
GroupVersion = schema.GroupVersion{Group: "nais.io", Version: "v1alpha1"}
13+
GroupVersion = schema.GroupVersion{Group: "nais.io", Version: "v1"}
1414

1515
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
1616
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

api/v1alpha1/zz_generated.deepcopy.go api/v1/zz_generated.deepcopy.go

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/azurerator/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
ctrl "sigs.k8s.io/controller-runtime"
2222
"sigs.k8s.io/controller-runtime/pkg/metrics"
2323

24-
naisiov1alpha1 "github.com/nais/azureator/api/v1alpha1"
24+
naisiov1 "github.com/nais/azureator/api/v1"
2525
// +kubebuilder:scaffold:imports
2626
)
2727

@@ -38,7 +38,7 @@ func init() {
3838
)
3939

4040
_ = clientgoscheme.AddToScheme(scheme)
41-
_ = naisiov1alpha1.AddToScheme(scheme)
41+
_ = naisiov1.AddToScheme(scheme)
4242
// +kubebuilder:scaffold:scheme
4343
}
4444

config/crd/bases/nais.io_azureadapplications.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ spec:
126126
- synchronized
127127
type: object
128128
type: object
129-
version: v1alpha1
129+
version: v1
130130
versions:
131-
- name: v1alpha1
131+
- name: v1
132132
served: true
133133
storage: true
134134
status:

config/samples/azureadapplication.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
apiVersion: nais.io/v1alpha1
2+
apiVersion: nais.io/v1
33
kind: AzureAdApplication
44
metadata:
55
name: myapp

controllers/azureadapplication/azureadapplication_controller.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"time"
77

88
"github.com/google/uuid"
9-
"github.com/nais/azureator/api/v1alpha1"
9+
"github.com/nais/azureator/api/v1"
1010
"github.com/nais/azureator/pkg/azure"
1111
"github.com/nais/azureator/pkg/metrics"
1212
"github.com/nais/azureator/pkg/secret"
@@ -29,7 +29,7 @@ type Reconciler struct {
2929

3030
type transaction struct {
3131
ctx context.Context
32-
instance *v1alpha1.AzureAdApplication
32+
instance *v1.AzureAdApplication
3333
log log.Entry
3434
}
3535

@@ -56,7 +56,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
5656
})
5757
ctx := context.Background()
5858

59-
instance := &v1alpha1.AzureAdApplication{}
59+
instance := &v1.AzureAdApplication{}
6060
if err := r.Get(ctx, req.NamespacedName, instance); err != nil {
6161
return ctrl.Result{}, client.IgnoreNotFound(err)
6262
}
@@ -105,7 +105,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
105105

106106
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
107107
return ctrl.NewControllerManagedBy(mgr).
108-
For(&v1alpha1.AzureAdApplication{}).
108+
For(&v1.AzureAdApplication{}).
109109
Complete(r)
110110
}
111111

controllers/azureadapplication/azureadapplication_controller_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import (
88
"testing"
99
"time"
1010

11-
"github.com/nais/azureator/api/v1alpha1"
11+
"github.com/nais/azureator/api/v1"
1212
azureFixtures "github.com/nais/azureator/pkg/fixtures/azure"
1313
"github.com/nais/azureator/pkg/fixtures/k8s"
1414
"github.com/nais/azureator/pkg/resourcecreator"
1515
"github.com/nais/azureator/pkg/util/test"
1616
"github.com/stretchr/testify/assert"
1717
corev1 "k8s.io/api/core/v1"
1818
"k8s.io/apimachinery/pkg/api/errors"
19-
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2020
"k8s.io/apimachinery/pkg/runtime"
2121
"k8s.io/client-go/kubernetes/scheme"
2222
ctrl "sigs.k8s.io/controller-runtime"
@@ -145,8 +145,8 @@ func TestReconciler_DeleteAzureAdApplication(t *testing.T) {
145145
}
146146

147147
// asserts that the application exists in the cluster and is valid
148-
func assertApplicationExists(t *testing.T, testName string, name string) *v1alpha1.AzureAdApplication {
149-
instance := &v1alpha1.AzureAdApplication{}
148+
func assertApplicationExists(t *testing.T, testName string, name string) *v1.AzureAdApplication {
149+
instance := &v1.AzureAdApplication{}
150150
key := client.ObjectKey{
151151
Name: name,
152152
Namespace: namespace,
@@ -187,7 +187,7 @@ func assertApplicationExists(t *testing.T, testName string, name string) *v1alph
187187
return instance
188188
}
189189

190-
func assertSecretExists(t *testing.T, name string, instance *v1alpha1.AzureAdApplication) {
190+
func assertSecretExists(t *testing.T, name string, instance *v1.AzureAdApplication) {
191191
t.Run(fmt.Sprintf("Secret '%s'", name), func(t *testing.T) {
192192
key := client.ObjectKey{
193193
Namespace: namespace,
@@ -222,8 +222,8 @@ func resourceDoesNotExist(key client.ObjectKey, instance runtime.Object) func()
222222
}
223223
}
224224

225-
func containsOwnerRef(refs []v1.OwnerReference, owner v1alpha1.AzureAdApplication) bool {
226-
expected := v1.OwnerReference{
225+
func containsOwnerRef(refs []metav1.OwnerReference, owner v1.AzureAdApplication) bool {
226+
expected := metav1.OwnerReference{
227227
APIVersion: owner.APIVersion,
228228
Kind: owner.Kind,
229229
Name: owner.Name,
@@ -254,7 +254,7 @@ func setup() (*envtest.Environment, error) {
254254
return nil, err
255255
}
256256

257-
err = v1alpha1.AddToScheme(scheme.Scheme)
257+
err = v1.AddToScheme(scheme.Scheme)
258258
if err != nil {
259259
return nil, err
260260
}

pkg/azure/client/application.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/nais/azureator/api/v1alpha1"
7+
"github.com/nais/azureator/api/v1"
88
"github.com/nais/azureator/pkg/azure"
99
"github.com/nais/azureator/pkg/azure/util"
1010
"github.com/nais/azureator/pkg/util/crypto"
@@ -135,7 +135,7 @@ func (a application) getAll(ctx context.Context, filters ...azure.Filter) ([]msg
135135
return applications, nil
136136
}
137137

138-
func (a application) defaultTemplate(resource v1alpha1.AzureAdApplication) *msgraph.Application {
138+
func (a application) defaultTemplate(resource v1.AzureAdApplication) *msgraph.Application {
139139
return &msgraph.Application{
140140
DisplayName: ptr.String(resource.GetUniqueName()),
141141
GroupMembershipClaims: ptr.String("SecurityGroup"),

pkg/azure/client/keycredential.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"time"
66

77
"github.com/google/uuid"
8-
"github.com/nais/azureator/api/v1alpha1"
8+
"github.com/nais/azureator/api/v1"
99
"github.com/nais/azureator/pkg/azure"
1010
"github.com/nais/azureator/pkg/azure/util"
1111
"github.com/nais/azureator/pkg/util/crypto"
@@ -63,7 +63,7 @@ func (k keyCredential) mapToKeyCredentials(tx azure.Transaction, keyIdsInUse []s
6363
return append(keyCredentialsInUse, newestCredential), nil
6464
}
6565

66-
func (k keyCredential) new(resource v1alpha1.AzureAdApplication) (*msgraph.KeyCredential, *crypto.JwkPair, error) {
66+
func (k keyCredential) new(resource v1.AzureAdApplication) (*msgraph.KeyCredential, *crypto.JwkPair, error) {
6767
jwkPair, err := crypto.GenerateJwkPair(resource)
6868
if err != nil {
6969
return nil, nil, fmt.Errorf("failed to generate JWK pair for application: %w", err)

pkg/azure/client/preauthorizedapp.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/nais/azureator/api/v1alpha1"
7+
"github.com/nais/azureator/api/v1"
88
"github.com/nais/azureator/pkg/azure"
99
"github.com/nais/azureator/pkg/azure/util"
1010
msgraph "github.com/yaegashi/msgraph.go/v1.0"
@@ -44,7 +44,7 @@ func (p preAuthApps) update(tx azure.Transaction) ([]azure.PreAuthorizedApp, err
4444
return p.mapWithNames(tx.Ctx, preAuthApps)
4545
}
4646

47-
func (p preAuthApps) exists(ctx context.Context, app v1alpha1.AzureAdPreAuthorizedApplication) (bool, error) {
47+
func (p preAuthApps) exists(ctx context.Context, app v1.AzureAdPreAuthorizedApplication) (bool, error) {
4848
return p.application().existsByFilter(ctx, util.FilterByName(app.GetUniqueName()))
4949
}
5050

@@ -68,7 +68,7 @@ func (p preAuthApps) mapToMsGraph(tx azure.Transaction) ([]msgraph.PreAuthorized
6868
return apps, nil
6969
}
7070

71-
func (p preAuthApps) toMsGraph(tx azure.Transaction, app v1alpha1.AzureAdPreAuthorizedApplication) (msgraph.PreAuthorizedApplication, error) {
71+
func (p preAuthApps) toMsGraph(tx azure.Transaction, app v1.AzureAdPreAuthorizedApplication) (msgraph.PreAuthorizedApplication, error) {
7272
clientId, err := p.getClientIdFor(tx.Ctx, app)
7373
if err != nil {
7474
return msgraph.PreAuthorizedApplication{}, err
@@ -94,7 +94,7 @@ func (p preAuthApps) mapWithNames(ctx context.Context, preAuthApps []msgraph.Pre
9494
return a, nil
9595
}
9696

97-
func (p preAuthApps) getClientIdFor(ctx context.Context, app v1alpha1.AzureAdPreAuthorizedApplication) (azure.ClientId, error) {
97+
func (p preAuthApps) getClientIdFor(ctx context.Context, app v1.AzureAdPreAuthorizedApplication) (azure.ClientId, error) {
9898
azureApp, err := p.application().getByName(ctx, app.GetUniqueName())
9999
if err != nil {
100100
return "", fmt.Errorf("failed to get client ID for preauthorized app: %w", err)

pkg/azure/models.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package azure
33
import (
44
"context"
55

6-
"github.com/nais/azureator/api/v1alpha1"
6+
"github.com/nais/azureator/api/v1"
77
log "github.com/sirupsen/logrus"
88
msgraphbeta "github.com/yaegashi/msgraph.go/beta"
99
msgraph "github.com/yaegashi/msgraph.go/v1.0"
@@ -22,7 +22,7 @@ type Client interface {
2222

2323
type Transaction struct {
2424
Ctx context.Context
25-
Instance v1alpha1.AzureAdApplication
25+
Instance v1.AzureAdApplication
2626
Log log.Entry
2727
}
2828

pkg/azure/util/strings.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import (
55
"strings"
66
"time"
77

8-
"github.com/nais/azureator/api/v1alpha1"
8+
"github.com/nais/azureator/api/v1"
99
"github.com/nais/azureator/pkg/azure"
1010
)
1111

12-
func GetReplyUrlsStringSlice(resource v1alpha1.AzureAdApplication) []string {
12+
func GetReplyUrlsStringSlice(resource v1.AzureAdApplication) []string {
1313
var replyUrls []string
1414
for _, v := range resource.Spec.ReplyUrls {
1515
replyUrls = append(replyUrls, v.Url)

pkg/azure/util/strings_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66
"time"
77

8-
"github.com/nais/azureator/api/v1alpha1"
8+
"github.com/nais/azureator/api/v1"
99
"github.com/nais/azureator/pkg/azure"
1010
"github.com/stretchr/testify/assert"
1111
)
@@ -20,14 +20,14 @@ func TestDisplayName(t *testing.T) {
2020

2121
func TestGetReplyUrlsStringSlice(t *testing.T) {
2222
t.Run("Empty Application should return empty slice of reply URLs", func(t *testing.T) {
23-
p := v1alpha1.AzureAdApplication{}
23+
p := v1.AzureAdApplication{}
2424
actual := GetReplyUrlsStringSlice(p)
2525
assert.Empty(t, actual)
2626
})
2727

2828
t.Run("Application with reply URL should return equivalent string slice of reply URLs", func(t *testing.T) {
2929
url := "http://test.host/callback"
30-
p := v1alpha1.AzureAdApplication{Spec: v1alpha1.AzureAdApplicationSpec{ReplyUrls: []v1alpha1.AzureAdReplyUrl{{Url: url}}}}
30+
p := v1.AzureAdApplication{Spec: v1.AzureAdApplicationSpec{ReplyUrls: []v1.AzureAdReplyUrl{{Url: url}}}}
3131
actual := GetReplyUrlsStringSlice(p)
3232
assert.NotEmpty(t, actual)
3333
assert.Len(t, actual, 1)

pkg/fixtures/azure/application.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ package azure
22

33
import (
44
"github.com/google/uuid"
5-
"github.com/nais/azureator/api/v1alpha1"
5+
"github.com/nais/azureator/api/v1"
66
"github.com/nais/azureator/pkg/azure"
77
"github.com/nais/azureator/pkg/util/crypto"
88
"github.com/yaegashi/msgraph.go/ptr"
99
msgraph "github.com/yaegashi/msgraph.go/v1.0"
1010
)
1111

12-
func ExternalAzureApp(instance v1alpha1.AzureAdApplication) msgraph.Application {
12+
func ExternalAzureApp(instance v1.AzureAdApplication) msgraph.Application {
1313
objectId := getOrGenerate(instance.Status.ObjectId)
1414
clientId := getOrGenerate(instance.Status.ClientId)
1515

@@ -22,7 +22,7 @@ func ExternalAzureApp(instance v1alpha1.AzureAdApplication) msgraph.Application
2222
}
2323
}
2424

25-
func InternalAzureApp(instance v1alpha1.AzureAdApplication) azure.Application {
25+
func InternalAzureApp(instance v1.AzureAdApplication) azure.Application {
2626
jwk, err := crypto.GenerateJwkPair(instance)
2727
if err != nil {
2828
panic(err)
@@ -62,15 +62,15 @@ func InternalAzureApp(instance v1alpha1.AzureAdApplication) azure.Application {
6262
}
6363
}
6464

65-
func mapToInternalPreAuthApps(apps []v1alpha1.AzureAdPreAuthorizedApplication) []azure.PreAuthorizedApp {
65+
func mapToInternalPreAuthApps(apps []v1.AzureAdPreAuthorizedApplication) []azure.PreAuthorizedApp {
6666
as := make([]azure.PreAuthorizedApp, 0)
6767
for _, app := range apps {
6868
as = append(as, mapToInternalPreAuthApp(app))
6969
}
7070
return as
7171
}
7272

73-
func mapToInternalPreAuthApp(app v1alpha1.AzureAdPreAuthorizedApplication) azure.PreAuthorizedApp {
73+
func mapToInternalPreAuthApp(app v1.AzureAdPreAuthorizedApplication) azure.PreAuthorizedApp {
7474
clientId := uuid.New().String()
7575
name := getOrGenerate(app.GetUniqueName())
7676
return azure.PreAuthorizedApp{

pkg/fixtures/azure/serviceprincipal.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package azure
22

33
import (
44
"github.com/google/uuid"
5-
"github.com/nais/azureator/api/v1alpha1"
5+
"github.com/nais/azureator/api/v1"
66
msgraphbeta "github.com/yaegashi/msgraph.go/beta"
77
"github.com/yaegashi/msgraph.go/ptr"
88
)
99

10-
func ServicePrincipal(instance v1alpha1.AzureAdApplication) msgraphbeta.ServicePrincipal {
10+
func ServicePrincipal(instance v1.AzureAdApplication) msgraphbeta.ServicePrincipal {
1111
id := uuid.New().String()
1212
return msgraphbeta.ServicePrincipal{
1313
DirectoryObject: msgraphbeta.DirectoryObject{Entity: msgraphbeta.Entity{ID: &id}},

0 commit comments

Comments
 (0)