<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Operations on Java Operator SDK</title><link>https://javaoperatorsdk.io/docs/documentation/operations/</link><description>Recent content in Operations on Java Operator SDK</description><generator>Hugo</generator><language>en</language><atom:link href="https://javaoperatorsdk.io/docs/documentation/operations/index.xml" rel="self" type="application/rss+xml"/><item><title>Configurations</title><link>https://javaoperatorsdk.io/docs/documentation/operations/configuration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://javaoperatorsdk.io/docs/documentation/operations/configuration/</guid><description>&lt;p&gt;The Java Operator SDK (JOSDK) provides abstractions that work great out of the box. However, we recognize that default behavior isn&amp;rsquo;t always suitable for every use case. Numerous configuration options help you tailor the framework to your specific needs.&lt;/p&gt;
&lt;p&gt;Configuration options operate at several levels:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Operator-level&lt;/strong&gt; using &lt;code&gt;ConfigurationService&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reconciler-level&lt;/strong&gt; using &lt;code&gt;ControllerConfiguration&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DependentResource-level&lt;/strong&gt; using the &lt;code&gt;DependentResourceConfigurator&lt;/code&gt; interface&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;EventSource-level&lt;/strong&gt; where some event sources (like &lt;code&gt;InformerEventSource&lt;/code&gt;) need fine-tuning to identify which events trigger the associated reconciler&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="operator-level-configuration"&gt;Operator-Level Configuration&lt;/h2&gt;
&lt;p&gt;Configuration that impacts the entire operator is performed via the &lt;code&gt;ConfigurationService&lt;/code&gt; class. &lt;code&gt;ConfigurationService&lt;/code&gt; is an abstract class with different implementations based on which framework flavor you use (e.g., Quarkus Operator SDK replaces the default implementation). Configurations initialize with sensible defaults but can be changed during initialization.&lt;/p&gt;</description></item><item><title>Logging</title><link>https://javaoperatorsdk.io/docs/documentation/operations/logging/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://javaoperatorsdk.io/docs/documentation/operations/logging/</guid><description>&lt;h2 id="contextual-info-for-logging-with-mdc"&gt;Contextual Info for Logging with MDC&lt;/h2&gt;
&lt;p&gt;Logging is enhanced with additional contextual information using
&lt;a href="http://www.slf4j.org/manual.html#mdc"&gt;MDC&lt;/a&gt;. The following attributes are available in most
parts of reconciliation logic and during the execution of the controller:&lt;/p&gt;
&lt;table&gt;
 &lt;thead&gt;
 &lt;tr&gt;
 &lt;th style="text-align: left"&gt;MDC Key&lt;/th&gt;
 &lt;th style="text-align: left"&gt;Value added from primary resource&lt;/th&gt;
 &lt;/tr&gt;
 &lt;/thead&gt;
 &lt;tbody&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;resource.apiVersion&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.apiVersion&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;resource.kind&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.kind&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;resource.name&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.metadata.name&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;resource.namespace&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.metadata.namespace&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;resource.resourceVersion&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.metadata.resourceVersion&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;resource.generation&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.metadata.generation&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;resource.uid&lt;/code&gt;&lt;/td&gt;
 &lt;td style="text-align: left"&gt;&lt;code&gt;.metadata.uid&lt;/code&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;For more information about MDC see this &lt;a href="https://www.baeldung.com/mdc-in-log4j-2-logback"&gt;link&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="mdc-entries-during-event-handling"&gt;MDC entries during event handling&lt;/h3&gt;
