Skip to content

Commit

Permalink
update: review comments use const
Browse files Browse the repository at this point in the history
Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw committed Oct 14, 2024
1 parent 2d7737b commit 61f43f8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func main() { //nolint:funlen,maintidx
},
// For authentication CR "cluster"
&configv1.Authentication{}: {
Field: fields.Set{"metadata.name": "cluster"}.AsSelector(),
Field: fields.Set{"metadata.name": cluster.ClusterAuthenticationObj}.AsSelector(),
},
// for prometheus and black-box deployment and ones we owns
&appsv1.Deployment{}: {Namespaces: deploymentCache},
Expand Down
4 changes: 2 additions & 2 deletions pkg/cluster/cluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ func getRelease(ctx context.Context, cli client.Client) (Release, error) {
// This will give indication that Operator should create userGroups or not in the cluster.
func IsDefaultAuthMethod(ctx context.Context, cli client.Client) (bool, error) {
authenticationobj := &configv1.Authentication{}
if err := cli.Get(ctx, client.ObjectKey{Name: "cluster", Namespace: ""}, authenticationobj); err != nil {
if err := cli.Get(ctx, client.ObjectKey{Name: ClusterAuthenticationObj, Namespace: ""}, authenticationobj); err != nil {
if errors.Is(err, &meta.NoKindMatchError{}) { // when CRD is missing, conver error type
return false, k8serr.NewNotFound(configv1.Resource("authentications"), "cluster")
return false, k8serr.NewNotFound(configv1.Resource("authentications"), ClusterAuthenticationObj)

Check warning on line 236 in pkg/cluster/cluster_config.go

View check run for this annotation

Codecov / codecov/patch

pkg/cluster/cluster_config.go#L232-L236

Added lines #L232 - L236 were not covered by tests
}
return false, err

Check warning on line 238 in pkg/cluster/cluster_config.go

View check run for this annotation

Codecov / codecov/patch

pkg/cluster/cluster_config.go#L238

Added line #L238 was not covered by tests
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/cluster/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ const (

// DefaultNotebooksNamespace defines default namespace for notebooks.
DefaultNotebooksNamespace = "rhods-notebooks"

// Default cluster-scope Authentication CR name.
ClusterAuthenticationObj = "cluster"
)

0 comments on commit 61f43f8

Please sign in to comment.