Skip to content

Commit

Permalink
fix: Compensate WasmPlugin.phase field if not set in the CR (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
CH3CHO authored Aug 1, 2023
1 parent 4741272 commit 8fba2d6
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit 8fba2d6

Please sign in to comment.