&lt;p&gt;Although, usually users might not require it in their day-to-day workflow, it is worth mentioning that
there are additional MDC entries managed for event handling. Typically, you might be interested in it
in your &lt;code&gt;SecondaryToPrimaryMapper&lt;/code&gt; related logs.
For &lt;code&gt;InformerEventSource&lt;/code&gt; and &lt;code&gt;ControllerEventSource&lt;/code&gt; the following information is present:&lt;/p&gt;</description></item><item><title>Metrics</title><link>https://javaoperatorsdk.io/docs/documentation/operations/metrics/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://javaoperatorsdk.io/docs/documentation/operations/metrics/</guid><description>&lt;h2 id="runtime-info"&gt;Runtime Info&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/RuntimeInfo.java#L16-L16"&gt;RuntimeInfo&lt;/a&gt;
is used mainly to check the actual health of event sources. Based on this information it is easy to implement custom
liveness probes.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/java-operator-sdk/java-operator-sdk/blob/main/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java#L168-L168"&gt;stopOnInformerErrorDuringStartup&lt;/a&gt;
setting, where this flag usually needs to be set to false, in order to control the exact liveness properties.&lt;/p&gt;
&lt;p&gt;See also an example implementation in the
&lt;a href="https://github.com/java-operator-sdk/java-operator-sdk/blob/3e2e7c4c834ef1c409d636156b988125744ca911/sample-operators/webpage/src/main/java/io/javaoperatorsdk/operator/sample/WebPageOperator.java#L38-L43"&gt;WebPage sample&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="metrics"&gt;Metrics&lt;/h2&gt;
&lt;p&gt;JOSDK provides built-in support for metrics reporting on what is happening with your reconcilers in the form of
the &lt;code&gt;Metrics&lt;/code&gt; interface which can be implemented to connect to your metrics provider of choice, JOSDK calling the
methods as it goes about reconciling resources. By default, a no-operation implementation is provided thus providing a
no-cost sane default. A &lt;a href="https://micrometer.io"&gt;micrometer&lt;/a&gt;-based implementation is also provided.&lt;/p&gt;</description></item><item><title>Leader Election</title><link>https://javaoperatorsdk.io/docs/documentation/operations/leader-election/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://javaoperatorsdk.io/docs/documentation/operations/leader-election/</guid><description>&lt;p&gt;When running multiple replicas of an operator for high availability, leader election ensures that
only one instance actively reconciles resources at a time. JOSDK uses Kubernetes
&lt;a href="https://kubernetes.io/docs/concepts/architecture/leases/"&gt;Lease&lt;/a&gt; objects for leader election.&lt;/p&gt;
&lt;h2 id="enabling-leader-election"&gt;Enabling Leader Election&lt;/h2&gt;
&lt;h3 id="programmatic-configuration"&gt;Programmatic Configuration&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#204a87;font-weight:bold"&gt;var&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000"&gt;operator&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#ce5c00;font-weight:bold"&gt;=&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#204a87;font-weight:bold"&gt;new&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000"&gt;Operator&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#000"&gt;o&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#ce5c00;font-weight:bold"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000"&gt;o&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;withLeaderElectionConfiguration&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#204a87;font-weight:bold"&gt;new&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000"&gt;LeaderElectionConfiguration&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#4e9a06"&gt;&amp;#34;my-operator-lease&amp;#34;&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;,&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#4e9a06"&gt;&amp;#34;operator-namespace&amp;#34;&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;)));&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Or using the builder for full control:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-java" data-lang="java"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#204a87;font-weight:bold"&gt;import static&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000"&gt;io.javaoperatorsdk.operator.api.config.LeaderElectionConfigurationBuilder.aLeaderElectionConfiguration&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;;&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#204a87;font-weight:bold"&gt;var&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000"&gt;config&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#ce5c00;font-weight:bold"&gt;=&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000"&gt;aLeaderElectionConfiguration&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#4e9a06"&gt;&amp;#34;my-operator-lease&amp;#34;&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;)&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;withLeaseNamespace&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#4e9a06"&gt;&amp;#34;operator-namespace&amp;#34;&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;)&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;withIdentity&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#000"&gt;System&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;getenv&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#4e9a06"&gt;&amp;#34;POD_NAME&amp;#34;&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;))&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;withLeaseDuration&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#000"&gt;Duration&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;ofSeconds&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#000"&gt;15&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;))&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;withRenewDeadline&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#000"&gt;Duration&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;ofSeconds&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#000"&gt;10&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;))&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;withRetryPeriod&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#000"&gt;Duration&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;ofSeconds&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#000"&gt;2&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;))&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;build&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;();&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#204a87;font-weight:bold"&gt;var&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000"&gt;operator&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#ce5c00;font-weight:bold"&gt;=&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#204a87;font-weight:bold"&gt;new&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000"&gt;Operator&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#000"&gt;o&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#ce5c00;font-weight:bold"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt; &lt;/span&gt;&lt;span style="color:#000"&gt;o&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;.&lt;/span&gt;&lt;span style="color:#c4a000"&gt;withLeaderElectionConfiguration&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;(&lt;/span&gt;&lt;span style="color:#000"&gt;config&lt;/span&gt;&lt;span style="color:#000;font-weight:bold"&gt;));&lt;/span&gt;&lt;span style="color:#f8f8f8"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="external-configuration"&gt;External Configuration&lt;/h3&gt;
&lt;p&gt;Leader election can also be configured via properties (e.g. environment variables or a config file).&lt;/p&gt;</description></item><item><title>Generic Helm Chart</title><link>https://javaoperatorsdk.io/docs/documentation/operations/helm-chart/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://javaoperatorsdk.io/docs/documentation/operations/helm-chart/</guid><description>&lt;p&gt;A generic, reusable Helm chart for deploying Java operators built with JOSDK is available at
&lt;a href="https://github.com/java-operator-sdk/java-operator-sdk/tree/main/helm/generic-helm-chart"&gt;&lt;code&gt;helm/generic-helm-chart&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It is intended as a &lt;strong&gt;template for operator developers&lt;/strong&gt; — a starting point that covers common deployment
patterns so you don&amp;rsquo;t have to write a chart from scratch. The chart is maintained on a &lt;strong&gt;best-effort basis&lt;/strong&gt;.
Contributions are more than welcome.&lt;/p&gt;
&lt;p&gt;The chart is used in the
&lt;a href="https://github.com/java-operator-sdk/java-operator-sdk/blob/main/sample-operators/metrics-processing/src/test/java/io/javaoperatorsdk/operator/sample/metrics/MetricsHandlingE2E.java"&gt;&lt;code&gt;metrics-processing&lt;/code&gt; sample operator E2E test&lt;/a&gt;
to deploy the operator to a cluster via Helm.&lt;/p&gt;</description></item></channel></rss>