or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

client-setup.mdconfiguration-management.mdcore-resources.mdindex.mdmachine-management.mdmonitoring.mdmulticluster-management.mdoperator-management.mdsecurity-rbac.md

operator-management.mddocs/

0

# Operator and Lifecycle Management

1

2

Comprehensive operator management through Operator Lifecycle Manager (OLM), OpenShift operators, and OperatorHub integration. Enables installation, configuration, and lifecycle management of operators across the cluster.

3

4

## Capabilities

5

6

### Operator Lifecycle Manager (OLM)

7

8

Core OLM functionality for managing operator installations, subscriptions, and catalog sources.

9

10

```java { .api }

11

/**

12

* Access to OperatorHub API Group (operators.coreos.com)

13

* Operator Lifecycle Manager resources

14

*/

15

OpenShiftOperatorHubAPIGroupDSL operatorHub();

16

17

interface OpenShiftOperatorHubAPIGroupDSL {

18

/** Operator catalog sources (v1alpha1) */

19

MixedOperation<CatalogSource, CatalogSourceList, Resource<CatalogSource>> catalogSources();

20

21

/** Cluster Service Versions - installed operators (v1alpha1) */

22

MixedOperation<ClusterServiceVersion, ClusterServiceVersionList, Resource<ClusterServiceVersion>> clusterServiceVersions();

23

24

/** Installation plans for operator deployments (v1alpha1) */

25

MixedOperation<InstallPlan, InstallPlanList, Resource<InstallPlan>> installPlans();

26

27

/** Operator subscriptions for automatic updates (v1alpha1) */

28

MixedOperation<Subscription, SubscriptionList, Resource<Subscription>> subscriptions();

29

30

/** OLM configuration (v1) */

31

NonNamespaceOperation<OLMConfig, OLMConfigList, Resource<OLMConfig>> olmConfigs();

32

33

/** Operator conditions (v1) */

34

MixedOperation<OperatorCondition, OperatorConditionList, Resource<OperatorCondition>> operatorConditions();

35

36

/** Operator groups for namespace organization (v1) */

37

MixedOperation<OperatorGroup, OperatorGroupList, Resource<OperatorGroup>> operatorGroups();

38

39

/** Installed operators (v1) */

40

NonNamespaceOperation<Operator, OperatorList, Resource<Operator>> operators();

41

42

/** Package manifests for available operators (packages.operators.coreos.com/v1) */

43

MixedOperation<PackageManifest, PackageManifestList, Resource<PackageManifest>> packageManifests();

44

}

45

```

46

47

**Usage Examples:**

48

49

```java

50

// List available operators from catalog

51

PackageManifestList packages = client.operatorHub().packageManifests()

52

.inNamespace("openshift-marketplace")

53

.list();

54

55

// Install operator via subscription

56

Subscription subscription = new SubscriptionBuilder()

57

.withMetadata(new ObjectMetaBuilder()

58

.withName("my-operator")

59

.withNamespace("operators")

60

.build())

61

.withSpec(new SubscriptionSpecBuilder()

62

.withChannel("stable")

63

.withName("my-operator")

64

.withSource("community-operators")

65

.withSourceNamespace("openshift-marketplace")

66

.withInstallPlanApproval("Automatic")

67

.build())

68

.build();

69

70

client.operatorHub().subscriptions().inNamespace("operators").create(subscription);

71

72

// List installed operators

73

ClusterServiceVersionList csvs = client.operatorHub().clusterServiceVersions()

74

.inNamespace("operators")

75

.list();

76

77

// Check installation status

78

InstallPlanList installPlans = client.operatorHub().installPlans()

79

.inNamespace("operators")

80

.list();

81

```

82

83

### OpenShift Platform Operators

84

85

OpenShift-specific operators for cluster services and infrastructure management.

86

87

