use of io.stackgres.common.crd.sgdbops.StackGresDbOpsMajorVersionUpgrade in project stackgres by ongres.
the class DbOpsMajorVersionUpgradeJob method getRunEnvVars.
@Override
protected List<EnvVar> getRunEnvVars(StackGresDbOpsContext context) {
StackGresDbOps dbOps = context.getSource();
StackGresDbOpsMajorVersionUpgrade majorVersionUpgrade = dbOps.getSpec().getMajorVersionUpgrade();
return ImmutableList.<EnvVar>builder().add(new EnvVarBuilder().withName("LINK").withValue(Optional.ofNullable(majorVersionUpgrade).map(StackGresDbOpsMajorVersionUpgrade::getLink).map(String::valueOf).orElse("false")).build(), new EnvVarBuilder().withName("CLONE").withValue(Optional.ofNullable(majorVersionUpgrade).map(StackGresDbOpsMajorVersionUpgrade::getClone).map(String::valueOf).orElse("false")).build(), new EnvVarBuilder().withName("CHECK").withValue(Optional.ofNullable(majorVersionUpgrade).map(StackGresDbOpsMajorVersionUpgrade::getCheck).map(String::valueOf).orElse("false")).build(), new EnvVarBuilder().withName("CRD_GROUP").withValue(CommonDefinition.GROUP).build(), new EnvVarBuilder().withName("CLUSTER_CRD_NAME").withValue(HasMetadata.getPlural(StackGresCluster.class)).build(), new EnvVarBuilder().withName("CLUSTER_NAMESPACE").withValue(context.getSource().getMetadata().getNamespace()).build(), new EnvVarBuilder().withName("CLUSTER_NAME").withValue(context.getSource().getSpec().getSgCluster()).build(), new EnvVarBuilder().withName("SERVICE_ACCOUNT").withValueFrom(new EnvVarSourceBuilder().withFieldRef(new ObjectFieldSelector("v1", "spec.serviceAccountName")).build()).build(), new EnvVarBuilder().withName("POD_NAME").withValueFrom(new EnvVarSourceBuilder().withFieldRef(new ObjectFieldSelector("v1", "metadata.name")).build()).build(), new EnvVarBuilder().withName("DB_OPS_CRD_NAME").withValue(CustomResource.getCRDName(StackGresDbOps.class)).build(), new EnvVarBuilder().withName("DB_OPS_NAME").withValue(dbOps.getMetadata().getName()).build(), new EnvVarBuilder().withName("CLUSTER_POD_LABELS").withValue(labelFactory.patroniClusterLabels(context.getCluster()).entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(","))).build(), new EnvVarBuilder().withName("CLUSTER_PRIMARY_POD_LABELS").withValue(labelFactory.patroniPrimaryLabels(context.getCluster()).entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(","))).build(), new EnvVarBuilder().withName("PATRONI_CONTAINER_NAME").withValue(StackgresClusterContainers.PATRONI).build(), new EnvVarBuilder().withName("MAJOR_VERSION_UPGRADE_CONTAINER_NAME").withValue(StackgresClusterContainers.MAJOR_VERSION_UPGRADE).build(), new EnvVarBuilder().withName("LOCK_TIMEOUT").withValue(OperatorProperty.LOCK_TIMEOUT.getString()).build(), new EnvVarBuilder().withName("LOCK_SLEEP").withValue(OperatorProperty.LOCK_POLL_INTERVAL.getString()).build()).build();
}
use of io.stackgres.common.crd.sgdbops.StackGresDbOpsMajorVersionUpgrade in project stackgres by ongres.
the class DbOpsTransformer method getCustomResourceMajorVersionUpgrade.
private StackGresDbOpsMajorVersionUpgrade getCustomResourceMajorVersionUpgrade(DbOpsMajorVersionUpgrade source) {
if (source == null) {
return null;
}
StackGresDbOpsMajorVersionUpgrade transformation = new StackGresDbOpsMajorVersionUpgrade();
transformation.setLink(source.getLink());
transformation.setClone(source.getClone());
transformation.setCheck(source.getCheck());
return transformation;
}
use of io.stackgres.common.crd.sgdbops.StackGresDbOpsMajorVersionUpgrade in project stackgres by ongres.
the class DbOpsTransformer method getResourceMajorVersionUpgrade.
private DbOpsMajorVersionUpgrade getResourceMajorVersionUpgrade(StackGresDbOpsMajorVersionUpgrade source) {
if (source == null) {
return null;
}
DbOpsMajorVersionUpgrade transformation = new DbOpsMajorVersionUpgrade();
transformation.setLink(source.getLink());
transformation.setClone(source.getClone());
transformation.setCheck(source.getCheck());
return transformation;
}
Aggregations