class PodSecurityPolicyExample {

  //You need to be login as admin on OpenShift for this Example
  //command for that is
  //oc login -u system:admin

  private static final Logger logger = LoggerFactory.getLogger(PodSecurityPolicyExample.class);

  public static void main(String[] args) {<FILL_FUNCTION_BODY>}
}

    try (final KubernetesClient client = new KubernetesClientBuilder().build()) {
      final String localYamlToCreate = "/PodSecurityPolicy.yml";
      logger.info("Creating PodSecurityPolicy from Yaml file: {}", localYamlToCreate);
      try (final InputStream localYamlStream = PodSecurityPolicyExample.class.getResourceAsStream(localYamlToCreate)) {
        final PodSecurityPolicy podSecurityPolicy = client.policy().v1beta1().podSecurityPolicies().load(localYamlStream)
            .item();
        client.policy().v1beta1().podSecurityPolicies().withName(podSecurityPolicy.getMetadata().getName()).delete();
        client.policy().v1beta1().podSecurityPolicies().withName(podSecurityPolicy.getMetadata().getName())
            .waitUntilCondition(Objects::isNull, 5, TimeUnit.SECONDS);
        client.policy().v1beta1().podSecurityPolicies().resource(podSecurityPolicy).create();
        logger.info("PodSecurityPolicy created with Name : {}", podSecurityPolicy.getMetadata().getName());
      }

      logger.info("Starting creating PodSecurityPolicy programmatically");
      final String podSecurityPolicyName = "example2";
      client.policy().v1beta1().podSecurityPolicies().withName(podSecurityPolicyName).delete();
      client.policy().v1beta1().podSecurityPolicies().withName(podSecurityPolicyName)
          .waitUntilCondition(Objects::isNull, 5, TimeUnit.SECONDS);
      final PodSecurityPolicy programmaticPodSecurityPolicy = new PodSecurityPolicyBuilder().withNewMetadata()
          .withName(podSecurityPolicyName)
          .endMetadata()
          .withNewSpec()
          .withPrivileged(false)
          .withNewRunAsUser().withRule("RunAsAny").endRunAsUser()
          .withNewFsGroup().withRule("RunAsAny").endFsGroup()
          .withNewSeLinux().withRule("RunAsAny").endSeLinux()
          .withNewSupplementalGroups().withRule("RunAsAny").endSupplementalGroups()
          .endSpec()
          .build();
      client.policy().v1beta1().podSecurityPolicies().resource(programmaticPodSecurityPolicy).create();
      logger.info("PodSecurityPolicy created with Name: {}", programmaticPodSecurityPolicy.getMetadata().getName());
    } catch (KubernetesClientException clientException) {
      logger.error("Problem encountered with Kubernetes client!!", clientException);
    } catch (Exception e) {
      logger.error("Exception encountered : {}", e.getMessage(), e);
    }
  
<no_super_class>