io.fabric8.kubernetes.api.model.DoneableSecret Java Examples

The following examples show how to use io.fabric8.kubernetes.api.model.DoneableSecret. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PatchService.java    From jkube with Eclipse Public License 2.0 6 votes vote down vote up
private static EntityPatcher<Secret> secretPatcher() {
    return (KubernetesClient client, String namespace, Secret newObj, Secret oldObj) -> {
        if (UserConfigurationCompare.configEqual(newObj, oldObj)) {
            return oldObj;
        }
        DoneableSecret entity =
            client.secrets()
                  .inNamespace(namespace)
                  .withName(oldObj.getMetadata().getName())
                  .edit();

        if (!UserConfigurationCompare.configEqual(newObj.getMetadata(), oldObj.getMetadata())) {
            entity.withMetadata(newObj.getMetadata());
        }

        if(!UserConfigurationCompare.configEqual(newObj.getData(), oldObj.getData())) {
                entity.withData(newObj.getData());
        }
        if(!UserConfigurationCompare.configEqual(newObj.getStringData(), oldObj.getStringData())) {
            entity.withStringData(newObj.getStringData());
        }
        return entity.done();
    };
}
 
Example #2
Source File: KubernetesService.java    From vault-crd with Apache License 2.0 6 votes vote down vote up
void modifySecret(Vault resource, VaultSecret vaultSecret) {
    Resource<Secret, DoneableSecret> secretDoneableSecretResource = client.secrets().inNamespace(resource.getMetadata().getNamespace()).withName(resource.getMetadata().getName());
    Secret secret;

    if (secretDoneableSecretResource.get() != null) {
        secret = secretDoneableSecretResource.get();
    } else {
        secret = newSecretInstance(resource, vaultSecret);
    }

    secret.setType(vaultSecret.getType());
    updateAnnotations(secret, vaultSecret.getCompare());
    secret.setData(vaultSecret.getData());

    secretDoneableSecretResource.createOrReplace(secret);
    log.info("Modified secret {} in namespace {}", resource.getMetadata().getName(), resource.getMetadata().getNamespace());
}
 
Example #3
Source File: SecretsController.java    From rabbitmq-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected MixedOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> operation() {
    return getClient().secrets();
}
 
Example #4
Source File: KubernetesService.java    From vault-crd with Apache License 2.0 4 votes vote down vote up
public Secret getSecretByVault(Vault resource) {
    Resource<Secret, DoneableSecret> secretDoneableSecretResource =
            client.secrets().inNamespace(resource.getMetadata().getNamespace()).withName(resource.getMetadata().getName());

    return secretDoneableSecretResource.get();
}
 
Example #5
Source File: SecretOperator.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected MixedOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> operation() {
    return client.secrets();
}
 
Example #6
Source File: SecretOperatorTest.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected AbstractResourceOperator<KubernetesClient, Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> createResourceOperations(Vertx vertx, KubernetesClient mockClient) {
    return new SecretOperator(vertx, mockClient);
}
 
Example #7
Source File: MockKube.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
public MockKube withInitialSecrets(Set<Secret> initial) {
    this.secretDb.putAll(db(initial, Secret.class, DoneableSecret.class));
    return this;
}
 
Example #8
Source File: AutoAdaptableKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> secrets() {
  return delegate.secrets();
}
 
Example #9
Source File: DefaultKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> secrets() {
  return new SecretOperationsImpl(httpClient, getConfiguration());
}
 
Example #10
Source File: ManagedKubernetesClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
public MixedOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> secrets() {
  return delegate.secrets();
}
 
Example #11
Source File: ManagedOpenShiftClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> secrets() {
  return delegate.secrets();
}
 
Example #12
Source File: DefaultOpenShiftClient.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Override
public MixedOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> secrets() {
  return delegate.secrets();
}
 
Example #13
Source File: KubernetesClient.java    From kubernetes-client with Apache License 2.0 2 votes vote down vote up
/**
 * API entrypoint for Secret related operations. Secret (core/v1)
 *
 * @return MixedOperation object for Secret related operations.
 */
MixedOperation<Secret, SecretList, DoneableSecret, Resource<Secret, DoneableSecret>> secrets();