Skip to content

Commit bcc883d

Browse files
authored
Merge pull request #479 from kagenti/fix/sunset-client-registration-sidecar
Chore: sunset client-registration sidecar — remove legacy opt-in label
2 parents dfe5b6f + e526513 commit bcc883d

6 files changed

Lines changed: 0 additions & 60 deletions

File tree

kagenti-operator/internal/clientreg/names.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ import (
1919
)
2020

2121
const (
22-
// LabelClientRegistrationInject: when "true", the workload opts into the legacy
23-
// client-registration sidecar and operator-managed registration is skipped.
24-
LabelClientRegistrationInject = "kagenti.io/client-registration-inject"
25-
2622
// LabelAgentType distinguishes agents from tools; operator-managed registration runs for
2723
// agents unconditionally and for tools only when the injectTools feature gate is on.
2824
LabelAgentType = "kagenti.io/type"
@@ -55,9 +51,6 @@ func SkipReason(labels map[string]string, injectTools bool) string {
5551
if labels == nil {
5652
return "pod template has no labels"
5753
}
58-
if labels[LabelClientRegistrationInject] == "true" {
59-
return fmt.Sprintf("%s is \"true\" (legacy webhook client-registration sidecar; operator-managed registration disabled for this workload)", LabelClientRegistrationInject)
60-
}
6154
switch labels[LabelAgentType] {
6255
case LabelValueAgent:
6356
return ""

kagenti-operator/internal/clientreg/names_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ func TestSkipReason(t *testing.T) {
4646
}{
4747
{"nil labels", nil, true, true},
4848
{"empty labels", map[string]string{}, true, true},
49-
{"legacy sidecar opt-in", map[string]string{LabelClientRegistrationInject: "true", LabelAgentType: LabelValueAgent}, true, true},
5049
{"agent proceeds", map[string]string{LabelAgentType: LabelValueAgent}, false, false},
5150
{"tool with gate on proceeds", map[string]string{LabelAgentType: LabelValueTool}, true, false},
5251
{"tool with gate off skipped", map[string]string{LabelAgentType: LabelValueTool}, false, true},

kagenti-operator/internal/controller/clientregistration_controller.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ const (
4545
// keycloakInitialAdminSecret is the RHBK-managed secret with keys "username"/"password".
4646
keycloakInitialAdminSecret = "keycloak-initial-admin"
4747

48-
// LabelClientRegistrationInject: when not "true", the operator registers the OAuth client and sets
49-
// AnnotationKeycloakClientSecretName. Value "true" opts the workload into the legacy webhook
50-
// client-registration sidecar; the operator skips registration for that workload.
51-
// Re-exported from internal/clientreg so existing callers keep working.
52-
LabelClientRegistrationInject = clientreg.LabelClientRegistrationInject
53-
5448
// AnnotationKeycloakClientSecretName must match kagenti-webhook injector.AnnotationKeycloakClientSecretName.
5549
// Re-exported from internal/clientreg to give both the controller and the webhook one source of truth.
5650
AnnotationKeycloakClientSecretName = clientreg.AnnotationKeycloakClientSecretName

kagenti-operator/internal/controller/clientregistration_controller_test.go

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,6 @@ func TestWorkloadWantsOperatorClientReg(t *testing.T) {
4444
},
4545
want: true,
4646
},
47-
{
48-
name: "agent with legacy sidecar opt-in — operator skips",
49-
labels: map[string]string{
50-
LabelAgentType: LabelValueAgent,
51-
LabelClientRegistrationInject: "true",
52-
},
53-
want: false,
54-
},
55-
{
56-
name: "agent explicit false — same as default (operator-managed)",
57-
labels: map[string]string{
58-
LabelAgentType: LabelValueAgent,
59-
LabelClientRegistrationInject: "false",
60-
},
61-
want: true,
62-
},
6347
{
6448
name: "tool default with injectTools",
6549
labels: map[string]string{
@@ -76,15 +60,6 @@ func TestWorkloadWantsOperatorClientReg(t *testing.T) {
7660
injectTools: false,
7761
want: false,
7862
},
79-
{
80-
name: "tool with legacy opt-in — operator skips regardless of injectTools",
81-
labels: map[string]string{
82-
LabelAgentType: string(agentv1alpha1.RuntimeTypeTool),
83-
LabelClientRegistrationInject: "true",
84-
},
85-
injectTools: true,
86-
want: false,
87-
},
8863
}
8964
for _, tc := range cases {
9065
t.Run(tc.name, func(t *testing.T) {

kagenti-operator/internal/webhook/injector/constants.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ const (
55
// Per-sidecar workload labels — set value to "false" to disable injection
66
LabelEnvoyProxyInject = "kagenti.io/envoy-proxy-inject"
77
LabelSpiffeHelperInject = "kagenti.io/spiffe-helper-inject"
8-
9-
// LabelClientRegistrationInject — legacy sidecar opt-in: set to "true" to inject;
10-
// default is operator-managed Keycloak credentials (no sidecar).
11-
LabelClientRegistrationInject = "kagenti.io/client-registration-inject"
128
)
139

1410
// AuthBridge deployment modes. Selected via the namespace

kagenti-operator/internal/webhook/v1alpha1/authbridge_webhook_test.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -309,23 +309,6 @@ var _ = Describe("AuthBridge Pod Webhook", func() {
309309
Expect(pod.Annotations).NotTo(HaveKey(injector.AnnotationKeycloakClientSecretName))
310310
})
311311

312-
It("skips workloads opted into the legacy client-registration sidecar", func() {
313-
createAgentRuntime(testNamespace, "prepop-legacy")
314-
315-
pod := newTestPod("prepop-legacy", map[string]string{
316-
"kagenti.io/type": "agent",
317-
"kagenti.io/inject": "enabled",
318-
"kagenti.io/client-registration-inject": "true",
319-
})
320-
321-
err := k8sClient.Create(ctx, pod)
322-
Expect(err).NotTo(HaveOccurred())
323-
324-
err = k8sClient.Get(ctx, client.ObjectKeyFromObject(pod), pod)
325-
Expect(err).NotTo(HaveOccurred())
326-
327-
Expect(pod.Annotations).NotTo(HaveKey(injector.AnnotationKeycloakClientSecretName))
328-
})
329312
})
330313
})
331314

0 commit comments

Comments
 (0)