Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions kagenti-operator/internal/clientreg/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ import (
)

const (
// LabelClientRegistrationInject: when "true", the workload opts into the legacy
// client-registration sidecar and operator-managed registration is skipped.
LabelClientRegistrationInject = "kagenti.io/client-registration-inject"

// LabelAgentType distinguishes agents from tools; operator-managed registration runs for
// agents unconditionally and for tools only when the injectTools feature gate is on.
LabelAgentType = "kagenti.io/type"
Expand Down Expand Up @@ -55,9 +51,6 @@ func SkipReason(labels map[string]string, injectTools bool) string {
if labels == nil {
return "pod template has no labels"
}
if labels[LabelClientRegistrationInject] == "true" {
return fmt.Sprintf("%s is \"true\" (legacy webhook client-registration sidecar; operator-managed registration disabled for this workload)", LabelClientRegistrationInject)
}
switch labels[LabelAgentType] {
case LabelValueAgent:
return ""
Expand Down
1 change: 0 additions & 1 deletion kagenti-operator/internal/clientreg/names_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func TestSkipReason(t *testing.T) {
}{
{"nil labels", nil, true, true},
{"empty labels", map[string]string{}, true, true},
{"legacy sidecar opt-in", map[string]string{LabelClientRegistrationInject: "true", LabelAgentType: LabelValueAgent}, true, true},
{"agent proceeds", map[string]string{LabelAgentType: LabelValueAgent}, false, false},
{"tool with gate on proceeds", map[string]string{LabelAgentType: LabelValueTool}, true, false},
{"tool with gate off skipped", map[string]string{LabelAgentType: LabelValueTool}, false, true},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ const (
// keycloakInitialAdminSecret is the RHBK-managed secret with keys "username"/"password".
keycloakInitialAdminSecret = "keycloak-initial-admin"

// LabelClientRegistrationInject: when not "true", the operator registers the OAuth client and sets
// AnnotationKeycloakClientSecretName. Value "true" opts the workload into the legacy webhook
// client-registration sidecar; the operator skips registration for that workload.
// Re-exported from internal/clientreg so existing callers keep working.
LabelClientRegistrationInject = clientreg.LabelClientRegistrationInject

// AnnotationKeycloakClientSecretName must match kagenti-webhook injector.AnnotationKeycloakClientSecretName.
// Re-exported from internal/clientreg to give both the controller and the webhook one source of truth.
AnnotationKeycloakClientSecretName = clientreg.AnnotationKeycloakClientSecretName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,6 @@ func TestWorkloadWantsOperatorClientReg(t *testing.T) {
},
want: true,
},
{
name: "agent with legacy sidecar opt-in — operator skips",
labels: map[string]string{
LabelAgentType: LabelValueAgent,
LabelClientRegistrationInject: "true",
},
want: false,
},
{
name: "agent explicit false — same as default (operator-managed)",
labels: map[string]string{
LabelAgentType: LabelValueAgent,
LabelClientRegistrationInject: "false",
},
want: true,
},
{
name: "tool default with injectTools",
labels: map[string]string{
Expand All @@ -76,15 +60,6 @@ func TestWorkloadWantsOperatorClientReg(t *testing.T) {
injectTools: false,
want: false,
},
{
name: "tool with legacy opt-in — operator skips regardless of injectTools",
labels: map[string]string{
LabelAgentType: string(agentv1alpha1.RuntimeTypeTool),
LabelClientRegistrationInject: "true",
},
injectTools: true,
want: false,
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
Expand Down
4 changes: 0 additions & 4 deletions kagenti-operator/internal/webhook/injector/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ const (
// Per-sidecar workload labels — set value to "false" to disable injection
LabelEnvoyProxyInject = "kagenti.io/envoy-proxy-inject"
LabelSpiffeHelperInject = "kagenti.io/spiffe-helper-inject"

// LabelClientRegistrationInject — legacy sidecar opt-in: set to "true" to inject;
// default is operator-managed Keycloak credentials (no sidecar).
LabelClientRegistrationInject = "kagenti.io/client-registration-inject"
)

// AuthBridge deployment modes. Selected via the namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,23 +309,6 @@ var _ = Describe("AuthBridge Pod Webhook", func() {
Expect(pod.Annotations).NotTo(HaveKey(injector.AnnotationKeycloakClientSecretName))
})

It("skips workloads opted into the legacy client-registration sidecar", func() {
createAgentRuntime(testNamespace, "prepop-legacy")

pod := newTestPod("prepop-legacy", map[string]string{
"kagenti.io/type": "agent",
"kagenti.io/inject": "enabled",
"kagenti.io/client-registration-inject": "true",
})

err := k8sClient.Create(ctx, pod)
Expect(err).NotTo(HaveOccurred())

err = k8sClient.Get(ctx, client.ObjectKeyFromObject(pod), pod)
Expect(err).NotTo(HaveOccurred())

Expect(pod.Annotations).NotTo(HaveKey(injector.AnnotationKeycloakClientSecretName))
})
})
})

Expand Down
Loading