-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds Support for Gateway Status Addresses
Signed-off-by: danehans <daneyonhansen@gmail.com>
- Loading branch information
Showing
17 changed files
with
268 additions
and
100 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package kubernetes | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// envoyPodSelector returns a label selector used to select Envoy resources. | ||
func envoyPodSelector(gwLabels map[string]string) *metav1.LabelSelector { | ||
return &metav1.LabelSelector{ | ||
MatchLabels: envoyLabels(gwLabels), | ||
} | ||
} | ||
|
||
// envoyLabels returns the labels applied to managed Envoy resources. | ||
func envoyLabels(gwLabels map[string]string) map[string]string { | ||
ret := map[string]string{ | ||
"app": "envoy", | ||
} | ||
|
||
for k, v := range gwLabels { | ||
ret[k] = v | ||
} | ||
|
||
return ret | ||
} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package kubernetes | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestEnvoyPodSelector(t *testing.T) { | ||
cases := []struct { | ||
name string | ||
in map[string]string | ||
expected map[string]string | ||
}{ | ||
{ | ||
name: "default", | ||
in: map[string]string{ | ||
"foo": "bar", | ||
}, | ||
expected: map[string]string{ | ||
"app": "envoy", | ||
"foo": "bar", | ||
}, | ||
}, | ||
} | ||
|
||
for _, tc := range cases { | ||
t.Run("", func(t *testing.T) { | ||
got := envoyPodSelector(tc.in) | ||
require.Equal(t, tc.expected, got.MatchLabels) | ||
}) | ||
} | ||
} |
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
Oops, something went wrong.