Skip to content

Commit

Permalink
kie-issues-308: Operator driven service discovery API Phase2
Browse files Browse the repository at this point in the history
    - Add the discovery of kubernetes Deployment, StatefulSet, and Ingress objects to the service discovery API.
  • Loading branch information
wmedvede committed Nov 22, 2023
1 parent 27c0542 commit 74dc9b9
Show file tree
Hide file tree
Showing 16 changed files with 1,093 additions and 407 deletions.
40 changes: 22 additions & 18 deletions controllers/discovery/discovery.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
// Copyright 2023 Red Hat, Inc. and/or its affiliates
//
// 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.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

package discovery

Expand All @@ -27,9 +32,6 @@ const (
KubernetesScheme = "kubernetes"
OpenshiftScheme = "openshift"

// PortLabel well known label name to select a particular target port
PortLabel = "port"

// KubernetesDNSAddress use this output format with kubernetes services and pods to resolve to the corresponding
// kubernetes DNS name. see: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
KubernetesDNSAddress = "KubernetesDNSAddress"
Expand Down Expand Up @@ -57,6 +59,7 @@ type ResourceUri struct {
GVK v1.GroupVersionKind
Namespace string
Name string
Port string
CustomLabels map[string]string
}

Expand Down Expand Up @@ -166,11 +169,12 @@ func (r *ResourceUri) GetLabel(name string) string {
}

func (r *ResourceUri) SetPort(value string) *ResourceUri {
return r.AddLabel(PortLabel, value)
r.Port = value
return r
}

func (r *ResourceUri) GetPort() string {
return r.GetLabel(PortLabel)
return r.Port
}

func (r *ResourceUri) String() string {
Expand Down
Loading

0 comments on commit 74dc9b9

Please sign in to comment.