-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor constants from internal/..
to pkg/common
package.
#3171
Merged
Merged
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3b44917
Refactor constants
super-harsh eb6244f
Update comment
super-harsh 492e474
Add header
super-harsh 16c386e
Get public facing constants for reconcile policy
super-harsh bf3c765
Update test const references
super-harsh a2e9c6d
Move common constants to respective packages
super-harsh f5354e6
fix ref
super-harsh c5b2607
Merge branch 'main' into refactor/constants
super-harsh 0a0a467
Merge branch 'main' into refactor/constants
super-harsh 41ee7b3
Refactor to move reconcilePolicy to common.annotations
super-harsh caa6da8
Merge branch 'main' into refactor/constants
super-harsh 8b044bc
Move reconcilePolicy annotations to reconcile_policy.go
super-harsh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -23,10 +23,10 @@ import ( | |||||||||
"github.com/Azure/azure-service-operator/v2/internal/config" | ||||||||||
"github.com/Azure/azure-service-operator/v2/internal/identity" | ||||||||||
"github.com/Azure/azure-service-operator/v2/internal/metrics" | ||||||||||
"github.com/Azure/azure-service-operator/v2/internal/reconcilers" | ||||||||||
"github.com/Azure/azure-service-operator/v2/internal/resolver" | ||||||||||
"github.com/Azure/azure-service-operator/v2/internal/util/kubeclient" | ||||||||||
"github.com/Azure/azure-service-operator/v2/internal/util/to" | ||||||||||
"github.com/Azure/azure-service-operator/v2/pkg/common" | ||||||||||
"github.com/Azure/azure-service-operator/v2/pkg/genruntime/core" | ||||||||||
) | ||||||||||
|
||||||||||
|
@@ -141,7 +141,7 @@ func Test_ARMClientCache_ReturnsPerResourceScopedClientOverNamespacedClient(t *t | |||||||||
g.Expect(err).ToNot(HaveOccurred()) | ||||||||||
|
||||||||||
rg := newResourceGroup("test-namespace") | ||||||||||
rg.Annotations = map[string]string{reconcilers.PerResourceSecretAnnotation: perResourceCredentialName.Name} | ||||||||||
rg.Annotations = map[string]string{common.PerResourceSecretAnnotation: perResourceCredentialName.Name} | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer if we spread these literal maps across multiple lines, as we already typically do elsewhere.
Suggested change
|
||||||||||
err = res.kubeClient.Create(ctx, rg) | ||||||||||
g.Expect(err).ToNot(HaveOccurred()) | ||||||||||
|
||||||||||
|
@@ -173,7 +173,7 @@ func Test_ARMClientCache_PerResourceSecretInDifferentNamespace_ReturnsError(t *t | |||||||||
g.Expect(err).ToNot(HaveOccurred()) | ||||||||||
|
||||||||||
rg := newResourceGroup("test-namespace") | ||||||||||
rg.Annotations = map[string]string{reconcilers.PerResourceSecretAnnotation: perResourceCredentialName.String()} | ||||||||||
rg.Annotations = map[string]string{common.PerResourceSecretAnnotation: perResourceCredentialName.String()} | ||||||||||
err = res.kubeClient.Create(ctx, rg) | ||||||||||
g.Expect(err).ToNot(HaveOccurred()) | ||||||||||
|
||||||||||
|
@@ -198,7 +198,7 @@ func Test_ARMClientCache_ReturnsError_IfSecretNotFound(t *testing.T) { | |||||||||
} | ||||||||||
|
||||||||||
rg := newResourceGroup("") | ||||||||||
rg.Annotations = map[string]string{reconcilers.PerResourceSecretAnnotation: credentialNamespacedName.Name} | ||||||||||
rg.Annotations = map[string]string{common.PerResourceSecretAnnotation: credentialNamespacedName.Name} | ||||||||||
err = res.kubeClient.Create(ctx, rg) | ||||||||||
g.Expect(err).ToNot(HaveOccurred()) | ||||||||||
|
||||||||||
|
@@ -229,7 +229,7 @@ func Test_ARMClientCache_ReturnsPerResourceScopedClient(t *testing.T) { | |||||||||
g.Expect(err).ToNot(HaveOccurred()) | ||||||||||
|
||||||||||
rg := newResourceGroup("test-namespace") | ||||||||||
rg.Annotations = map[string]string{reconcilers.PerResourceSecretAnnotation: credentialNamespacedName.Name} | ||||||||||
rg.Annotations = map[string]string{common.PerResourceSecretAnnotation: credentialNamespacedName.Name} | ||||||||||
err = res.kubeClient.Create(ctx, rg) | ||||||||||
g.Expect(err).ToNot(HaveOccurred()) | ||||||||||
|
||||||||||
|
@@ -305,7 +305,7 @@ func Test_ARMClientCache_ReturnsNamespaceScopedClient_SecretChanged(t *testing.T | |||||||||
|
||||||||||
// change secret and check if we get a new client | ||||||||||
old := secret | ||||||||||
secret.Data[config.ClientIDVar] = []byte("11111111-1111-1111-1111-111111111111") | ||||||||||
secret.Data[common.ClientIDVar] = []byte("11111111-1111-1111-1111-111111111111") | ||||||||||
err = res.kubeClient.Patch(ctx, secret, MergeFrom(old)) | ||||||||||
g.Expect(err).ToNot(HaveOccurred()) | ||||||||||
|
||||||||||
|
@@ -339,10 +339,10 @@ func Test_ARMClientCache_ReturnsGlobalClient(t *testing.T) { | |||||||||
|
||||||||||
func newSecret(namespacedName types.NamespacedName) *v1.Secret { | ||||||||||
secretData := make(map[string][]byte) | ||||||||||
secretData[config.ClientIDVar] = []byte(fakeID) | ||||||||||
secretData[config.ClientSecretVar] = []byte(fakeID) | ||||||||||
secretData[config.TenantIDVar] = []byte(fakeID) | ||||||||||
secretData[config.SubscriptionIDVar] = []byte(fakeID) | ||||||||||
secretData[common.ClientIDVar] = []byte(fakeID) | ||||||||||
secretData[common.ClientSecretVar] = []byte(fakeID) | ||||||||||
secretData[common.TenantIDVar] = []byte(fakeID) | ||||||||||
secretData[common.SubscriptionIDVar] = []byte(fakeID) | ||||||||||
|
||||||||||
return &v1.Secret{ | ||||||||||
ObjectMeta: metav1.ObjectMeta{ | ||||||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll beat @matthchr to this (because he always catches me out) - move this into the import group for local packages, just below.