Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Compensate WasmPlugin.phase field if not set in the CR #244

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.bouncycastle.asn1.x509.GeneralName;

Expand Down Expand Up @@ -67,6 +68,7 @@
import com.alibaba.higress.console.service.kubernetes.crd.mcp.V1McpBridgeSpec;
import com.alibaba.higress.console.service.kubernetes.crd.mcp.V1RegistryConfig;
import com.alibaba.higress.console.service.kubernetes.crd.wasm.MatchRule;
import com.alibaba.higress.console.service.kubernetes.crd.wasm.PluginPhase;
import com.alibaba.higress.console.service.kubernetes.crd.wasm.V1alpha1WasmPlugin;
import com.alibaba.higress.console.service.kubernetes.crd.wasm.V1alpha1WasmPluginSpec;
import com.alibaba.higress.console.util.TypeUtil;
Expand Down Expand Up @@ -383,7 +385,7 @@ public WasmPlugin wasmPluginFromCr(V1alpha1WasmPlugin cr) {

V1alpha1WasmPluginSpec spec = cr.getSpec();
if (spec != null) {
plugin.setPhase(spec.getPhase());
plugin.setPhase(ObjectUtils.firstNonNull(spec.getPhase(), PluginPhase.UNSPECIFIED.getName()));
plugin.setPriority(spec.getPriority());
String url = spec.getUrl();
if (StringUtils.isNotEmpty(url)) {
Expand Down