Metafile 408
Metafile 408
https://ebookmeta.com/product/kubernetes-programming-with-go-
programming-kubernetes-clients-and-operators-using-go-and-the-
kubernetes-api-1st-edition-philippe-martin/
https://ebookmeta.com/product/kubernetes-preparing-for-the-cka-
and-ckad-certifications-martin/
https://ebookmeta.com/product/nonsequential-and-distributed-
programming-with-go-christian-maurer/
https://ebookmeta.com/product/software-development-with-go-cloud-
native-programming-using-golang-with-linux-and-docker-nanik-
tolaram/
Ansible for Kubernetes by Example: Automate Your
Kubernetes Cluster with Ansible 1st Edition Luca Berton
https://ebookmeta.com/product/ansible-for-kubernetes-by-example-
automate-your-kubernetes-cluster-with-ansible-1st-edition-luca-
berton/
https://ebookmeta.com/product/ansible-for-kubernetes-by-example-
automate-your-kubernetes-cluster-with-ansible-1st-edition-luca-
berton-2/
https://ebookmeta.com/product/get-programming-with-go-1st-
edition-nathan-youngman/
https://ebookmeta.com/product/hacking-kubernetes-threat-driven-
analysis-and-defense-1st-edition-andrew-martin/
https://ebookmeta.com/product/software-development-with-go-cloud-
native-programming-using-golang-with-linux-and-docker-1st-
edition-nanik-tolaram/
Philippe Martin
This work is subject to copyright. All rights are solely and exclusively
licensed by the Publisher, whether the whole or part of the material is
concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in
any other physical way, and transmission or information storage and
retrieval, electronic adaptation, computer software, or by similar or
dissimilar methodology now known or hereafter developed.
The publisher, the authors, and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
Chapters at a Glance
The target reader for this book has some experience working with
REST APIs, accessing them either by HTTP or using clients for specific
languages; and has some knowledge of the Kubernetes platform,
essentially as a user—for example, some experience deploying such
APIs or frontend applications with the help of YAML manifests.
Chapter 1 of the book explores the Kubernetes API and how it
implements the principles of REST. It especially focuses on the
Group-Version-Resource organization and the Kind concept
proposed by the API.
Chapter 2 continues by covering the operations proposed by the API
and the details of each operation, using the HTTP protocol.
Chapters 3 to 5 describe the common and “low-level” Go libraries to
work with the Kubernetes API: the API and API Machinery Libraries.
Chapters 6 and 7 cover the Client-go Library—the high-level library
to work with the Kubernetes API in Go—and how to unit test code
using this library.
At this point in the book, the reader should be comfortable with
building Go applications working with native resources of the
Kubernetes API.
Chapters 8 and 9 introduce the concept of Custom Resources and
how to work with them in Go.
Chapters 10 to 12 cover the implementation of Kubernetes Operators
using the controller-runtime library.
Chapter 13 explores the Kubebuilder SDK, a tool to help develop and
deploy Kubernetes Operators.
By the end of the book, the reader should be able to start building
Kubernetes operators in Go and have a very good understanding of
what happens behind the scenes.
Any source code or other supplementary material referenced by the
author in this book is available to readers on GitHub via the book's
product page, located at https://github.com/Apress/Kubernetes-
Programming-with-Go-by-Philippe-Martin. For more detailed
information, please visit http://www.apress.com/source-code.
Acknowledgments
I would like to thank the whole Anevia “CDN” team who started
working with me on Kubernetes back in 2018: David, Ansou, Hossam,
Yassine, É tienne, Jason, and Michaël. Special thanks to Damien Lucas for
initiating this project and for having trusted us with this challenge.
My discovery of Kubernetes has been much easier and pleasant
thanks to the TGIK channel and its numerous episodes, hosted by Joe
Beda, Kris Nova, and many others. Plus, thanks to all the Kubernetes
community for such a great ecosystem!
Table of Contents
Chapter 1:Kubernetes API Introduction
Kubernetes Platform at a Glance
OpenAPI Specification
Verbs and Kinds
Group-Version-Resource
Sub-resources
Official API Reference Documentation
The Deployment Documentation
Operations Documentation
The Pod Documentation
One-Page Version of the Documentation
Conclusion
Chapter 2:Kubernetes API Operations
Examining Requests
Making Requests
Using kubectl as a Proxy
Creating a Resource
Getting Information About a Resource
Getting the List of Resources
Filtering the Result of a List
Deleting a Resource
Deleting a Collection of Resources
Updating a Resource
Managing Conflicts When Updating a Resource
Using a Strategic Merge Patch to Update a Resource
Applying Resources Server-side
Watching Resources
Filtering During a Watch Session
Watching After Listing Resources
Restarting a watch Request
Allowing Bookmarks to Efficiently Restart a watch Request
Paginating Results
Getting Results in Various Formats
Getting Results as a Table
Using the YAML Format
Using the Protobuf Format
Conclusion
Chapter 3:Working with API Resources in Go
API Library Sources and Import
Content of a Package
types.go
register.go
doc.go
generated.pb.go and generated.proto
types_swagger_doc_generated.go
zz_generated.deepcopy.go
Specific Content in core/v1
ObjectReference
ResourceList
Taint
Toleration
Well-Known Labels
Writing Kubernetes Resources in Go
Importing the Package
The TypeMeta Fields
The ObjectMeta Fields
Spec and Status
Comparison with Writing YAML Manifests
A Complete Example
Conclusion
Chapter 4:Using Common Types
Pointers
Getting the Reference of a Value
Dereferencing a Pointer
Comparing Two Referenced Values
Quantities
Parsing a String as Quantity
Using an inf.Dec as a Quantity
Using a Scaled Integer as a Quantity
Operations on Quantities
IntOrString
Time
Factory Methods
Operations on Time
Conclusion
Chapter 5:The API Machinery
The Schema Package
Scheme
Initialization
Mapping
Conversion
Serialization
RESTMapper
Kind to Resource
Resource to Kind
Finding Resources
The DefaultRESTMapper Implementation
Conclusion
Chapter 6:The Client-go Library
Connecting to the Cluster
In-cluster Configuration
Out-of-Cluster Configuration
Getting a Clientset
Using the Clientset
Examining the Requests
Creating a Resource
Getting Information About a Resource
Getting List of Resources
Filtering the Result of a List
Setting LabelSelector Using the Labels Package
Setting Fieldselector Using the Fields Package
Deleting a Resource
Deleting a Collection of Resources
Updating a Resource
Using a Strategic Merge Patch to Update a Resource
Applying Resources Server-side with Patch
Server-side Apply Using Apply Configurations
Building an ApplyConfiguration from Scratch
Building an ApplyConfiguration from an Existing Resource
Watching Resources
Errors and Statuses
Definition of the metav1.Status Structure
Error Returned by Clientset Operations
RESTClient
Building the Request
Executing the Request
Exploiting the Result
Getting Result as a Table
Discovery Client
RESTMapper
PriorityRESTMapper
DeferredDiscoveryRESTMapper
Conclusion
Chapter 7:Testing Applications Using Client-go
Fake Clientset
Checking the Result of the Function
Reacting to Actions
Checking the Actions
Fake REST Client
FakeDiscovery Client
Stubbing the ServerVersion
Actions
Mocking Resources
Conclusion
Chapter 8:Extending Kubernetes API with Custom Resources
Definitions
Performing Operations in Go
The CustomResourceDefinition in Detail
Naming the Resource
Definition of the Resource Versions
Converting Between Versions
Schema of the Resource
Deploying a Custom Resource Definition
Additional Printer Columns
Conclusion
Chapter 9:Working with Custom Resources
Generating a Clientset
Using deepcopy-gen
Using client-gen
Using the Generated Clientset
Using the Generated fake Clientset
Using the Unstructured Package and Dynamic Client
The Unstructured Type
The UnstructuredListType
Converting Between Typed and Unstructured Objects
The Dynamic Client
Conclusion
Chapter 10:Writing Operators withthe Controller-Runtime
Library
The Manager
The Controller
Creating a Controller
Watching Resources
A First Example
Using the Controller Builder
A Second Example Using the ControllerBuilder
Injecting Manager Resources into the Reconciler
Using the Client
Getting Information About a Resource
Listing Resources
Creating a Resource
Deleting a Resource
Deleting a Collection of Resources
Updating a Resource
Patching a Resource
Updating the Status of a Resource
Patching the Status of a Resource
Logging
Verbosity
Predefined Values
Logger Name
Getting the Logger from Context
Events
Conclusion
Chapter 11:Writing the Reconcile Loop
Writing the Reconcile Function
Checking Whether the Resource Exists
Implementing the Reconciled Resource
Simple Implementation Example
Conclusion
Chapter 12:Testing the Reconcile Loop
The envtest Package
Installing envtest Binaries
Using envtest
Defining a ginkgo Suite
Writing the Tests
Test 1
Test 2
Test 3
Test 4
Conclusion
Chapter 13:Creating an Operator with Kubebuilder
Installing Kubebuilder
Creating a Project
Adding a Custom Resource to the Project
Building and Deploying Manifests
Running the Manager Locally
Personalizing the Custom Resource
Editing the Go Structures
Enabling the Status Subresource
Defining Printer Columns
Regenerating the Files
Implementing the Reconcile Function
Adding RBAC Annotations
Deploying the Operator on the Cluster
Creating a New Version of the Resource
Defining a New Version
Implementing Hub and Convertible
Setting Up the webhook
Updating kustomization Files
Using Various Versions
Conclusion
Index
About the Author
Philippe Martin
has been working with Kubernetes for
five years, first by creating an Operator
to deploy video CDNs into the cloud,
later helping companies deploy their
applications into Kubernetes, then
writing a Client to help developers work
in a Kubernetes environment. Philippe
has passed the CKAD, CKA, and CKS
certifications. He has extensive
experience with distributed systems and
open-source software: he started his
career 20 years ago creating thin clients
based on the Linux kernel and open-
source components. He is currently
working at Red Hat on the Development
Tools team.
Philippe has been active in the development of Kubernetes,
especially its documentation, and participates in the translation of the
official documentation into French, has edited two reference books
about the Kubernetes API and kubectl, and is responsible for the
French translation of the Kubernetes Dashboard. He participated in
Google Season of Docs to create the new Kubernetes API Reference
section of the official documentation and is maintaining it.
About the Technical Reviewers
Bartosz Majsak
writes code for fun and profit while
proudly wearing a red fedora (also
known as the Red Hat). He has been
long-time open-source contributor and
Java developer turned into Golang
aficionado. Bartosz is overly enthusiastic
about coffee, open source, and speaking
at conferences, not necessarily in that
order. One thing that perhaps proves he
is not a total geek is his addiction to
alpine skiing (and running).
Prasanth
is a Blockchain Certified Professional,
Professional Scrum Master, and
Microsoft Certified Trainer who is
passionate about helping others learn
how to use and gain benefits from the
latest technologies. He is a thought
leader and practitioner in Blockchain,
Cloud, and Scrum. He also handles the
Agile Methodology, Cloud, and
Blockchain technology community
initiatives within TransUnion through
coaching, mentoring, and grooming
techniques.
Prasanth is an adjunct professor and
a technical speaker. He was selected as a speaker at the China
International Industry Big Data Expo 2018 by the Chinese government
and also was invited to the International Blockchain Council by the
Government of Telangana and Goa. In addition, he received accolades
from the Chinese government for his presentation at China
International Industry Big Data Expo 2018. Prasanth has published his
Patent, entitled “Digital Educational Certificate Management System
Using IPFS-Based Blockchain.”
To date, he has interacted extensively, reaching more than 50,000
students, mostly within the technical domain. Prasanth is a working
group member of the CryptoCurrency Certification Consortium, the
Scrum Alliance, the Scrum Organization, and the International Institute
of Business Analysis.
© The Author(s), under exclusive license to APress Media, LLC, part of Springer
Nature 2023
P. Martin, Kubernetes Programming with Go
https://doi.org/10.1007/978-1-4842-9026-2_1
2. The etcd database – this is only accessible by the API Server, is used
to persist the data relative to resources.
OpenAPI Specification
The Kubernetes API is an HTTP REST API. The Kubernetes team
provides a specification for this API in the OpenAPI format, either in v2
format at
https://github.com/kubernetes/kubernetes/tree/mast
er/api/openapi-spec or in Kubernetes v1.24, in v3 format, at
https://github.com/kubernetes/kubernetes/tree/mast
er/api/openapi-spec/v3.
These specifications also are accessible from the API Server at these
paths: /openapi/v2 and /openapi/v3.
An OpenAPI specification is made up of various parts and, among
these, are a list of paths and a list of definitions. The paths are the URLs
you use to request this API, and for each path, the specification gives
the distinct operations such as get, delete, or post. Then for each
operation, the specification indicates what are the parameters and body
format for the request, and what are the possible response codes and
associated body format for the response.
The parameters and bodies for requests and responses can be
either simple types or, more generally, structures containing data. The
list of definitions includes data structures that help build the
parameters and bodies for the operations’ requests and responses.
Figure 1-2 is a simplified view of a specification for a User API. This
API can accept two different paths: /user/{userId} and /user. The first
path, /user/{userId}, can accept two operations, get and delete,
respectively, to receive information about a specific user, given its user
ID; and to delete information about a specific user, given its user ID. The
second path, /user, can accept a single operation, post, to add a new
user, given its information.
In this API, a definition of a structure User is given, describing the
information for a user: its ID, first name, and last name. This data
structure is used in the response body of the get operation on the first
path, and in the request body of the post operation on the second path.
Figure 1-2 A simplified user API specification
Group-Version-Resource
The Kubernetes API is a REST API, and as a result of that it manages
Resources, and the paths to manage these resources follow the REST
naming conventions—that is, by using a plural name to identify a
resource and by grouping these resources.
Because the Kubernetes API manages hundreds of resources, they
are grouped together, and because the API evolves, the resources are
versioned. For these reasons, each resource belongs to a given Group
and Version, and each resource is uniquely identified by a Group-
Version-Resource, commonly known as GVR.
To find the various resources in the Kubernetes API, you can browse
the OpenAPI specification to extract the distinct paths. Legacy
resources (e.g., pods or nodes) will have been introduced early in the
Kubernetes API and all belong to the group core and the version v1.
The paths to manage legacy resources cluster-wide follow the
format /api/v1/<plural_resource_name>—for example,
/api/v1/nodes to manage nodes. Note that the core group is not
represented in the path. To manage resources in a given namespace, the
path format is
/api/v1/namespaces/<namespace_name>/<plural_resource_nam
e>—for example, /api/v1/namespaces/default/pods to manage
pods in the default namespace.
Newer resources are accessible through paths following the format
/apis/<group>/<version>/<plural_resource_name> or
/apis/<group>/<version>/namespaces/<namespace_name>/<plu
ral_resource_name>.
To summarize, the formats of the various paths to access resources
are:
/api/v1/<plural_name> – to access legacy non-namespaced
resources
Ex: /api/v1/nodes to access non-namespaced nodes resources
or
To access legacy namespaced resources cluster-wide
Ex: /api/v1/pods to access pods across all namespaces
/api/v1/namespaces/<ns>/<plural_name> – to access legacy
namespaced resources in a specific namespace
Ex: /api/v1/namespaces/default/pods to access pods in the
default namespace
/apis/<group>/<version>/<plural_name> – to access non-
namespaced resources in specific group and version
Ex: /apis/storage.k8s.io/v1/storageclasses to access non-
namespaced storageclasses (group storage.k8s.io, version v1)
or
To access namespaced resources cluster-wide
Ex: /apis/apps/v1/deployments to access deployments across
all namespaces
/apis/<group>/<version>/namespaces/<ns>/<plural_name> – to
access namespaced resources in a specific namespace
Ex: /apis/apps/v1/namespaces/default/deployments to
access deployments (group apps, version v1) in the default
namespace
Sub-resources
Following the REST API convention, the resources can have sub-
resources. A sub-resource is a resource that belongs to another and can
be accessed by specifying its name after the name of the resource, as
follows:
/api/v1/<plural>/<res-name>/<sub-resource>
Ex: /api/v1/nodes/node1/status
/api/v1/namespaces/<ns>/<plural>/<res-name>/<sub-resource>
Ex: /api/v1/namespaces/ns1/pods/pod1/status
/apis/<group>/<version>/<plural>/<res-name>/<sub-resource>
Ex: /apis/storage.k8s.io/v1/volumeattachments/volatt1/status
/apis/<grp>/<v>/namespaces/<ns>/<plural>/<name>/<sub-res>
Ex: /apis/apps/v1/namespaces/ns1/deployments/dep1/status
Most Kubernetes resources have a status sub-resource. You can see,
when writing operators, that the operator needs to update the status
sub-resource to be able to indicate the state of this resource observed
by the operator. The operations that can be executed in the status sub-
resource are get, patch, and update. The Pod has more sub-resources,
including attach, binding, eviction, exec, log, portforward, and
proxy. These sub-resources are useful for getting information about a
specific running pod, or executing some specific operation on a running
pod, and so on.
The resources that can Scale (i.e., deployments, replicasets, etc.)
have a scale sub-resource. The operations that can be executed in the
scale sub-resource are get, patch, and update.
Rolf's studies in the matter of charades had taken on such a serious character, that he
could frequently be seen running up and down the garden paths with hands folded behind
his back. At such times, little Hun had to be kept out of his way, because Rolf had several
times actually run into the small boy and thrown him down.
Rolf enjoyed preparing his intricate charades for Mr. Titus, who was not only interested,
but apparently found great pleasure in Rolf's scholarly turn of mind. The learned man, by
being able to guess the most obscure historical names on the spot, urged the boy to
greater and more constant efforts, and besides awakened the lad's zeal for Latin by
composing rhymed charades in that language.
These were written down and were meant to be studied most carefully. Rolf read these
regularly to Jul and his father, but neither could ever guess them. His father had forgotten
his Latin too much for such work, while Jul was of the opinion that such useless exertions
were not healthy in the holidays. He had to keep his mental vigor undiminished till he took
up his own work at school again.
Rolf, on the contrary, puzzled and searched for the sense by looking through his Latin
dictionary and did not give up till he at last found the solution. This he would triumphantly
reveal to his father and Jul, and finally to Mr. Titus in the evening. The friendly man always
showed himself almost more pleased at Rolf's success, than the boy was himself, helping
him in that way to great progress in his Latin studies. He began these studies quite early in
the morning, and it seemed as if he could not imbibe enough knowledge.
Little Hun also passed very happy days. Whatever time and however often he came to
Dora and demanded her attention, she never pushed him aside nor ran away, but in the
most kindly manner entertained him, as if she herself found great pleasure in his company.
Mrs. Birkenfeld had begged Aunt Ninette to let Dora be free all morning and evening, and
let her sew in the afternoons, when the whole family was gathered under the apple tree.
Dora here realized that sewing shirts was a most pleasant occupation when one worked in
nice surroundings.
In that way, Hun had Dora to himself many hours of the day, when no one had time to
interfere. Dora had made a new riddle for her little friend, too, so he need not repeat his
old one of the nutcracker forever. He was determined to dish up charades to everybody,
and his triumph was complete, when no one in the house could solve it. Running
persistently from one to another, he was glad they could not say as before, "Go away, Hun,
and don't keep on repeating your stupid old charade." Every time they made a mistake, he
leaped for joy, and he and Dora pledged each other not to give anyone a clue.
But Hun joyfully hopped about, crying, "You are wrong, you are wrong, Jul!"
Miss Hanenwinkel said, "It is music lesson. Music makes everybody cry. In the lesson,
many cry and many denials have to be made during the lessons."
"Couldn't it be bedtime?" said the mother. "All children cry in bed some time or other,
some cry when the time comes, and all deny bedtime has come."
"Mamma can't guess it, either; mamma doesn't know," jubilated the little fellow, leaping
about.
"It might be leave-taking," said the father. "Leave-taking makes everybody cry, taking
some children away makes some cry and at Dora's leave-taking, everybody is sorry."
"Papa can't guess it either, papa can't guess it!" rejoiced the small boy, jumping merrily
around the room, for it gave him the keenest pleasure that even his father had missed it.
The happy possessor of the great secret could still dash from one member of the family to
another and puzzle them all.
Rolf was much put out, that Hun's foolish charade should attract so much attention without
ever getting solved.
"My dear Ninette," Uncle Titus said at breakfast one day, "we have only one more week,
but I think we ought to add two more weeks to our stay, for I feel so well here. My dizzy
spells have completely left me, and there is new vigor in my limbs."
"One can easily see that, dear Titus," replied his wife, delighted. "You look at least ten
years younger than when we came."
"It seems to me, our new mode of life suits you also, dear, for I have not heard you
complain for a long time now."
"That is true. Everything seems all changed somehow," answered Aunt Ninette. "The noise
the children make is not a bit bad, when one knows them all, and I am glad we did not
move from here. I even begin to miss it, when I do not hear their merry voices, and things
do not seem quite right, when there is no noise in the garden."
"That's exactly the way I feel," agreed Uncle Titus. "I enjoy the lively boy so much, when
he comes running to me every night. He can hardly control his eagerness to tell me what
he has composed, and when I set him my task, he drinks in every word I say. It is pure
pleasure to have such a boy to talk to."
"My dear Titus, how enthusiastic you are! That makes you seem younger than I have ever
known you. We had better stay here as long as we can afford it," the aunt concluded.
"Even our doctor could never have predicted such an improvement from our journey. It is
just wonderful."
Immediately after this conversation, Dora rushed over to her friends, spreading the happy
news. The prospect of her near departure had been a perfect nightmare to the child, and
she felt like dying rather than living so far away from all the intimate friends she loved so
dearly. Dora anticipated a broken heart on the day of their separation. As soon as the
children heard about their playmate's lengthened stay, they crushed Dora from sheer
transport and noisily expressed their happiness.
That same evening, when the children had gone to bed and Miss Hanenwinkel had retired,
Mr. and Mrs. Birkenfeld, according to their daily custom, sat together on the sofa, talking
over their common problems. They mentioned the fact that their neighbors were
lengthening their stay, and after expressing her joy, the mother concluded with these
words:
"I actually dread the day when we shall lose the child, and it is not very far off. It is
impossible to say what a blessing Dora has been to our household, and it is evident at
every step. I keep on discovering new traces of her good influence all the time. I don't
quite know why the child attracts me so much. All I can say is that a world of memories
stirs in me, whenever I look into her eyes. I don't pretend to understand it."
"My dearest wife, you think this every time you grow fond of a person," Mr. Birkenfeld
interposed. "I can remember quite well that you thought we must have stood in some
incomprehensible relationship long ago, when you just knew me a short time."
"However that may be, you bad, sarcastic husband," she retorted, "I suppose the solid
reasons this time are enough. You can't deny that Dora is very dear and charming. I love
her, and I know how many of the pleasant changes in our household are due to her. Paula
goes about like a ray of sunshine, there is not a trace left of her moodishness and bad
humor. Jul takes off his riding boots himself without disturbing the whole household, and
Rolf is so eager at his studies, that he does not waste a minute of the day. Lili has
developed a diligence and ability for music that surprises everybody, while Hun is always
pleasantly occupied, and looks so merry, that it is a joy to see him."
"Can the fact that the twins have not perpetrated any evil deeds lately be due to Dora,
too?" asked Mr. Birkenfeld.
"Doubtless," the wife answered. "Dora has somehow awakened Lili's enthusiasm for music,
and the lively child is putting all her energies into playing now. Willi does the same, and in
that way the two are kept out of mischief."
"Dora is really a curious being. Too bad she is leaving us," said Mr. Birkenfeld, quite
regretfully.
"I regret it so much, too," his wife continued, "and I keep on wondering how we could keep
them here a little longer."
"We can't," replied the husband, "for we don't know them well enough. We must let them
go, but if they come back another year, something might be done about it."
Mrs. Birkenfeld sighed as she thought of the long winter and the uncertainty of their
return.
The days passed by quickly, and the last week of Dora's stay had come. They were to
leave on Monday, and the Sunday before a supper party was to take place, though
everyone felt far from festive. Rolf alone was making eager preparations, which consisted
in hanging up several charades, made transparent by multicolored lights, in the garden
house in honor of his kind patron.
Dora sat down to lunch with the children on Saturday, and not much appetite was
displayed by anybody. When the mother was helping them to their soup, several voices
said, "Please, very little;" "Only a tiny bit for me;" "Not much for me;" "Better none for me
at all." "None for me at all, please."
"I'd like to know if you all deny yourselves, because the grief of the near parting is so
intense, or is it that the onion soup does not suit you?"
"Onion soup, oh, onion soup! Now I know the answer to Hun's charade," cried Rolf,
delighted at the victory, for he had hardly been able to bear the humiliation of not
guessing it before.
Little Hun, who sat mournfully on his chair, said, "Oh, papa, if only you had not said that
we deny ourselves this onion soup! Then nobody would ever have guessed my charade.
Oh, all is over now!"
But Dora, who sat beside him, had consolation as always for the little one. She whispered
in his ear, "It is not all over, Hun. This afternoon, I'll guide your hand and you can write
your charade in my album. I'll give it to lots of people in Karlsruhe who know nothing
about it."
That proved a comfort to the little boy, and he finished his lunch without a scene.
Afterwards, all gathered under the apple tree as usual, except that the children were far
from happy, as it was to be the last time that Dora would sit amongst them. Tomorrow she
had to help her aunt with packing, and would only be over in the evening with both her
relatives.
Paula's eyes were filled with tears and she could not speak. Lili expressed her grief by
wriggling nervously around, but at last she burst out passionately, "Oh, mamma, I don't
want to play the piano any more when Dora goes. It will be so tiresome then, for Miss
Hanenwinkel will just say that I am dreadfully lazy. I won't care for anything any more;
nothing will be fun then."
"Oh, dear!" sighed Jul. "We are nearing hard and dangerous times as soon as the twins
find life tiresome again. I can really see no reason for Dora to depart," he continued. "It
would do her a lot of good to stay till winter time. Why doesn't she? Her uncle and aunt
can go back to their peaceful home in Karlsruhe alone."
The mother at once replied that she would beg for such a permission another year. For the
present, they had to be resigned to this separation which she herself was dreading, too.
Little Hun alone was more immediately concerned with the present than with the unknown
future and remained content. Pulling Dora's apron, he kept begging, "Please get your book
for me, Dora. I want to write now."
The girl went to the house to fetch her album and asked all her dear friends to write a little
verse in it for her, according to the good old custom. Her album looked far from elegant. It
was very old, the pages were yellowed by age and the ink was faded. Here and there little
bunches of discolored flowers, with hardly any petals, were pasted in. All the songs and
verses were written by a child's hand, having belonged to Dora's mother in her youth.
Several funny little drawings enlivened the pages, and one of a little house and a tiny man
near a fountain especially attracted Hun's attention.
After turning several more pages, he said with a knowing air, "Mamma has that, too!"
Then pulling out a narrow slip of paper, he declared, "This belongs to Lili, whom I have to
bring back from America."
Jul burst out laughing. "What wonderful tales are you inventing for Dora now, young Hun?"
The mother, after a rapid glance at her youngest child, looked at the paper. Suddenly tears
rushed to her eyes, and dear old memories of past days rose vividly before her, especially
the merry face of her beloved Lili. She was completely overcome, for it brought back all
her childhood days, the image of her own sweet mother, long years ago laid in the grave,
and all the vanished years of her youth, gone so irrevocably.
As soon as she saw the paper, she recognized it as the second half of the little verse she
and Lili had composed together. Unable to read aloud from sheer emotion, she handed to
her husband the paper joined to her own half, which she drew out of the notebook where
she had kept it, ever since it had been found a few weeks before. The children whispered
to each other and with suspense, watched their father as he joined the two slips of
yellowish gray paper, which together formed a sheet of writing paper of the usual size.
They were written by the same childish hand, and the sense was now quite clear.
After looking the sheet over a little, the father read aloud as follows:
The mother had grasped Dora's hand. "Where did you get that little paper, darling?" she
asked with great emotion.
"It is my mother's album, and that paper was always in it," answered Dora, surprised.
"Oh, Dora, you are my beloved Lili's child!" exclaimed the mother. "Now I understand why
I always thought of the past when I looked at you."
The children felt excited, too, but seeing their mother so profoundly moved, they
controlled their emotions and remained silently in their seats, their glances fastened on
Dora and the mother.
Little Hun at last broke the silence: "Won't I have to go to America now, mamma?" he
asked, visibly relieved at the prospect of being able to stay at home, for after giving his
rash promise he had felt a little scared at the thought of going to America alone.
"No, you won't have to go. We shall all stay here," replied the mother, turning towards the
children with Dora's hand in hers. "Dora is Lili's little girl, whom you wanted to find."
"Oh, mamma!" cried Paula with unusual vivacity, "Dora and I will continue everything you
began with Lili. Then we'll also be able to say like you:"
But the mother had already seized the father's arm and had disappeared with him under
the trees.
"Yes, of course, I am satisfied, I am perfectly satisfied," repeated the father several times
to a question his wife was asking. Then they separated, and the mother went to the little
neighboring cottage, where she asked at once for Aunt Ninette. She related to Mrs.
Ehrenreich that she had just discovered, to her great joy, that Dora was the child of the
best and dearest friend of her youth, whom she had mourned for many years. She knew
that her friend had died, but hoped to hear more details about her life and Dora's
circumstances.
Mrs. Birkenfeld, as well as Aunt Ninette, had been reluctant till now to mention this last
very delicate subject. Mrs. Birkenfeld could not find out as much about Lili as she had
hoped, for Aunt Ninette had never known her. Her brother, who had lived in America for
several years, had met and married Lili in that country, and after returning to Hamburg,
had lost her soon after Dora's birth.
Mrs. Birkenfeld told Aunt Ninette how much gratitude she owed to Lili's family for all the
happiness she had enjoyed at their house. The acquaintance with Lili had, in fact, shaped
her whole future, and she wished to repay this debt. With this, she came to the chief
object of her visit, namely, the request to be allowed to adopt Dora and raise her just like
one of her own children.
No opposition was made to this, as Mrs. Birkenfeld had feared might be the case. On the
contrary, Aunt Ninette was only too glad that Dora, who had been left practically destitute,
should have found such generous friends. Sheer necessity would have obliged the child to
begin earning her livelihood at once as a seamstress, which was a dreary outlook for the
future. As she and her husband had not the means to furnish Dora with a higher
education, the new prospect was most welcome, and she was quite sure her husband
would not oppose it either.
Mrs. Birkenfeld, after heartily pressing Aunt Ninette's hand, hastened away, in order to tell
everybody the glad news. Her heart thrilled at the thought of her children's joy, for she
knew how fond they were of Dora.
They were still gathered under the apple tree, and all eyes were turned towards her in
suspense, for they were sure that she was planning some pleasant surprise, possibly even
a visit from Dora at their house.
When the mother told them that Dora would actually belong to the family from this time
on, and would be their sister always, such cries of transport and delight broke forth that
they penetrated into the furthest recesses of the garden. Uncle Titus stepped out of his
summer house, and smiling happily at their merry exclamations, said to himself, "Too bad
we have to go so soon."
Aunt Ninette, standing at her open window, looked down into the garden and listened with
delight to the children's outbreaks. She even quietly murmured to herself, "We'll miss it,
when we can't hear them any more."
The children felt in such a festive mood, that they planned the most elaborate celebrations
for the coming evening, and decided to have a feast such as the garden had never seen
before.
Dora entered her little chamber for the last time that night as in a dream. Tomorrow she
was to become a permanent inmate of the big house, and the merry children whom she
had at first watched with such longing were to be her brothers and sisters. The beautiful
garden for which she had also pined was to be her playground, and she was to have a
father and mother again who would carefully and lovingly watch over her. She would share
the children's pleasures as well as their studies, for Lili had announced to her solemnly
that she was to have real music lessons from now on. This made her especially happy.
All these thoughts flooded Dora's heart, and filled her with such happiness that she felt
unable to bear it. Her father in Heaven was probably looking down at her and rejoicing
with her. When she stood at the open window and looked up at her beloved stars, which
gleamed so brightly, she remembered the dark hours when she had looked at them sadly
and had forgotten then that her dear God in Heaven was guiding her. Dora fell on her
knees and thanked the good God from the bottom of her heart for His kind providence,
resolving from that hour, never to forget her father's favorite verse. Whatever life should
bring, whatever anxiety would oppress her in the future, she resolved to say confidently:
Uncle Titus and Aunt Ninette engaged their rooms again for the next summer and were
already actually looking forward to their return. Uncle Titus even went so far as to extract
a promise from Mrs. Kurd never to let her rooms during the summer to anybody else. He
had felt so wonderfully well in her cottage, that he left it with many regrets and meant to
come back.
On Monday morning, the whole family was gathered around the packed travelling carriage,
and a hearty leave-taking took place on all sides. Rolf at the last moment, led Uncle Titus
apart, and asked him eagerly if he might send a charade to Karlsruhe now and then. To
this, Uncle Titus gave the most friendly assurance that this would please him greatly, and
he promised to send the answers promptly.
Sly little Hun, who had heard the conversation, also declared at once, "I'll send mine, too!"
Never doubting but that Mr. Titus's joy would be still greater then. He also thought to
himself that the people of Karlsruhe would never in their lives guess his original charade,
which gave him great satisfaction.
Dora and Paula returned to the garden, arm in arm, singing gaily:
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth in
paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.