Search in sources :

Example 1 with CrdInstallerImpl

use of io.stackgres.jobs.crdupgrade.CrdInstallerImpl in project stackgres by ongres.

the class Main method run.

@Override
@SuppressWarnings("deprecation")
public int run(String... args) throws Exception {
    /*
     * This is a hack to prevent empty arrays being added to json serializer in native image. For
     * some reason when CRDs are being serialized in json, in the native image the annotation
     *
     * @JsonInclude(Include.NON_EMPTY) is ignored.
     */
    Serialization.jsonMapper().disable(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS);
    final CrdLoader crdLoader = new CrdLoaderImpl(kubernetesClientFactory);
    final CustomResourceDefinitionFinder crdFinder = new CustomResourceDefinitionFinder(kubernetesClientFactory);
    if (crdUpgrade) {
        CrdInstaller crdInstaller = new CrdInstallerImpl(crdFinder, crdFinder, crdLoader);
        crdInstaller.installCustomResourceDefinitions();
    }
    if (conversionWebhooks) {
        final SecretFinder secretFinder = new SecretFinder(kubernetesClientFactory);
        WebhookConfigurator webhookConfigurator = new WebhookConfiguratorImpl(secretFinder, crdFinder, crdFinder, crdLoader);
        webhookConfigurator.configureWebhooks();
    }
    if (dbOpsJob) {
        String dbOpsCrName = JobsProperty.DATABASE_OPERATION_CR_NAME.getString();
        String jobsNamespace = JobsProperty.JOB_NAMESPACE.getString();
        dbOpLauncher.launchDbOp(dbOpsCrName, jobsNamespace);
    }
    return 0;
}
Also used : CrdLoader(io.stackgres.jobs.crdupgrade.CrdLoader) CrdInstaller(io.stackgres.jobs.crdupgrade.CrdInstaller) CrdLoaderImpl(io.stackgres.jobs.crdupgrade.CrdLoaderImpl) CrdInstallerImpl(io.stackgres.jobs.crdupgrade.CrdInstallerImpl) CustomResourceDefinitionFinder(io.stackgres.jobs.crdupgrade.CustomResourceDefinitionFinder) WebhookConfiguratorImpl(io.stackgres.jobs.crdupgrade.WebhookConfiguratorImpl) SecretFinder(io.stackgres.common.resource.SecretFinder) WebhookConfigurator(io.stackgres.jobs.crdupgrade.WebhookConfigurator)

Aggregations

SecretFinder (io.stackgres.common.resource.SecretFinder)1 CrdInstaller (io.stackgres.jobs.crdupgrade.CrdInstaller)1 CrdInstallerImpl (io.stackgres.jobs.crdupgrade.CrdInstallerImpl)1 CrdLoader (io.stackgres.jobs.crdupgrade.CrdLoader)1 CrdLoaderImpl (io.stackgres.jobs.crdupgrade.CrdLoaderImpl)1 CustomResourceDefinitionFinder (io.stackgres.jobs.crdupgrade.CustomResourceDefinitionFinder)1 WebhookConfigurator (io.stackgres.jobs.crdupgrade.WebhookConfigurator)1 WebhookConfiguratorImpl (io.stackgres.jobs.crdupgrade.WebhookConfiguratorImpl)1