Skip to content

Commit a5c6cc2

Browse files
committed
Not just render oidc env-vars when cfg is on, we need also a present audience to ensure the camel containers work correct (knative#8448)
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
1 parent 2b5c338 commit a5c6cc2

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

pkg/reconciler/integration/source/integrationsource.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, source *v1alpha1.Integra
7878
}
7979

8080
func (r *Reconciler) reconcileContainerSource(ctx context.Context, source *v1alpha1.IntegrationSource) (*v1.ContainerSource, error) {
81-
expected := resources.NewContainerSource(source, feature.FromContext(ctx).IsOIDCAuthentication())
81+
// set the OIDC to true only if the feature is enabled and the sink audience is set
82+
// to prevent container environment vars to be set, just when the config is on.
83+
expected := resources.NewContainerSource(source, feature.FromContext(ctx).IsOIDCAuthentication() && source.Status.SinkAudience != nil)
8284

8385
cs, err := r.containerSourceLister.ContainerSources(source.Namespace).Get(expected.Name)
8486
if apierrors.IsNotFound(err) {

pkg/reconciler/integration/source/integrationsource_test.go

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func TestReconcile(t *testing.T) {
189189
WithIntegrationSourceSpec(makeIntegrationSourceSpec(sinkDest)),
190190
WithInitIntegrationSourceConditions,
191191
WithIntegrationSourceStatusObservedGeneration(generation),
192-
WithIntegrationSourcePropagateContainerSourceStatus(makeContainerSourceStatus(&conditionTrue)),
192+
WithIntegrationSourcePropagateContainerSourceStatus(makeContainerSourceStatusOIDC(&conditionTrue)),
193193
WithIntegrationSourceOIDCServiceAccountName(getOIDCServiceAccountNameForContainerSource()),
194194
),
195195
}},
@@ -218,39 +218,6 @@ func TestReconcile(t *testing.T) {
218218

219219
func makeContainerSourceOIDC(source *sourcesv1alpha1.IntegrationSource, ready *corev1.ConditionStatus) *sourcesv1.ContainerSource {
220220
cs := makeContainerSource(source, ready)
221-
222-
// replace all env_vars for inserting the OIDC ones at the right order/index
223-
cs.Spec.Template.Spec.Containers[0].Env = []corev1.EnvVar{
224-
{
225-
Name: "CAMEL_KNATIVE_CLIENT_SSL_ENABLED",
226-
Value: "true",
227-
},
228-
{
229-
Name: "CAMEL_KNATIVE_CLIENT_SSL_CERT_PATH",
230-
Value: "/knative-custom-certs/knative-eventing-bundle.pem",
231-
},
232-
{
233-
Name: "CAMEL_KNATIVE_CLIENT_OIDC_ENABLED",
234-
Value: "true",
235-
},
236-
{
237-
Name: "CAMEL_KNATIVE_CLIENT_OIDC_TOKEN_PATH",
238-
Value: "file:///oidc/token",
239-
},
240-
{
241-
Name: "CAMEL_KAMELET_TIMER_SOURCE_PERIOD",
242-
Value: "1000",
243-
},
244-
{
245-
Name: "CAMEL_KAMELET_TIMER_SOURCE_MESSAGE",
246-
Value: "Hallo",
247-
},
248-
{
249-
Name: "CAMEL_KAMELET_TIMER_SOURCE_REPEATCOUNT",
250-
Value: "0",
251-
},
252-
}
253-
254221
cs.Status = *makeContainerSourceStatusOIDC(ready)
255222

256223
return cs

0 commit comments

Comments
 (0)