Kubernetes Programming with Go: Programming Kubernetes Clients and Operators Using Go and the Kubernetes API 1st Edition Philippe Martin instant download
Kubernetes Programming with Go: Programming Kubernetes Clients and Operators Using Go and the Kubernetes API 1st Edition Philippe Martin instant download
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/japan-occupied-survival-of-
academic-freedom-1st-edition-ruriko-kumano/
Complex Sport Analytics 1st Edition Felix Lebed
https://ebookmeta.com/product/complex-sport-analytics-1st-
edition-felix-lebed/
https://ebookmeta.com/product/aviation-week-space-technology-
september-26-october-9-volume-184-number-19-2022-1st-edition-
collective-of-authors/
https://ebookmeta.com/product/talent-management-in-practice-an-
integrated-and-dynamic-approach-1st-edition-marian-thunnissen/
https://ebookmeta.com/product/religion-of-democracy-an-
intellectual-biography-of-gerald-birney-smith-1868-1929-1st-
edition-w-creighton-peden/
https://ebookmeta.com/product/revisiting-sexualities-in-the-21st-
century-1st-edition-constantinos-n-phellas/
The Rust Programming Language 2nd Edition Steve Klabnik
https://ebookmeta.com/product/the-rust-programming-language-2nd-
edition-steve-klabnik/
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
Another Random Scribd Document
with Unrelated Content
prohibition, they absented themselves of their own accord under
various pretexts. Fouché, the Minister of Police, called on her, and
insinuated that a brief retirement into the country would be
advisable, as giving the storm time to blow over. She took the hint,
and retired for a short time to St. Ouen. On her return to Paris she
avers that she did not find Napoleon’s wrath at all appeased.
Apparently she expected it to die a spontaneous death, for she did
not adopt the only means by which she could have pacified him, but
continued to applaud, if not instigate, an active hostility to his
measures. It would have been grand and magnanimous of Napoleon
to have despised the enmity of a woman, but he was neither grand
nor magnanimous. Moreover, the last thing which Madame de Staël
probably desired was to be despised. Nobody can deny her the
meed of admiration which she deserved for her love of liberty, and
the indomitable spirit with which, when in exile, she refused to
conciliate her oppressor by one word of praise. But, inasmuch as she
knew with whom she had to deal, and what would be the
consequence of her actions, one must admit that the amount of pity
which she claimed for herself, and has generally received, is
excessive. She was in direct contradiction to her own theories of a
woman’s true duty, when interfering in politics; and in being treated
by Napoleon as a man might have been, she paid the penalty of the
splendid intellect which emancipated her from the habits and the
views, if not from the weaknesses, of her sex. She was neither
helpless nor harmless, since she could stir up enemies to the tyrant
by her eloquence, and revenge herself, when punished, by the
power of her pen. She was exiled not because she was a woman
and defenceless, but because she was a genius and formidable. She
deliberately engaged in a contest of which the object was to prove
who was the stronger—herself or Napoleon.
She came out of it scarred, but dauntless. What right had she to
complain because the weapons that wounded her were keen?
Besides, paltry as Napoleon showed himself in many respects, he
was a phenomenon of so exceptional a nature that to judge him by
ordinary standards was absurd. It was the weakness of France which
made his opportunity; and if the epoch had not been abnormal, he
never could have dominated it. The people whom he governed had
two courses open to them: to submit or to protest. The first brought
profit, the second glory; and the glory which is purchased by no
sacrifice is unworthy of the name.
In 1801 Madame de Staël published her work on Literature, in
which, as she says, there was not a word concerning Napoleon,
although “the most liberal sentiments were expressed in it with
force.” The book produced an immense sensation; and Parisian
society, in its admiration for the writer, forgot the First Consul’s
displeasure, and again crowded round her. She admits that the
winter of 1801 was a pleasant one. Napoleon, passing through
Switzerland the previous summer, had seen and spoken with M.
Necker. It is characteristic of both interlocutors that the ex-
statesman was far more impressed with the warrior than the latter
with him. Necker divined in the young hero a strength of will to
which his own hesitating nature was a stranger; while Napoleon, on
his side, penetrating but prejudiced, contemptuously described the
once august financier in two words, “A banker and an Idealist.” With
his usual cynicism, he attributed Necker’s visit to the desire of
employment; whereas Madame de Staël affirmed that her father’s
chief object was to plead her cause. In this he was so far successful
that residence in France was for some time at least assured to her.
“It was,” she writes, “the last time that my father’s protecting hand
was extended over my life.” For the moment, either this beneficent
influence, or, as is more likely, a passing fit of good humor on the
part of Napoleon, enabled her to enjoy existence. Fouché consented
to recall several émigrés for whom she interceded, and even Joseph
Bonaparte once again treated her with cordiality, and entertained
her for a little time at his estate at Morfontaine.
A variety of circumstances arose to put an end to this state of
things and to revive Napoleon’s dislike to Madame de Staël. Her
father published his work, Dernières Vues de Politique et de Finance,
with the avowed intention of protesting against Napoleon’s growing
tyranny. His daughter had encouraged him in this feeling, herself
unable, as she declares, to silence this “Song of the Swan.” Then
Bernadotte had inaugurated a certain sullen opposition to the First
Consul, and Madame de Staël immediately became his friend. Finally,
her salon was more crowded than ever, and by great personages,
such as the Prince of Orange and other embryo potentates, besides
foreigners of celebrity in letters and science.
Napoleon detested salons. It was his conviction that a woman who
disposed of social influence might do anything in France, inasmuch
as he held that the best brains in the country were female. Madame
de Staël, moreover, possessed the art of keeping herself well before
the public. Even now she had just published Delphine, and all the
papers were full of it. To please Napoleon, they condemned it as
immoral—a strange criticism in that age, and an excellent
advertisement in any.
Napoleon, on Madame de Staël’s again visiting Switzerland, hinted
to Lebrun that she would do well not to return to Paris. His
obsequious colleague hastened to intimate this by letter; and
although the communication was not official, the First Consul’s
lightest intimations by this time carried so much weight that
Madame de Staël was compelled to obey. She did so very
reluctantly; and perhaps if her father’s prudence had not been
greater than her own, her longing to be back in the capital would
have overpowered every other consideration. As it was, she made
the best that she could of a year’s uninterrupted sojourn at Coppet.
The Tribunat meanwhile had shown itself again rebellious.
Bonaparte, irritated, declared that he would shake twelve or fifteen
of its members “from his clothes like vermin,” and Constant had no
choice but to rejoin his friend in Switzerland.
CHAPTER IX.
NEW FACES AT COPPET.
Madame de Staël sought to solace her grief for her father’s death
by writing “The Private Life of Necker,” a short sketch intended to
serve as preface to a volume of his fragmentary writings. Constant
spoke very feelingly of this sketch, and pronounced it to be a
revelation of all that was best in the writer’s head and heart. He said
that all her gifts of mind and feeling were here devoted to express
and adorn a single sentiment, one for which she claimed the
sympathy of the world.
This is all quite true, but it is natural that the sketch should affect
us less than it did Madame de Staël’s contemporaries. Necker was a
good and intelligent man. He had varied talents of no common order,
and an incorruptibility of character which would be rare—given the
circumstances—in any age, and, by his admirers, was supposed to
be especially so in his. But joined to all these qualities in him were
just the foibles which spoil an image for posterity. He had a profound
compassion for what he considered the hardships of his lot. It is
touching to read the way—so simple, loving, and yet ingenuous—in
which Madame de Staël records such facts as the following:—“It was
painful to him to be old. His figure, which had grown very stout and
made movement irksome to him, gave him a feeling of shyness that
prevented his going into society. He hardly ever got into a carriage
when anybody was looking at him, and he did not walk where he
could be seen. In a word, his imagination loved grace and youth,
and he would say to me sometimes, ‘I do not know why I am
humiliated by the infirmities of age, but I feel that it is so.’ And it
was thanks to this sentiment that he was loved like a young man.”
For the rest, the sketch is one long impassioned elegy in prose.
One is astonished at the sudden creative force of expression in it. It
is graphic by mere power of words without any help from metaphor.
It was not in Madame de Staël’s nature to mourn in solitude, and
we have Bonstetten’s authority for the fact that the summer of 1804
was one of the most delightful which he had ever passed at the
Château. Schlegel, Constant, Sismondi, were all there, as well as
Bonstetten, himself, and Madame Necker de Saussure, now more
than ever devoted to her cousin. Madame de Staël had also a new
visitor, Müller, the historian, whose learning was stupendous, and
who wrangled from morning till night on subjects of amazing
erudition with Schlegel. The mistress of the house, although far from
being the equal of the two combatants in learning, sometimes
rushed between them with her fiery eloquence, like an angel with a
flaming sword; but most of the society were reduced to silence.
Sismondi felt a perfect ignoramus, and talked plaintively to
Bonstetten of going to Germany, there to drink in facts and theories
at the source of the new intellect. In short, the German “Revival”
was beginning, and Madame de Staël in bringing Auguste Schlegel
to Switzerland had broken a large piece off the mountain of learning,
like somebody in the fairy tale who carried away a slice from the
Island of Jewels.
In October, 1804, Madame de Staël started with Schlegel and her
three children for Italy, and it is to this journey that the world owes
Corinne. It is said that Schlegel first taught Madame de Staël to
appreciate art—that is, painting, sculpture, and architecture. For
music she had always had a passion, and both sang and played
agreeably. But plastic beauty had as yet been a sealed book to her,
and she had not even any great appreciation of scenery. A
spontaneous feeling for all these she perhaps never acquired. Ste.
Beuve, indeed, complains that the spot on Misenum where she
places Corinne on one occasion, was the least picturesque of many
beautiful points of view. Nevertheless, Italy revived her. She found
hope and thought and voice anew beneath that magic sky. There
was nothing but the still-abiding sense of loss to mar the pleasure of
her visit. The diplomatic agents of Napoleon abstained from
interference with her, and Joseph had given her letters introducing
her to all the best society in Rome. Unlike her own Corinne, however,
she found it very uninteresting, and wrote complainingly to
Bonstetten that Humboldt was her most congenial companion. The
Roman princes she found extremely dull, and preferred the
cardinals, as being more cultivated, or more probably more men of
the world. For the rest, she was received with the liveliest respect,
and even enthusiasm; was made a member of the Arcadian
Academy, and had endless sonnets written upon her. Unfortunately,
her Dix Années d’Exil does not speak of this Italian journey, and so,
for the impression she received, one has to turn to Corinne, where,
of course, everything reappears more or less transfigured. One
would have liked to know the genesis of that work, on what occasion
it took root, and how it grew, in Madame de Staël’s mind. How much
did she really know of that poor, lampooned, insulted, and squint-
eyed Corilla who was the origin of her enchanting Sibyl? How far
below the surface did she really see of that strange Roman world, so
cosmopolitan, so chaotic after the French invasion, so thrilled with
fugitive novel ideas, so steeped in time-worn apathy? It would be
delightful to know what was the impression which Madame de Staël
herself produced in the few salons where a little culture prevailed,
and what was the true notion concerning her in that motley and
decaying society of belated Arcadians, exhausted cicisbei and abatini
lapsed forever from the genial circles where their youth had passed
in gossiping and sonneteering.
Hers must have seemed a curious and forcible figure among all
those frivolous “survivals”; and great and strange, mad and merry as
were the many foreigners who found their way at various times to
Rome, probably no more striking couple ever appeared there than
Madame de Staël and Auguste Schlegel.
As soon as she returned to Switzerland she began Corinne. At
Coppet some of her old circle immediately gathered round her again:
Madame Necker de Saussure, of course, and Madame Rilliet-Hüber,
Schlegel, Constant, and Sismondi, assembled to enjoy her society
once more. The private theatricals in which she delighted were again
resumed, and such tragedies as Zaire and Phèdre performed, as well
as slight comedies composed by the châtelaine herself. Madame de
Staël was fond of acting; and although she had no special talent, her
imposing presence, and the earnestness with which she played,
made her performance a pleasing one—at any rate, to her admirers.
When Corinne was drawing to an end, its authoress could no
longer resist her old and recurring temptation to return to France.
She went first to Auxerre; then, profiting by the indulgence of
Fouché, who, when it was possible (and politic), always shut one
eye, she accepted an invitation to Acosta, a property near Meulon
belonging to Madame de Castellane. Some of her old friends
ventured there to visit her, and in peace and reviving hope she
completed Corinne. It was no sooner published than it was hailed
with universal applause.
All this success annoyed Napoleon, possibly because it revealed in
his enemy greater powers than he had hitherto suspected, hence a
greater influence with all enlightened minds. According to some, an
article which appeared in the Moniteur attacking Corinne was written
by the Imperial hand. And this first sign of ire was followed by a new
decree of banishment, which sent Madame de Staël back to Coppet.
There a few new figures came to join the usual set, among them
Prince Auguste of Prussia, who straightway fell a victim to Madame
Récamier. For a few weeks this love affair introduced a new element
of romantic, yet very human, interest into the intensely intellectual
life of Coppet. The Prince wished Madame Récamier to marry him;
and for a short time, either dazzled by the prospect of such splendor,
or really attracted by her royal wooer, she hesitated. But such a step
would have involved a divorce from M. Récamier. He was old; he had
lately lost his fortune; he had always been good to her; and Juliette
made up her mind that it would be too unkind to leave him.
Some other scenes not altogether literary were passing just then
in the Château. The relations between Madame de Staël and
Constant, of late much strained, had now become constantly stormy.
Sismondi, some years later, in writing to the Countess of Albany,
referred to them as really distressing, and apparently Madame
Récamier was in the flattering but uncomfortable position of having
to listen to and, as well as she could, soothe both parties.
Constant would have married Madame de Staël, but she desired a
secret marriage, and he would only hear of an open one. It was only
in 1808 he finally put an end to his perplexities by marrying
Charlotte von Hardenberg. He carefully avoided telling Madame de
Staël of his intention beforehand, being still too much under her
influence to bear her criticisms and possible reproaches with
equanimity.
About November, 1807, Madame de Staël had returned again to
Germany, accompanied by two of her children, by Constant,
Sismondi, and Schlegel. From Munich she wrote one of her
characteristic letters to Madame Récamier:—
“I have spent five days here, and I leave for Vienna in an hour.
There I shall be thirty leagues farther from you and from all who are
dear to me. All society here has received me in a charming manner,
and has spoken of my beautiful friend with admiration. You have an
aerial reputation which nothing common can touch. The bracelet you
gave me [this bracelet contained Madame Récamier’s portrait] has
caused my hand to be kissed rather oftener, and I send you all the
homage which I receive.”
In another she significantly remarks:—
“The Prince de Ligne is really amiable and good above all things.
He has the manners of M. de Narbonne, and a heart. It is a pity he
is old, but all that generation fill me with an invincible tenderness.”
This is one of her touching allusions to her father, of whom all
“good gray heads” reminded her. But the Prince de Ligne and Necker
were two very different people. The former was the ideal of a grand
seigneur, clever, brave, handsome, all in a supreme degree; the
descendant of a chivalrous race, and as gallant and noble himself as
any of them. He was extremely witty, and quickly achieved the
conquest of the Empress Catherine when he was sent on a mission
to Russia in 1782. He followed in her suite through the Crimea on
the occasion of her famous journey there with Joseph II., and his
amusing account of this expedition is one of his claims to literary
reputation. The last years of his brilliant life were embittered by the
loss of his property, consequent on the French invasion of Belgium,
and by the death in battle of his eldest and best-beloved son.
Madame de Staël probably enjoyed his society all the more that
the Viennese gentlemen appeared to her singularly uninteresting.
She complained of them in her letters to the Grand Duchess of
Weimar, and also to Madame Récamier, and declared that she felt
the need of a summer at Coppet to indemnify her for the frivolous
monotony of the Austrian capital. She seems to have been in an
unusually depressed state of mind, and recurred perpetually to the
hardships of exile.
In April, 1808, shortly before starting again for Weimar, she
addressed a letter to her former friend, the ungrateful Talleyrand,
begging him to interest himself for the payment of the two millions
left by her father in the French Treasury. She alluded sadly, and at
some length, to all her sufferings again in this letter, and reminded
him that he wrote thirteen years previously to her from America, “If
I must remain even one year longer here I shall die.”
One is not much surprised to divine from subsequent
circumstances that this appeal produced no effect. Amiable, and
even pathetic as it was, Talleyrand was not the man to be moved by
it. Like Napoleon, to whom he perhaps showed it, he would be likely
to think that Madame de Staël’s “exile” was singularly mitigated. It is
one thing to be proscribed and banished, not only from one’s own
country but from friends and fortune; to wander, as so many
illustrious refugees have done, a lonely stranger in a foreign land,
not daring to invoke the protection of any authority, and constantly
eking out a miserable existence by teaching or worse. It is another
thing to be wealthy, influential, admired; to be the guest of
sovereigns, and the honored friend of the greatest minds in Europe;
to be surrounded with sympathy, and followed at every step by the
homage of a brilliant and cultured crowd. Such was the existence of
Madame de Staël. Her sorrows were great because her fiery
temperament rebelled against her grief, at the same time that her
great intellect fed it with lofty and lyric thoughts. But her sorrows
were of the affections exclusively. She never felt the sting of the
world’s scorn, nor knew the bitter days and sleepless nights of
poverty. If she ever “ate her bread with tears,” they were not those
saltest tears of all which are wrung from burning eyes by unachieved
hopes and frustrated endeavor. Every field of social and intellectual
activity was open to her except the salons of Paris, and those were
very different under the blight of Napoleonic bureaucracy from what
they had been even during the mingled vulgarity and ferment of the
Directory.
She returned to Weimar, and had a touching meeting with the
Grand Duchess, whose recent troubles, and the courage she
displayed under them, had not only endeared her to her subjects
and her friends, but had won the applause of the world. On her way
thither she presumably delayed a short while in Berlin, and it must
have been to that period that Ticknor refers when relating a very
amusing anecdote in his Life and Letters. She asked Fichte to give
her in a quarter of an hour a summarized idea of his famous Ego,
professing to be, as she doubtless was, entirely in the dark about it.
Fichte’s consternation may be imagined, for he had been all his life
developing his system, and intended it to comprehend the universe.
Moreover he spoke very bad French, and even if Madame de Staël
were momentarily silent in speech, we may fancy how voluble she
looked, and how nervous the prescience of her imminent rapid
speech must have made the philosopher. However, he made up his
mind to the attempt, and began. In a very few moments Madame de
Staël burst out:
“Ah! that is enough. I understand perfectly. Your system is
illustrated by a story in Munchausen’s travels.” Fichte’s expression at
this announcement was a study; but the lady went on: “He arrived
once on the banks of a wide river, where there was neither bridge
nor ferry, neither boat nor raft; and at first he was in despair. But an
idea struck him, and taking hold of his own sleeve, he jumped
himself over to the other side. Now, Monsieur Fichte, is not this
exactly what you have done with your Ego?”
This speech charmed everybody except Fichte himself, who never
forgave Madame de Staël, or at least so Ticknor’s informant said,
and it is easy to believe him.
During the remainder of 1808, and the whole of 1809 and 1810,
Madame de Staël remained alternately at Coppet and Geneva,
working steadily at the Allemagne. It was only about this time that
she acquired habits of sustained occupation. Her father had
entertained so strong and singular an objection to seeing her
engaged in writing, that, rather than pain him, she used to scribble
at odd hours and in casual positions—sometimes, for instance,
standing by the chimney-piece. In this way she was able to hide her
work as soon as he appeared, and thus spare him the annoyance of
supposing that he had interrupted her. She talked so continually that
it was a marvel how she ever wrote at all; and her friends used
often to wonder where and how she planned her works. But the
truth seems to have been that they sprang full grown from her
brain, after having been unconsciously developed there by perpetual
discussion.
During the years above mentioned society at Coppet, although
normally composed as of old by Schlegel, Sismondi, Constant (for a
time), Madame Récamier, and Bonstetten, was varied once more by
new and interesting visitors. Among these was Madame Le Brun,
who not only painted a portrait of Madame de Staël, but noted many
things which now afford pleasant glimpses of the life at the Château.
Of course, like everybody else who sojourned as a guest at Coppet,
she fell under the spell of the hostess. Byron himself some years
later recorded how much more charming Madame de Staël was in
her own house than out of it; and she seems to have possessed the
art of dispensing her hospitality, which was royal, with as much
grace as cordiality.