Skip to content

Commit

Permalink
Merge pull request #3669 from nelljerram/gateway-api-fix-321
Browse files Browse the repository at this point in the history
Allow operator to create secrets in tigera-gateway namespace
  • Loading branch information
tmjd authored Dec 20, 2024
2 parents 2714b1e + df6c919 commit 7b01da4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/controller/gatewayapi/gatewayapi_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func (r *ReconcileGatewayAPI) Reconcile(ctx context.Context, request reconcile.R
}
err = utils.NewComponentHandler(log, r.client, r.scheme, gatewayAPI).CreateOrUpdateOrDelete(ctx, nonCRDComponent, r.status)
if err != nil {
r.status.SetDegraded(operatorv1.ResourceCreateError, "Error rendering GatewayAPI CRDs", err, log)
r.status.SetDegraded(operatorv1.ResourceCreateError, "Error rendering GatewayAPI resources", err, log)
return reconcile.Result{}, err
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/render/gateway_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ func (pr *gatewayAPIImplementationComponent) Objects() ([]client.Object, []clien
),
}

// Create role binding to allow creating secrets in our namespace.
objs = append(objs, CreateOperatorSecretsRoleBinding(resources.namespace.Name))

// Add pull secrets (inferred from the Installation resource).
objs = append(objs, secret.ToRuntimeObjects(secret.CopyToNamespace(resources.namespace.Name, pr.cfg.PullSecrets...)...)...)

Expand Down
2 changes: 2 additions & 0 deletions pkg/render/gateway_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ var _ = Describe("Gateway API rendering tests", func() {
Expect(objsToDelete).To(HaveLen(0))
rtest.ExpectResources(objsToCreate, []client.Object{
&corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "tigera-gateway"}},
&rbacv1.RoleBinding{ObjectMeta: metav1.ObjectMeta{Name: "tigera-operator-secrets", Namespace: "tigera-gateway"}},
&corev1.ServiceAccount{ObjectMeta: metav1.ObjectMeta{Name: "envoy-gateway", Namespace: "tigera-gateway"}},
&corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Name: "envoy-gateway-config", Namespace: "tigera-gateway"}},
&rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "tigera-gateway-api-gateway-helm-envoy-gateway-role"}},
Expand Down Expand Up @@ -257,6 +258,7 @@ var _ = Describe("Gateway API rendering tests", func() {
Expect(objsToDelete).To(HaveLen(0))
rtest.ExpectResources(objsToCreate, []client.Object{
&corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: "tigera-gateway"}},
&rbacv1.RoleBinding{ObjectMeta: metav1.ObjectMeta{Name: "tigera-operator-secrets", Namespace: "tigera-gateway"}},
&corev1.ServiceAccount{ObjectMeta: metav1.ObjectMeta{Name: "envoy-gateway", Namespace: "tigera-gateway"}},
&corev1.ConfigMap{ObjectMeta: metav1.ObjectMeta{Name: "envoy-gateway-config", Namespace: "tigera-gateway"}},
&rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: "tigera-gateway-api-gateway-helm-envoy-gateway-role"}},
Expand Down

0 comments on commit 7b01da4

Please sign in to comment.