Skip to content

Commit 8ba9b55

Browse files
authored
envknob,kube/kubetypes,cmd/k8s-operator: add app type for ProxyGroup (tailscale#14029)
Sets a custom hostinfo app type for ProxyGroup replicas, similarly to how we do it for all other Kubernetes Operator managed components. Updates tailscale#13406,tailscale/corp#22920 Signed-off-by: Irbe Krumina <[email protected]>
1 parent 8dcbd98 commit 8ba9b55

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

cmd/k8s-operator/proxygroup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const (
4747
reasonProxyGroupInvalid = "ProxyGroupInvalid"
4848
)
4949

50-
var gaugeProxyGroupResources = clientmetric.NewGauge(kubetypes.MetricProxyGroupCount)
50+
var gaugeProxyGroupResources = clientmetric.NewGauge(kubetypes.MetricProxyGroupEgressCount)
5151

5252
// ProxyGroupReconciler ensures cluster resources for a ProxyGroup definition.
5353
type ProxyGroupReconciler struct {

cmd/k8s-operator/proxygroup_specs.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"sigs.k8s.io/yaml"
1616
tsapi "tailscale.com/k8s-operator/apis/v1alpha1"
1717
"tailscale.com/kube/egressservices"
18+
"tailscale.com/kube/kubetypes"
1819
"tailscale.com/types/ptr"
1920
)
2021

@@ -146,6 +147,10 @@ func pgStatefulSet(pg *tsapi.ProxyGroup, namespace, image, tsFirewallMode, cfgHa
146147
Name: "TS_USERSPACE",
147148
Value: "false",
148149
},
150+
{
151+
Name: "TS_INTERNAL_APP",
152+
Value: kubetypes.AppProxyGroupEgress,
153+
},
149154
}
150155

151156
if tsFirewallMode != "" {

envknob/envknob.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ func TKASkipSignatureCheck() bool { return Bool("TS_UNSAFE_SKIP_NKS_VERIFICATION
411411
// Kubernetes Operator components.
412412
func App() string {
413413
a := os.Getenv("TS_INTERNAL_APP")
414-
if a == kubetypes.AppConnector || a == kubetypes.AppEgressProxy || a == kubetypes.AppIngressProxy || a == kubetypes.AppIngressResource {
414+
if a == kubetypes.AppConnector || a == kubetypes.AppEgressProxy || a == kubetypes.AppIngressProxy || a == kubetypes.AppIngressResource || a == kubetypes.AppProxyGroupEgress || a == kubetypes.AppProxyGroupIngress {
415415
return a
416416
}
417417
return ""

kube/kubetypes/metrics.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ package kubetypes
55

66
const (
77
// Hostinfo App values for the Tailscale Kubernetes Operator components.
8-
AppOperator = "k8s-operator"
9-
AppAPIServerProxy = "k8s-operator-proxy"
10-
AppIngressProxy = "k8s-operator-ingress-proxy"
11-
AppIngressResource = "k8s-operator-ingress-resource"
12-
AppEgressProxy = "k8s-operator-egress-proxy"
13-
AppConnector = "k8s-operator-connector-resource"
8+
AppOperator = "k8s-operator"
9+
AppAPIServerProxy = "k8s-operator-proxy"
10+
AppIngressProxy = "k8s-operator-ingress-proxy"
11+
AppIngressResource = "k8s-operator-ingress-resource"
12+
AppEgressProxy = "k8s-operator-egress-proxy"
13+
AppConnector = "k8s-operator-connector-resource"
14+
AppProxyGroupEgress = "k8s-operator-proxygroup-egress"
15+
AppProxyGroupIngress = "k8s-operator-proxygroup-ingress"
1416

1517
// Clientmetrics for Tailscale Kubernetes Operator components
1618
MetricIngressProxyCount = "k8s_ingress_proxies" // L3
@@ -22,5 +24,6 @@ const (
2224
MetricNameserverCount = "k8s_nameserver_resources"
2325
MetricRecorderCount = "k8s_recorder_resources"
2426
MetricEgressServiceCount = "k8s_egress_service_resources"
25-
MetricProxyGroupCount = "k8s_proxygroup_resources"
27+
MetricProxyGroupEgressCount = "k8s_proxygroup_egress_resources"
28+
MetricProxyGroupIngressCount = "k8s_proxygroup_ingress_resources"
2629
)

0 commit comments

Comments
 (0)