Skip to content

Commit

Permalink
Extract depresolver interface
Browse files Browse the repository at this point in the history
close #908

- extracting interface GslbResolver
- GslbResolver Mock
- refactor Reconciler

Signed-off-by: kuritka <kuritka@gmail.com>
  • Loading branch information
kuritka committed Jun 21, 2022
1 parent 5ac60ce commit 46a6b87
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ mocks:
mockgen -source=controllers/providers/assistant/assistant.go -destination=controllers/providers/assistant/assistant_mock.go -package=assistant
mockgen -source=controllers/providers/dns/dns.go -destination=controllers/providers/dns/dns_mock.go -package=dns
mockgen -source=controllers/providers/dns/infoblox-client.go -destination=controllers/providers/dns/infoblox-client_mock.go -package=dns
mockgen -source=controllers/depresolver/resolver.go -destination=controllers/depresolver/resolver_mock.go -package=depresolver
mockgen -destination=controllers/providers/dns/infoblox-connection_mock.go -package=dns github.com/infobloxopen/infoblox-go-client IBConnector
$(call golic)

Expand Down
21 changes: 20 additions & 1 deletion controllers/depresolver/resolver.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
package depresolver

/*
Copyright 2022 The k8gb Contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic
*/

import (
"context"

k8gbv1beta1 "github.com/k8gb-io/k8gb/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
)

type Resolver interface {
type GslbResolver interface {
// ResolveOperatorConfig executes once. It reads operator's configuration
// from environment variables into &Config and validates
ResolveOperatorConfig() (*Config, error)
Expand Down
84 changes: 84 additions & 0 deletions controllers/depresolver/resolver_mock.go

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

2 changes: 1 addition & 1 deletion controllers/gslb_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type GslbReconciler struct {
client.Client
Scheme *runtime.Scheme
Config *depresolver.Config
DepResolver *depresolver.DependencyResolver
DepResolver depresolver.GslbResolver
DNSProvider dns.Provider
}

Expand Down

0 comments on commit 46a6b87

Please sign in to comment.