Skip to content

Commit

Permalink
Apply PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
EricWittmann committed Jan 29, 2025
1 parent 85fa4d9 commit d8e0c66
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ public boolean isMet(DependentResource<Ingress, ApicurioRegistry3> resource,
ApicurioRegistry3 primary, Context<ApicurioRegistry3> context) {

var enabled = ofNullable(primary.getSpec()).map(ApicurioRegistry3Spec::getApp)
.map(ComponentSpec::getManageIngress).orElse(Boolean.TRUE);
.map(ComponentSpec::getIngress).map(IngressSpec::getEnabled).orElse(Boolean.TRUE);
var hasIngressHost = ofNullable(primary.getSpec()).map(ApicurioRegistry3Spec::getApp)
.map(AppSpec::getIngress).map(IngressSpec::getHost).map(host -> !isBlank(host))
.orElse(false);
if (!enabled || !hasIngressHost) {
boolean isManaged = enabled && hasIngressHost;
if (!isManaged) {
((AppIngressResource) resource).delete(primary, context);
}
return enabled && hasIngressHost;
return isManaged;
}
}

Expand All @@ -54,14 +55,15 @@ public boolean isMet(DependentResource<Ingress, ApicurioRegistry3> resource,
ApicurioRegistry3 primary, Context<ApicurioRegistry3> context) {

var enabled = ofNullable(primary.getSpec()).map(ApicurioRegistry3Spec::getUi)
.map(ComponentSpec::getManageIngress).orElse(Boolean.TRUE);
.map(ComponentSpec::getIngress).map(IngressSpec::getEnabled).orElse(Boolean.TRUE);
var hasIngressHost = ofNullable(primary.getSpec()).map(ApicurioRegistry3Spec::getUi)
.map(UiSpec::getIngress).map(IngressSpec::getHost).map(host -> !isBlank(host))
.orElse(false);
if (!enabled || !hasIngressHost) {
boolean isManaged = enabled && hasIngressHost;
if (!isManaged) {
((UIIngressResource) resource).delete(primary, context);
}
return enabled && hasIngressHost;
return isManaged;
}
}

Expand Down Expand Up @@ -90,14 +92,15 @@ public boolean isMet(DependentResource<Ingress, ApicurioRegistry3> resource,
ApicurioRegistry3 primary, Context<ApicurioRegistry3> context) {

var enabled = ofNullable(primary.getSpec()).map(ApicurioRegistry3Spec::getStudioUi)
.map(ComponentSpec::getManageIngress).orElse(Boolean.TRUE);
.map(ComponentSpec::getIngress).map(IngressSpec::getEnabled).orElse(Boolean.TRUE);
var hasIngressHost = ofNullable(primary.getSpec()).map(ApicurioRegistry3Spec::getStudioUi)
.map(StudioUiSpec::getIngress).map(IngressSpec::getHost).map(host -> !isBlank(host))
.orElse(false);
if (!enabled || !hasIngressHost) {
boolean isManaged = enabled && hasIngressHost;
if (!isManaged) {
((StudioUIIngressResource) resource).delete(primary, context);
}
return enabled && hasIngressHost;
return isManaged;
}
}
}
35 changes: 19 additions & 16 deletions operator/install/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ spec:
ingress:
description: Configure Ingress for the component.
properties:
enabled:
description: |
Whether an Ingress should be managed by the operator. Defaults to 'true'.
Set this to 'false' if you want to create your own custom Ingress.
type: boolean
host:
description: |-
Configure hostname of the operator-managed Ingress. If the value is empty, the operator will not create an Ingress resource for the component.
Expand All @@ -117,11 +123,6 @@ spec:
automatically.'
type: string
type: object
manageIngress:
description: |
Whether an Ingress should be managed by the operator. Defaults to 'true'.
Set this to 'false' if you want to create your own custom Ingress.
type: boolean
podTemplateSpec:
description: |-
`PodTemplateSpec` describes the data a pod should have when created from a template.
Expand Down Expand Up @@ -3252,18 +3253,19 @@ spec:
ingress:
description: Configure Ingress for the component.
properties:
enabled:
description: |
Whether an Ingress should be managed by the operator. Defaults to 'true'.
Set this to 'false' if you want to create your own custom Ingress.
type: boolean
host:
description: |-
Configure hostname of the operator-managed Ingress. If the value is empty, the operator will not create an Ingress resource for the component.
IMPORTANT: If the Ingress already exists and the value becomes empty, the Ingress will be deleted.
type: string
type: object
manageIngress:
description: |
Whether an Ingress should be managed by the operator. Defaults to 'true'.
Set this to 'false' if you want to create your own custom Ingress.
type: boolean
podTemplateSpec:
description: |-
`PodTemplateSpec` describes the data a pod should have when created from a template.
Expand Down Expand Up @@ -6246,18 +6248,19 @@ spec:
ingress:
description: Configure Ingress for the component.
properties:
enabled:
description: |
Whether an Ingress should be managed by the operator. Defaults to 'true'.
Set this to 'false' if you want to create your own custom Ingress.
type: boolean
host:
description: |-
Configure hostname of the operator-managed Ingress. If the value is empty, the operator will not create an Ingress resource for the component.
IMPORTANT: If the Ingress already exists and the value becomes empty, the Ingress will be deleted.
type: string
type: object
manageIngress:
description: |
Whether an Ingress should be managed by the operator. Defaults to 'true'.
Set this to 'false' if you want to create your own custom Ingress.
type: boolean
podTemplateSpec:
description: |-
`PodTemplateSpec` describes the data a pod should have when created from a template.
Expand Down Expand Up @@ -9377,7 +9380,7 @@ spec:
value: quay.io/apicurio/apicurio-registry-ui:latest-snapshot
- name: STUDIO_UI_IMAGE
value: quay.io/apicurio/apicurio-studio-ui:latest-snapshot
image: quay.io/apicurio/apicurio-registry-operator:latest-snapshot
image: quay.io/apicurio/apicurio-registry-operator:3.0.7-snapshot
imagePullPolicy: Always
livenessProbe:
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,6 @@ public abstract class ComponentSpec {
@JsonSetter(nulls = Nulls.SKIP)
private Integer replicas;

/**
* Indicates whether to create and manage an Ingress for the component
*/
@JsonProperty("manageIngress")
@JsonPropertyDescription("""
Whether an Ingress should be managed by the operator. Defaults to 'true'.
Set this to 'false' if you want to create your own custom Ingress.
""")
@JsonSetter(nulls = Nulls.SKIP)
private Boolean manageIngress;

public IngressSpec withIngress() {
if (ingress == null) {
ingress = new IngressSpec();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@JsonDeserialize(using = None.class)
@JsonInclude(NON_NULL)
@JsonPropertyOrder({ "host" })
@JsonPropertyOrder({ "enabled", "host" })
@NoArgsConstructor
@AllArgsConstructor(access = PRIVATE)
@SuperBuilder(toBuilder = true)
Expand All @@ -21,6 +21,18 @@
@ToString
public class IngressSpec {

/**
* Indicates whether to create and manage an Ingress for the component
*/
@JsonProperty("enabled")
@JsonPropertyDescription("""
Whether an Ingress should be managed by the operator. Defaults to 'true'.
Set this to 'false' if you want to create your own custom Ingress.
""")
@JsonSetter(nulls = Nulls.SKIP)
private Boolean enabled;

/**
* Configure hostname of the operator-managed Ingress. If the value is empty, the operator will not create
* an Ingress resource for the component.
Expand Down

0 comments on commit d8e0c66

Please sign in to comment.