Skip to content

Commit

Permalink
task: move files and organize them (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 authored Dec 4, 2024
1 parent debf50b commit cb866a3
Show file tree
Hide file tree
Showing 33 changed files with 81 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.ui;
package org.trustify.operator.cdrs.v2alpha1.ingress;

import io.fabric8.kubernetes.api.model.networking.v1.Ingress;
import io.fabric8.kubernetes.api.model.networking.v1.IngressTLS;
Expand All @@ -15,9 +15,9 @@
import java.util.Collections;
import java.util.Map;

@KubernetesDependent(labelSelector = UIIngress.LABEL_SELECTOR, resourceDiscriminator = UIIngressDiscriminator.class)
@KubernetesDependent(labelSelector = AppIngress.LABEL_SELECTOR, resourceDiscriminator = AppIngressDiscriminator.class)
@ApplicationScoped
public class UIIngress extends UIIngressBase {
public class AppIngress extends AppIngressBase {

public static final String LABEL_SELECTOR = "app.kubernetes.io/managed-by=trustify-operator,component=ui,component-variant=https";

Expand All @@ -38,7 +38,7 @@ protected Ingress desired(Trustify cr, Context<Trustify> context) {

@Override
public boolean isMet(DependentResource<Ingress, Trustify> dependentResource, Trustify primary, Context<Trustify> context) {
return context.getSecondaryResource(Ingress.class, new UIIngressDiscriminator())
return context.getSecondaryResource(Ingress.class, new AppIngressDiscriminator())
.map(in -> {
final var status = in.getStatus();
if (status != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.ui;
package org.trustify.operator.cdrs.v2alpha1.ingress;

import io.fabric8.kubernetes.api.model.GenericKubernetesResource;
import io.fabric8.kubernetes.api.model.networking.v1.Ingress;
Expand All @@ -14,19 +14,20 @@
import jakarta.inject.Inject;
import org.trustify.operator.Constants;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.ui.service.UIService;
import org.trustify.operator.utils.CRDUtils;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;

public abstract class UIIngressBase extends CRUDKubernetesDependentResource<Ingress, Trustify> implements Condition<Ingress, Trustify> {
public abstract class AppIngressBase extends CRUDKubernetesDependentResource<Ingress, Trustify> implements Condition<Ingress, Trustify> {

@Inject
KubernetesClient k8sClient;

public UIIngressBase() {
public AppIngressBase() {
super(Ingress.class);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.ui;
package org.trustify.operator.cdrs.v2alpha1.ingress;

import io.fabric8.kubernetes.api.model.networking.v1.Ingress;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand All @@ -9,10 +9,10 @@

import java.util.Optional;

public class UIIngressDiscriminator implements ResourceDiscriminator<Ingress, Trustify> {
public class AppIngressDiscriminator implements ResourceDiscriminator<Ingress, Trustify> {
@Override
public Optional<Ingress> distinguish(Class<Ingress> resource, Trustify cr, Context<Trustify> context) {
String ingressName = UIIngress.getIngressName(cr);
String ingressName = AppIngress.getIngressName(cr);
ResourceID resourceID = new ResourceID(ingressName, cr.getMetadata().getNamespace());
var informerEventSource = (InformerEventSource<Ingress, Trustify>) context.eventSourceRetriever().getResourceEventSourceFor(Ingress.class);
return informerEventSource.get(resourceID);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db;

import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.server.utils.ServerUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.deployment;

import io.fabric8.kubernetes.api.model.*;
import io.fabric8.kubernetes.api.model.apps.*;
Expand All @@ -14,7 +14,9 @@
import org.trustify.operator.Constants;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.TrustifySpec;
import org.trustify.operator.cdrs.v2alpha1.db.utils.DBUtils;
import org.trustify.operator.cdrs.v2alpha1.server.db.pvc.DBPersistentVolumeClaim;
import org.trustify.operator.cdrs.v2alpha1.server.db.secret.DBSecret;
import org.trustify.operator.cdrs.v2alpha1.server.db.utils.DBUtils;
import org.trustify.operator.utils.CRDUtils;

import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.deployment;

import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition;
import jakarta.enterprise.context.ApplicationScoped;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.server.db.DBActivationCondition;

@ApplicationScoped
public class DBDeploymentActivationCondition extends DBActivationCondition implements Condition<Deployment, Trustify> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.deployment;

import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.pvc;

import io.fabric8.kubernetes.api.model.*;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.pvc;

import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition;
import jakarta.enterprise.context.ApplicationScoped;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.server.db.DBActivationCondition;

@ApplicationScoped
public class DBPersistentVolumeClaimActivationCondition extends DBActivationCondition implements Condition<PersistentVolumeClaim, Trustify> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.pvc;

import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.secret;

import io.fabric8.kubernetes.api.model.Secret;
import io.fabric8.kubernetes.api.model.SecretBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.secret;

import io.fabric8.kubernetes.api.model.Secret;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition;
import jakarta.enterprise.context.ApplicationScoped;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.server.db.DBActivationCondition;

import java.util.Optional;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.secret;

import io.fabric8.kubernetes.api.model.Secret;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.service;

import io.fabric8.kubernetes.api.model.Service;
import io.fabric8.kubernetes.api.model.ServiceBuilder;
Expand All @@ -10,6 +10,7 @@
import jakarta.enterprise.context.ApplicationScoped;
import org.trustify.operator.Constants;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.server.db.deployment.DBDeployment;
import org.trustify.operator.utils.CRDUtils;

import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.service;

import io.fabric8.kubernetes.api.model.Service;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
import io.javaoperatorsdk.operator.processing.dependent.workflow.Condition;
import jakarta.enterprise.context.ApplicationScoped;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.server.db.DBActivationCondition;

@ApplicationScoped
public class DBServiceActivationCondition extends DBActivationCondition implements Condition<Service, Trustify> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.db;
package org.trustify.operator.cdrs.v2alpha1.server.db.service;

import io.fabric8.kubernetes.api.model.Service;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.trustify.operator.cdrs.v2alpha1.db.utils;
package org.trustify.operator.cdrs.v2alpha1.server.db.utils;

import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.db.DBDeploymentDiscriminator;
import org.trustify.operator.cdrs.v2alpha1.server.db.deployment.DBDeploymentDiscriminator;

public class DBUtils {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.server;
package org.trustify.operator.cdrs.v2alpha1.server.deployment;

import io.fabric8.kubernetes.api.model.*;
import io.fabric8.kubernetes.api.model.apps.*;
Expand All @@ -14,7 +14,7 @@
import org.trustify.operator.Constants;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.TrustifySpec;
import org.trustify.operator.cdrs.v2alpha1.db.DBDeployment;
import org.trustify.operator.cdrs.v2alpha1.server.db.deployment.DBDeployment;
import org.trustify.operator.controllers.TrustifyDistConfigurator;
import org.trustify.operator.utils.CRDUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.server;
package org.trustify.operator.cdrs.v2alpha1.server.deployment;

import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.server;
package org.trustify.operator.cdrs.v2alpha1.server.pvc;

import io.fabric8.kubernetes.api.model.*;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.server;
package org.trustify.operator.cdrs.v2alpha1.server.pvc;

import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.server;
package org.trustify.operator.cdrs.v2alpha1.server.pvc;

import io.fabric8.kubernetes.api.model.PersistentVolumeClaim;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.server;
package org.trustify.operator.cdrs.v2alpha1.server.service;

import io.fabric8.kubernetes.api.model.*;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.server;
package org.trustify.operator.cdrs.v2alpha1.server.service;

import io.fabric8.kubernetes.api.model.Service;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.ui;
package org.trustify.operator.cdrs.v2alpha1.ui.deployment;

import io.fabric8.kubernetes.api.model.*;
import io.fabric8.kubernetes.api.model.apps.*;
Expand All @@ -14,8 +14,8 @@
import org.trustify.operator.Constants;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.TrustifySpec;
import org.trustify.operator.cdrs.v2alpha1.server.ServerDeployment;
import org.trustify.operator.cdrs.v2alpha1.server.ServerService;
import org.trustify.operator.cdrs.v2alpha1.server.deployment.ServerDeployment;
import org.trustify.operator.cdrs.v2alpha1.server.service.ServerService;
import org.trustify.operator.utils.CRDUtils;

import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.ui;
package org.trustify.operator.cdrs.v2alpha1.ui.deployment;

import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.ui;
package org.trustify.operator.cdrs.v2alpha1.ui.service;

import io.fabric8.kubernetes.api.model.*;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.trustify.operator.cdrs.v2alpha1.ui;
package org.trustify.operator.cdrs.v2alpha1.ui.service;

import io.fabric8.kubernetes.api.model.Service;
import io.javaoperatorsdk.operator.api.reconciler.Context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import org.trustify.operator.Constants;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.TrustifySpec;
import org.trustify.operator.cdrs.v2alpha1.db.DBDeployment;
import org.trustify.operator.cdrs.v2alpha1.db.DBService;
import org.trustify.operator.cdrs.v2alpha1.server.ServerService;
import org.trustify.operator.cdrs.v2alpha1.server.ServerStoragePersistentVolumeClaim;
import org.trustify.operator.cdrs.v2alpha1.server.db.deployment.DBDeployment;
import org.trustify.operator.cdrs.v2alpha1.server.db.service.DBService;
import org.trustify.operator.cdrs.v2alpha1.server.service.ServerService;
import org.trustify.operator.cdrs.v2alpha1.server.pvc.ServerStoragePersistentVolumeClaim;

import java.util.*;
import java.util.function.Function;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,21 @@
import org.jboss.logging.Logger;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.TrustifyStatusCondition;
import org.trustify.operator.cdrs.v2alpha1.db.*;
import org.trustify.operator.cdrs.v2alpha1.server.ServerDeployment;
import org.trustify.operator.cdrs.v2alpha1.server.ServerService;
import org.trustify.operator.cdrs.v2alpha1.server.ServerStoragePersistentVolumeClaim;
import org.trustify.operator.cdrs.v2alpha1.server.ServerStoragePersistentVolumeClaimActivationCondition;
import org.trustify.operator.cdrs.v2alpha1.ui.UIDeployment;
import org.trustify.operator.cdrs.v2alpha1.ui.UIIngress;
import org.trustify.operator.cdrs.v2alpha1.ui.UIService;
import org.trustify.operator.cdrs.v2alpha1.server.deployment.ServerDeployment;
import org.trustify.operator.cdrs.v2alpha1.server.service.ServerService;
import org.trustify.operator.cdrs.v2alpha1.server.pvc.ServerStoragePersistentVolumeClaim;
import org.trustify.operator.cdrs.v2alpha1.server.pvc.ServerStoragePersistentVolumeClaimActivationCondition;
import org.trustify.operator.cdrs.v2alpha1.server.db.deployment.DBDeployment;
import org.trustify.operator.cdrs.v2alpha1.server.db.deployment.DBDeploymentActivationCondition;
import org.trustify.operator.cdrs.v2alpha1.server.db.pvc.DBPersistentVolumeClaim;
import org.trustify.operator.cdrs.v2alpha1.server.db.pvc.DBPersistentVolumeClaimActivationCondition;
import org.trustify.operator.cdrs.v2alpha1.server.db.secret.DBSecret;
import org.trustify.operator.cdrs.v2alpha1.server.db.secret.DBSecretActivationCondition;
import org.trustify.operator.cdrs.v2alpha1.server.db.service.DBService;
import org.trustify.operator.cdrs.v2alpha1.server.db.service.DBServiceActivationCondition;
import org.trustify.operator.cdrs.v2alpha1.ui.deployment.UIDeployment;
import org.trustify.operator.cdrs.v2alpha1.ingress.AppIngress;
import org.trustify.operator.cdrs.v2alpha1.ui.service.UIService;

import java.time.Duration;
import java.util.Map;
Expand Down Expand Up @@ -80,9 +87,9 @@
),

@Dependent(
name = "ui-ingress",
type = UIIngress.class,
readyPostcondition = UIIngress.class
name = "app-ingress",
type = AppIngress.class,
readyPostcondition = AppIngress.class
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.junit.jupiter.api.Test;
import org.trustify.operator.cdrs.v2alpha1.Trustify;
import org.trustify.operator.cdrs.v2alpha1.TrustifySpec;
import org.trustify.operator.cdrs.v2alpha1.db.DBDeployment;
import org.trustify.operator.cdrs.v2alpha1.server.db.deployment.DBDeployment;
import org.trustify.operator.controllers.setup.K3sResource;

import java.io.InputStream;
Expand Down
Loading

0 comments on commit cb866a3

Please sign in to comment.