Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add YAML serialization example in the cheatsheet #2406

Merged
merged 1 commit into from Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@

#### Improvements
* Fix #2331: Fixed documentation for namespaced informer for all custom types implementing `Namespaced` interface
* Fix #2406: Add documentation for serializing resources to YAML

#### Dependency Upgrade
* Fix #2360: bump mockito-core from 3.4.0 to 3.4.2
Expand Down
11 changes: 11 additions & 0 deletions doc/CHEATSHEET.md
Expand Up @@ -34,6 +34,7 @@ This document contains common usages of different resources using Fabric8 Kubern
* [List Options](#list-options)
* [Delete Options](#delete-options)
* [Watch Options](#watch-options)
* [Serializing to yaml](#serializing-to-yaml)

* [OpenShift Client DSL Usage](#openshift-client-dsl-usage)
* [Initializing OpenShift Client](#initializing-openshift-client)
Expand Down Expand Up @@ -2173,6 +2174,16 @@ client.pods().watch(new ListOptionsBuilder().withTimeoutSeconds(30L).build(), ne
});
```

#### Serializing to yaml
Resources can be exported to a yaml String via the `SerializationUtils` class:
```
Pod myPod;

String myPodAsYaml = SerializationUtils.dumpAsYaml(myPod);
// Your pod might have some state that you don't really care about, to remove it:
String myPodAsYamlWithoutRuntimeState = dumpWithoutRuntimeStateAsYaml(myPod);
```

### OpenShift Client DSL Usage

Fabric8 Kubernetes Client also has an extension for OpenShift. It is pretty much the same as Kubernetes Client but has support for some additional OpenShift resources.
Expand Down