Skip to content

Commit

Permalink
Add appropriate component label to api-gateway pods
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoleman committed Nov 3, 2023
1 parent c603c56 commit 34db0a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions control-plane/api-gateway/common/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
)

const (
componentLabel = "component"
nameLabel = "gateway.consul.hashicorp.com/name"
namespaceLabel = "gateway.consul.hashicorp.com/namespace"
createdAtLabel = "gateway.consul.hashicorp.com/created"
Expand All @@ -21,6 +22,7 @@ const (
// LabelsForGateway formats the default labels that appear on objects managed by the controllers.
func LabelsForGateway(gateway *gwv1beta1.Gateway) map[string]string {
return map[string]string{
componentLabel: "api-gateway",
nameLabel: gateway.Name,
namespaceLabel: gateway.Namespace,
createdAtLabel: fmt.Sprintf("%d", gateway.CreationTimestamp.Unix()),
Expand Down
2 changes: 2 additions & 0 deletions control-plane/api-gateway/gatekeeper/gatekeeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var (
name = "test"
namespace = "default"
labels = map[string]string{
"component": "api-gateway",
"gateway.consul.hashicorp.com/name": name,
"gateway.consul.hashicorp.com/namespace": namespace,
createdAtLabelKey: createdAtLabelValue,
Expand Down Expand Up @@ -1009,6 +1010,7 @@ func validateResourcesExist(t *testing.T, client client.Client, resources resour
require.EqualValues(t, *expected.Spec.Replicas, *actual.Spec.Replicas)
}
require.Equal(t, expected.Spec.Template.ObjectMeta.Annotations, actual.Spec.Template.ObjectMeta.Annotations)
require.Equal(t, expected.Spec.Template.ObjectMeta.Labels, actual.Spec.Template.Labels)

// Ensure there is a consul-dataplane container dropping ALL capabilities, adding
// back the NET_BIND_SERVICE capability, and establishing a read-only root filesystem
Expand Down

0 comments on commit 34db0a4

Please sign in to comment.