```java { .api }

88

/**

89

* Access to OpenShift Operator API Group (operator.openshift.io/v1)

90

* OpenShift platform operators and services

91

*/

92

OpenShiftOperatorAPIGroupDSL operator();

93

94

interface OpenShiftOperatorAPIGroupDSL {

95

/** Authentication operator */

96

NonNamespaceOperation<Authentication, AuthenticationList, Resource<Authentication>> authentications();

97

98

/** Cloud credential management */

99

NonNamespaceOperation<CloudCredential, CloudCredentialList, Resource<CloudCredential>> cloudCredentials();

100

101

/** Console operator */

102

NonNamespaceOperation<Console, ConsoleList, Resource<Console>> consoles();

103

104

/** DNS operator and records */

105

NonNamespaceOperation<DNS, DNSList, Resource<DNS>> dnses();

106

MixedOperation<DNSRecord, DNSRecordList, Resource<DNSRecord>> dnsRecords();

107

108

/** etcd operator */

109

NonNamespaceOperation<Etcd, EtcdList, Resource<Etcd>> etcds();

110

111

/** Image pruning operations */

112

NonNamespaceOperation<ImagePruner, ImagePrunerList, Resource<ImagePruner>> imagePruners();

113

114

/** Ingress controller management */

115

MixedOperation<IngressController, IngressControllerList, Resource<IngressController>> ingressControllers();

116

117

/** Kubernetes API server operator */

118

NonNamespaceOperation<KubeAPIServer, KubeAPIServerList, Resource<KubeAPIServer>> kubeAPIServers();

119

120

/** Kubernetes controller manager operator */

121

NonNamespaceOperation<KubeControllerManager, KubeControllerManagerList, Resource<KubeControllerManager>> kubeControllerManagers();

122

123

/** Kubernetes scheduler operator */

124

NonNamespaceOperation<KubeScheduler, KubeSchedulerList, Resource<KubeScheduler>> kubeSchedulers();

125

126

/** Network operator */

127

NonNamespaceOperation<Network, NetworkList, Resource<Network>> networks();

128

129

/** OpenShift API server operator */

130

NonNamespaceOperation<OpenShiftAPIServer, OpenShiftAPIServerList, Resource<OpenShiftAPIServer>> openShiftAPIServers();

131

132

/** OpenShift controller manager */

133

NonNamespaceOperation<OpenShiftControllerManager, OpenShiftControllerManagerList, Resource<OpenShiftControllerManager>> openShiftControllerManagers();

134

135

/** Service certificate authority */

136

NonNamespaceOperation<ServiceCA, ServiceCAList, Resource<ServiceCA>> serviceCAs();

137

138

/** Storage operator */

139

NonNamespaceOperation<Storage, StorageList, Resource<Storage>> storages();

140

}

141

```

142

143

**Usage Examples:**

144

145

```java

146

// Get authentication operator status

147

Authentication auth = client.operator().authentications().withName("cluster").get();

148

149

// List ingress controllers

150

IngressControllerList ingressControllers = client.operator().ingressControllers()

151

.inNamespace("openshift-ingress-operator")

152

.list();

153

154

// Get console operator status

155

Console console = client.operator().consoles().withName("cluster").get();

156

String consoleURL = console.getStatus().getConsoleURL();

157

158

// Configure image pruning

159

ImagePruner pruner = new ImagePrunerBuilder()

160

.withMetadata(new ObjectMetaBuilder()

161

.withName("cluster")

162

.build())

163

.withSpec(new ImagePrunerSpecBuilder()

164

.withSchedule("0 0 * * *") // Daily at midnight

165

.withKeepYoungerThan("24h")

166

.withKeepTagRevisions(5)

167

.withSuccessfulJobsHistoryLimit(3)

168

.withFailedJobsHistoryLimit(3)

169

.build())

170

.build();

171

172

client.operator().imagePruners().createOrReplace(pruner);

173

```

174

175

### Catalog and Package Management

176

177

Management of operator catalogs, package manifests, and catalog sources for operator discovery.

178

179

```java { .api }

180

/**

181

* Catalog source management for operator repositories

182

*/

183

MixedOperation<CatalogSource, CatalogSourceList, Resource<CatalogSource>> catalogSources();

184

185

/**

186

* Package manifest access for operator metadata

187

*/

188

MixedOperation<PackageManifest, PackageManifestList, Resource<PackageManifest>> packageManifests();

189

```

190

191

**Usage Examples:**

192

193

```java

194

// List catalog sources

195

CatalogSourceList catalogs = client.operatorHub().catalogSources()

196

.inNamespace("openshift-marketplace")

197

.list();

198

199

// Create custom catalog source

200

CatalogSource customCatalog = new CatalogSourceBuilder()

201

.withMetadata(new ObjectMetaBuilder()

202

.withName("my-catalog")

203

.withNamespace("openshift-marketplace")

204

.build())

205

.withSpec(new CatalogSourceSpecBuilder()

206

.withSourceType("grpc")

207

.withImage("quay.io/my-org/my-catalog:latest")

208

.withDisplayName("My Custom Catalog")

209

.withPublisher("My Organization")

210

.build())

211

.build();

212

213

client.operatorHub().catalogSources()

214

.inNamespace("openshift-marketplace")

215

.create(customCatalog);

216

217

// Search for specific operator

218

PackageManifest prometheus = client.operatorHub().packageManifests()

219

.inNamespace("openshift-marketplace")

220

.withName("prometheus")

221

.get();

222

223

if (prometheus != null) {

224

List<String> channels = prometheus.getStatus().getChannels().stream()

225

.map(c -> c.getName())

226

.collect(Collectors.toList());

227

System.out.println("Available channels: " + channels);

228

}

229

```

