@@ -34,21 +34,19 @@ class KubernetesService(private val kubernetesApi: CoreV1Api?) : SecretManager {
3434 val secretNameLower = secretName.lowercase()
3535 val labelSelector = buildLabelSector(secretNameLower)
3636
37- val secrets =
38- api.listNamespacedSecret(
39- namespace, null , null , null , null , labelSelector, null , null , null , null , null , true )
37+ val secrets = api.listNamespacedSecret(namespace).labelSelector(labelSelector).execute()
4038 if (secrets.items.isEmpty()) {
4139 logger.debug(" Secret does not exists in namespace $namespace : cannot delete it" )
4240 } else {
4341 logger.info(" Secret exists in namespace $namespace : deleting it" )
44- api.deleteNamespacedSecret(secretNameLower, namespace, null , null , null , null , null , null )
42+ api.deleteNamespacedSecret(secretNameLower, namespace).execute( )
4543 }
4644 }
4745
4846 private fun getSecretFromKubernetes (namespace : String , secretName : String ): Map <String , String > {
4947 val api = checkKubernetesContext()
5048 val secretNameLower = secretName.lowercase()
51- val result = api.readNamespacedSecret(secretNameLower, namespace, " " )
49+ val result = api.readNamespacedSecret(secretNameLower, namespace).execute( )
5250
5351 logger.debug(" Secret retrieved for namespace $namespace " )
5452 return result.data?.mapValues { Base64 .getDecoder().decode(it.value).toString(Charsets .UTF_8 ) }
@@ -76,15 +74,13 @@ class KubernetesService(private val kubernetesApi: CoreV1Api?) : SecretManager {
7674 body.data = secretData.mapValues { Base64 .getEncoder().encode(it.value.toByteArray()) }
7775 body.type = " Opaque"
7876
79- val secrets =
80- api.listNamespacedSecret(
81- namespace, null , null , null , null , labelSelector, null , null , null , null , null , true )
77+ val secrets = api.listNamespacedSecret(namespace).labelSelector(labelSelector).execute()
8278 if (secrets.items.isEmpty()) {
8379 logger.debug(" Secret does not exists in namespace $namespace : creating it" )
84- api.createNamespacedSecret(namespace, body, null , null , null , null )
80+ api.createNamespacedSecret(namespace, body).execute( )
8581 } else {
8682 logger.debug(" Secret already exists in namespace $namespace : replacing it" )
87- api.replaceNamespacedSecret(secretNameLower, namespace, body, null , null , null , null )
83+ api.replaceNamespacedSecret(secretNameLower, namespace, body).execute( )
8884 }
8985 logger.info(" Secret created/replaced" )
9086 }
0 commit comments