private Secret createSecretFromCertAndKeyFiles(final String secretName, final Map<String, String> secretLabels, final String keyKey, final String certKey, final File keyFile, final File certFile, final OpenShiftClient client) throws IOException { Map<String, String> data = new LinkedHashMap<>(); Base64.Encoder encoder = Base64.getEncoder(); data.put(keyKey, encoder.encodeToString(FileUtils.readFileToByteArray(keyFile))); data.put(certKey, encoder.encodeToString(FileUtils.readFileToByteArray(certFile))); return client.secrets().inNamespace(namespace).withName(secretName).createOrReplaceWithNew() .editOrNewMetadata() .withName(secretName) .withLabels(secretLabels) .endMetadata() .addToData(data) .done(); }
private void ensureImageStreams(String name) { LOGGER.debug("Create or Replace ImageStream {}", name); openShiftClient.imageStreams().withName(name).createOrReplaceWithNew() .withNewMetadata() .withName(name) .endMetadata() .done(); }
private void ensureImageStreams(String name) { LOGGER.debug("Create or Replace ImageStream {}", name); openShiftClient.imageStreams().withName(name).createOrReplaceWithNew() .withNewMetadata() .withName(name) .addToLabels(INTEGRATION_DEFAULT_LABELS) .endMetadata() .done(); }
private void ensureSecret(String name, DeploymentData deploymentData) { final Map<String, String> secrets = deploymentData.getSecret(); if (secrets.isEmpty()) { return; } openShiftClient.secrets().withName(name).createOrReplaceWithNew() .withNewMetadata() .withName(name) .addToAnnotations(deploymentData.getAnnotations()) .addToLabels(deploymentData.getLabels()) .endMetadata() .withStringData(secrets) .done(); }
private void ensureSecret(String name, DeploymentData deploymentData) { openShiftClient.secrets().withName(name).createOrReplaceWithNew() .withNewMetadata() .withName(name) .addToAnnotations(deploymentData.getAnnotations()) .addToLabels(deploymentData.getLabels()) .endMetadata() .withStringData(deploymentData.getSecret()) .done(); }
private void ensureRoute(String name, DeploymentData deploymentData) { openShiftClient.routes().withName(name).createOrReplaceWithNew() .withNewMetadata() .withName(name) .addToAnnotations(deploymentData.getAnnotations()) .addToLabels(deploymentData.getLabels()) .endMetadata() .withNewSpec() .withNewTo() .withKind("Service") .withName(name) .endTo() .withNewTls() .withTermination("edge") .endTls() .endSpec() .done(); }
private void ensureService(String name, DeploymentData deploymentData) { final Map<String, String> labels = prepareServiceLabels(deploymentData); final Map<String, String> annotations = prepareServiceAnnotations(deploymentData); openShiftClient.services().withName(name).createOrReplaceWithNew() .withNewMetadata() .withName(name) .addToAnnotations(annotations) .addToLabels(labels) .endMetadata() .withNewSpec() .addToSelector(INTEGRATION_NAME_LABEL, name) .addNewPort() .withName("http") .withProtocol("TCP") .withPort(INTEGRATION_SERVICE_PORT) .withNewTargetPort(INTEGRATION_SERVICE_PORT) .endPort() .endSpec() .done(); }