230

231

### Operator Group Management

232

233

Operator group configuration for controlling operator installation scope and permissions.

234

235

```java { .api }

236

/**

237

* Operator groups for namespace-scoped operator management

238

*/

239

MixedOperation<OperatorGroup, OperatorGroupList, Resource<OperatorGroup>> operatorGroups();

240

```

241

242

**Usage Examples:**

243

244

```java

245

// Create operator group for namespace

246

OperatorGroup operatorGroup = new OperatorGroupBuilder()

247

.withMetadata(new ObjectMetaBuilder()

248

.withName("my-operators")

249

.withNamespace("my-operators")

250

.build())

251

.withSpec(new OperatorGroupSpecBuilder()

252

.withTargetNamespaces("my-app-namespace")

253

.build())

254

.build();

255

256

client.operatorHub().operatorGroups()

257

.inNamespace("my-operators")

258

.create(operatorGroup);

259

260

// List operator groups

261

OperatorGroupList groups = client.operatorHub().operatorGroups()

262

.inAnyNamespace()

263

.list();

264

```

265

266

### Installation and Upgrade Management

267

268

Manage operator installation plans, approvals, and upgrade processes.

269

270

```java { .api }

271

/**

272

* Installation plans for operator deployment coordination

273

*/

274

MixedOperation<InstallPlan, InstallPlanList, Resource<InstallPlan>> installPlans();

275

276

/**

277

* Operator subscriptions for automated updates

278

*/

279

MixedOperation<Subscription, SubscriptionList, Resource<Subscription>> subscriptions();

280

```

281

282

**Usage Examples:**

283

284

```java

285

// List pending install plans

286

InstallPlanList pendingPlans = client.operatorHub().installPlans()

287

.inAnyNamespace()

288

.withField("spec.approved", "false")

289

.list();

290

291

// Approve install plan

292

InstallPlan plan = client.operatorHub().installPlans()

293

.inNamespace("operators")

294

.withName("install-plan-name")

295

.get();

296

297

if (plan != null && !plan.getSpec().getApproved()) {

298

plan.getSpec().setApproved(true);

299

client.operatorHub().installPlans()

300

.inNamespace("operators")

301

.withName("install-plan-name")

302

.replace(plan);

303

}

304

305

// Update subscription channel

306

Subscription sub = client.operatorHub().subscriptions()

307

.inNamespace("operators")

308

.withName("my-operator")

309

.get();

310

311

if (sub != null) {

312

sub.getSpec().setChannel("stable-v2");

313

client.operatorHub().subscriptions()

314

.inNamespace("operators")

315

.withName("my-operator")

316

.replace(sub);

317

}

318

```

319

320

## Usage Patterns

321

322

### Complete Operator Installation Workflow

323

324

```java

325

try (OpenShiftClient client = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) {

326

String operatorNamespace = "my-operators";

327

String operatorName = "prometheus";

328

329

// 1. Create operator group (if needed)

330

OperatorGroup og = new OperatorGroupBuilder()

331

.withMetadata(new ObjectMetaBuilder()

332

.withName("my-operators")

333

.withNamespace(operatorNamespace)

334

.build())

335

.build();

336

337

client.operatorHub().operatorGroups()

338

.inNamespace(operatorNamespace)

339

.createOrReplace(og);

340

341

// 2. Create subscription

342

Subscription subscription = new SubscriptionBuilder()

343

.withMetadata(new ObjectMetaBuilder()

344

.withName(operatorName)

345

.withNamespace(operatorNamespace)

346

.build())

347

.withSpec(new SubscriptionSpecBuilder()

348

.withChannel("stable")

349

.withName(operatorName)

350

.withSource("community-operators")

351

.withSourceNamespace("openshift-marketplace")

352

.withInstallPlanApproval("Manual") // or "Automatic"

353

.build())

354

.build();

355

356

client.operatorHub().subscriptions()

357

.inNamespace(operatorNamespace)

358

.create(subscription);

359

360

// 3. Wait for and approve install plan (if manual approval)

361

// This would typically be done in a loop with proper timeout handling

362

InstallPlan installPlan = waitForInstallPlan(client, operatorNamespace, operatorName);

363

if (installPlan != null && !installPlan.getSpec().getApproved()) {

364

installPlan.getSpec().setApproved(true);

365

client.operatorHub().installPlans()

366

.inNamespace(operatorNamespace)

367

.replace(installPlan);

368

}

369

370

// 4. Wait for CSV to be ready

371

ClusterServiceVersion csv = waitForCSV(client, operatorNamespace, operatorName);

372

System.out.println("Operator installed: " + csv.getMetadata().getName());

373

}

374

```