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

feature and refactor: add lombok, introduce package structure and add interface to configure dependent resources #208

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

1nval1d
Copy link

@1nval1d 1nval1d commented Feb 9, 2025

BREAKING CHANGE:

Reactoring - introducing new package structure:

basePath: io.javaoperatorsdk.operator.springboot.starter
From To
CRDApplier crd.CRDApplier
CRDApplier.DefaultCRDApplier crd.DefaultCRDApplier
CRDApplier.CRDTransformer crd.CRDTransformer
KubernetesClientProperties properties.KubernetesClientProperties
OperatorConfigurationProperties.CrdProperties properties.CrdProperties
OperatorConfigurationProperties properties.OperatorConfigurationProperties
ReconcilerProperties properties.KubernetesClientProperties
RetryProperties properties.RetryProperties

Introduced new interface to configure dependent resources

Usage: create a bean , that implements the DependentResourceConfigurator interface, return the name of the dependent resource in the getName method. Expect the bean in the configureWith-method of your dependent resource. Make sure to implement other required interfaces.

… interface to configure dependent resources (#1)

* refactor: add lombok

* feature: add interface to configure dependent resources
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 9, 2025
Copy link
Contributor

@csviri csviri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me, although it brings some breaking changes, not sure how much it would be affecting users, probably not that much. So we can release this as part of a minor version IMO

@UtilityClass
public class ReconcilerRegistrationUtil {

public List<DependentResourceConfigurator> filterConfigurators(Reconciler<?> reconciler,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might deserve a unit test, since logic is not trivial.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, thank you. added unit tests

@FunctionalInterface
public interface DependentResourceConfigurator {

String getName();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one note regarding to this, altevatively we could avoid inheritance, so the configuration bean would not inherit this interface, but we could put here also method getConfiguraiton that would result in the configuration bean.
But no strong opinion one way or another.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or as an atlernative we could have this just as an annotation on top of a conig bean: @DependentConfiguration(dependentName="dr name", reconcilerName="optional reconciler name")

@csviri
Copy link
Contributor

csviri commented Feb 11, 2025

Note: lombok might be a matter of further discussions, but I'm fine also to add it in this PR, just might be removed in the subsequent ones.

Copy link

@xstefank xstefank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@csviri
Copy link
Contributor

csviri commented Feb 14, 2025

Hi @1nval1d , do you still plan to work on this (it is a draft) or we can merge it?

@1nval1d 1nval1d marked this pull request as ready for review February 15, 2025 07:21
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 15, 2025
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.KubernetesDependentResourceConfig;
import io.javaoperatorsdk.operator.springboot.starter.DependentResourceConfigurator;

public class ConfigMapDRConfigurator extends KubernetesDependentResourceConfig<ConfigMap>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe name it ConfigMapDRConfig

@csviri
Copy link
Contributor

csviri commented Mar 11, 2025

@1nval1d are still planning to work on this PR? in case we can merge it to next branch, and do subsequent changes later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants