Skip to content

Commit

Permalink
ensure pull secret is reconciled when changed
Browse files Browse the repository at this point in the history
Signed-off-by: craig <[email protected]>

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
maleck13 committed Dec 18, 2024
1 parent 7ad031b commit 18903a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions controllers/envoy_gateway_extension_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (r *EnvoyGatewayExtensionReconciler) Subscription() controller.Subscription
func (r *EnvoyGatewayExtensionReconciler) Reconcile(ctx context.Context, _ []controller.ResourceEvent, topology *machinery.Topology, _ error, state *sync.Map) error {
logger := controller.LoggerFromContext(ctx).WithName("EnvoyGatewayExtensionReconciler")

logger.V(1).Info("building envoy gateway extension")
logger.V(1).Info("building envoy gateway extension", "image url", WASMFilterImageURL)
defer logger.V(1).Info("finished building envoy gateway extension")

// build wasm plugin configs for each gateway
Expand Down Expand Up @@ -304,7 +304,7 @@ func equalEnvoyExtensionPolicies(a, b *envoygatewayv1alpha1.EnvoyExtensionPolicy

return len(aWasms) == len(bWasms) && lo.EveryBy(aWasms, func(aWasm envoygatewayv1alpha1.Wasm) bool {
return lo.SomeBy(bWasms, func(bWasm envoygatewayv1alpha1.Wasm) bool {
if ptr.Deref(aWasm.Name, "") != ptr.Deref(bWasm.Name, "") || ptr.Deref(aWasm.RootID, "") != ptr.Deref(bWasm.RootID, "") || ptr.Deref(aWasm.FailOpen, false) != ptr.Deref(bWasm.FailOpen, false) || aWasm.Code.Type != bWasm.Code.Type || aWasm.Code.Image.URL != bWasm.Code.Image.URL {
if ptr.Deref(aWasm.Name, "") != ptr.Deref(bWasm.Name, "") || ptr.Deref(aWasm.RootID, "") != ptr.Deref(bWasm.RootID, "") || ptr.Deref(aWasm.FailOpen, false) != ptr.Deref(bWasm.FailOpen, false) || aWasm.Code.Type != bWasm.Code.Type || aWasm.Code.Image.URL != bWasm.Code.Image.URL || ptr.Deref(aWasm.Code.Image.PullSecretRef, gwapiv1b1.SecretObjectReference{}) != ptr.Deref(aWasm.Code.Image.PullSecretRef, gwapiv1b1.SecretObjectReference{}) {

Check failure on line 307 in controllers/envoy_gateway_extension_reconciler.go

View workflow job for this annotation

GitHub Actions / Lint

SA4000: identical expressions on the left and right side of the '!=' operator (staticcheck)
return false
}
aConfig, err := wasm.ConfigFromJSON(aWasm.Config)
Expand Down
7 changes: 4 additions & 3 deletions controllers/istio_extension_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (r *IstioExtensionReconciler) Subscription() controller.Subscription {
func (r *IstioExtensionReconciler) Reconcile(ctx context.Context, _ []controller.ResourceEvent, topology *machinery.Topology, _ error, state *sync.Map) error {
logger := controller.LoggerFromContext(ctx).WithName("IstioExtensionReconciler")

logger.V(1).Info("building istio extension")
logger.V(1).Info("building istio extension ", "image url", WASMFilterImageURL)
defer logger.V(1).Info("finished building istio extension")

// build wasm plugin configs for each gateway
Expand Down Expand Up @@ -115,7 +115,7 @@ func (r *IstioExtensionReconciler) Reconcile(ctx context.Context, _ []controller
}
continue
}

logger.V(1).Info("wasmplugin object ", "desired", desiredWasmPlugin)
if equalWasmPlugins(existingWasmPlugin, desiredWasmPlugin) {
logger.V(1).Info("wasmplugin object is up to date, nothing to do")
continue
Expand All @@ -126,6 +126,7 @@ func (r *IstioExtensionReconciler) Reconcile(ctx context.Context, _ []controller
existingWasmPlugin.Spec.Phase = desiredWasmPlugin.Spec.Phase
existingWasmPlugin.Spec.TargetRefs = desiredWasmPlugin.Spec.TargetRefs
existingWasmPlugin.Spec.PluginConfig = desiredWasmPlugin.Spec.PluginConfig
existingWasmPlugin.Spec.ImagePullSecret = desiredWasmPlugin.Spec.ImagePullSecret

existingWasmPluginUnstructured, err := controller.Destruct(existingWasmPlugin)
if err != nil {
Expand Down Expand Up @@ -284,7 +285,7 @@ func buildIstioWasmPluginForGateway(gateway *machinery.Gateway, wasmConfig wasm.
}

func equalWasmPlugins(a, b *istioclientgoextensionv1alpha1.WasmPlugin) bool {
if a.Spec.Url != b.Spec.Url || a.Spec.Phase != b.Spec.Phase || !kuadrantistio.EqualTargetRefs(a.Spec.TargetRefs, b.Spec.TargetRefs) {
if a.Spec.ImagePullSecret != b.Spec.ImagePullSecret || a.Spec.Url != b.Spec.Url || a.Spec.Phase != b.Spec.Phase || !kuadrantistio.EqualTargetRefs(a.Spec.TargetRefs, b.Spec.TargetRefs) {
return false
}

Expand Down

0 comments on commit 18903a2

Please sign in to comment.