how to replace deprecated method

614 views
Skip to first unread message

Dagrun Haugland

unread,
Jun 26, 2022, 3:52:53 PM6/26/22
to fabric8
Hi
I am using this version of fabric8 to connect to my Kubernetes pods:
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
<version>6.0.0-RC1</version>
</dependency>

I have written the following code, but see that the createOrReplace method I am using is deprecated. Does anyone know what I should use instead?

Resource<io.fabric8.kubernetes.api.model.ConfigMap> configMapResource = client.configMaps().inNamespace(MY_NAMESPACE).withName(MY_POD_NAME);

io.fabric8.kubernetes.api.model.ConfigMap configMap = configMapResource.createOrReplace(new ConfigMapBuilder().
         withNewMetadata().withName(MY_CONFIG_NAME).endMetadata().
         withData(jsonMap).
         build());

Rohan Kumar

unread,
Jun 27, 2022, 1:06:21 AM6/27/22
to Dagrun Haugland, fabric8
You need to check Fabric8 v6 Migration guide[0]. You're advised to provide the item via `resource(T item)` method:

Resource<ConfigMap> configMapResource = client.configMaps().inNamespace(NAMESPACE).resource(new ConfigMapBuilder().
         withNewMetadata().withName(MY_CONFIG_NAME).endMetadata().
         withData(jsonMap).
         build());

सोम, 27 जून 2022 को 1:23 am बजे को Dagrun Haugland <dag...@gmail.com> ने लिखा:
--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fabric8/1fc2f819-52c8-4087-818d-288db14ed599n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages