Skip to content

Instantly share code, notes, and snippets.

@tombentley
Created January 22, 2018 11:38
Show Gist options
  • Save tombentley/761add91fba79310adeca8c50aeec0bb to your computer and use it in GitHub Desktop.
Save tombentley/761add91fba79310adeca8c50aeec0bb to your computer and use it in GitHub Desktop.
StatefulSet statefulSet = new StatefulSetBuilder()
.withNewMetadata()
.withName(name)
.withLabels(getLabelsWithName())
.withNamespace(namespace)
.endMetadata()
.withNewSpec()
.withPodManagementPolicy("Parallel")
.withUpdateStrategy(new StatefulSetUpdateStrategyBuilder().withType("OnDelete").build())
.withSelector(new LabelSelectorBuilder().withMatchLabels(getLabelsWithName()).build())
.withServiceName(headlessName)
.withReplicas(replicas)
.withNewTemplate()
.withNewMetadata()
.withName(name)
.withLabels(getLabelsWithName())
.withAnnotations(getPrometheusAnnotations())
.endMetadata()
.withNewSpec()
.withSecurityContext(securityContext)
.withInitContainers(initContainers)
.withContainers(container)
.withVolumes(volumes)
.endSpec()
.endTemplate()
.withVolumeClaimTemplates(volumeClaims)
.endSpec()
.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment