Skip to content

Commit

Permalink
Merge pull request #711 from Kuadrant/662_remove_ocm_dependency
Browse files Browse the repository at this point in the history
feat: Remove ocm dependency from policy controller
  • Loading branch information
openshift-merge-bot[bot] authored Jan 23, 2024
2 parents 2cd2cf6 + 1846155 commit aadac89
Show file tree
Hide file tree
Showing 20 changed files with 881 additions and 572 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
annotations:
alm-examples: '[]'
capabilities: Basic Install
createdAt: "2023-12-08T11:41:09Z"
createdAt: "2023-12-21T13:08:31Z"
operators.operatorframework.io/builder: operator-sdk-v1.28.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
name: multicluster-gateway-controller.v0.0.0
Expand Down Expand Up @@ -349,14 +349,6 @@ spec:
- get
- list
- watch
- apiGroups:
- cluster.open-cluster-management.io
resources:
- managedclusters
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
Expand Down
7 changes: 1 addition & 6 deletions cmd/policy_controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,11 @@ func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
var ocmHub bool
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")

flag.BoolVar(&ocmHub, "ocm-hub", true,
"tells the controller if it is in an ocm hub"+
"setting this to false will cause the controller to stop watching for managedcluster resources")
opts := zap.Options{
Development: true,
}
Expand Down Expand Up @@ -130,7 +125,7 @@ func main() {
BaseReconciler: dnsPolicyBaseReconciler,
},
DNSProvider: provider.DNSProviderFactory,
}).SetupWithManager(mgr, ocmHub); err != nil {
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "DNSPolicy")
os.Exit(1)
}
Expand Down
8 changes: 0 additions & 8 deletions config/policy-controller/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ rules:
- get
- list
- watch
- apiGroups:
- cluster.open-cluster-management.io
resources:
- managedclusters
verbs:
- get
- list
- watch
- apiGroups:
- gateway.networking.k8s.io
resources:
Expand Down
3 changes: 1 addition & 2 deletions hack/make/policy_controller.make
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ run-policy-controller: manifests generate fmt vet install
go run ./cmd/policy_controller/main.go \
--metrics-bind-address=:8090 \
--health-probe-bind-address=:8091 \
--zap-log-level=$(LOG_LEVEL) \
--ocm-hub=$(OCM)
--zap-log-level=$(LOG_LEVEL)

.PHONY: docker-build-policy-controller
docker-build-policy-controller: ## Build docker image with the controller.
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/dnspolicy/dns_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func (dh *dnsHelper) getSimpleEndpoints(mcgTarget *dns.MultiClusterGatewayTarget
)

for _, cgwTarget := range mcgTarget.ClusterGatewayTargets {
for _, gwa := range cgwTarget.GatewayAddresses {
for _, gwa := range cgwTarget.Status.Addresses {
if *gwa.Type == gatewayapiv1.IPAddressType {
ipValues = append(ipValues, gwa.Value)
} else {
Expand Down Expand Up @@ -273,7 +273,7 @@ func (dh *dnsHelper) getLoadBalancedEndpoints(mcgTarget *dns.MultiClusterGateway

var ipValues []string
var hostValues []string
for _, gwa := range cgwTarget.GatewayAddresses {
for _, gwa := range cgwTarget.Status.Addresses {
if *gwa.Type == gatewayapiv1.IPAddressType {
ipValues = append(ipValues, gwa.Value)
} else {
Expand Down
Loading

0 comments on commit aadac89

Please sign in to comment.