0
# Cluster Configuration Management
1
2
OpenShift cluster configuration through the config.openshift.io API group. Manages cluster-wide settings for authentication, networking, builds, DNS, ingress, feature gates, and infrastructure components.
3
4
## Capabilities
5
6
### Configuration API Group Access
7
8
```java { .api }
9
/**
10
* Access to OpenShift Configuration API Group (config.openshift.io/v1)
11
* Cluster-wide configuration resources
12
*/
13
OpenShiftConfigAPIGroupDSL config();
14
```
15
16
### Core Infrastructure Configuration
17
18
Essential cluster infrastructure settings including API servers, authentication, DNS, networking, and proxy configuration.
19
20
```java { .api }
21
interface OpenShiftConfigAPIGroupDSL {
22
/** API server configuration and settings */
23
NonNamespaceOperation<APIServer, APIServerList, Resource<APIServer>> apiServers();
24
25
/** Cluster authentication configuration */
26
NonNamespaceOperation<Authentication, AuthenticationList, Resource<Authentication>> authentications();
27
28
/** Cluster DNS configuration */
29
NonNamespaceOperation<DNS, DNSList, Resource<DNS>> dnses();
30
31
/** Cluster networking configuration */
32
NonNamespaceOperation<Network, NetworkList, Resource<Network>> networks();
33
34
/** Cluster proxy configuration */
35
NonNamespaceOperation<Proxy, ProxyList, Resource<Proxy>> proxies();
36
37
/** Infrastructure platform configuration */
38
NonNamespaceOperation<Infrastructure, InfrastructureList, Resource<Infrastructure>> infrastructures();
39
40
/** OAuth authentication configuration */
41
NonNamespaceOperation<OAuth, OAuthList, Resource<OAuth>> oAuths();
42
}
43
```
44
45
**Usage Examples:**
46
47
```java
48
// Get cluster authentication configuration
49
Authentication auth = client.config().authentications().withName("cluster").get();
50
51
// Get cluster DNS configuration
52
DNS dns = client.config().dnses().withName("cluster").get();
53
String clusterDomain = dns.getSpec().getClusterDomain();
54
55
// Get network configuration
56
Network network = client.config().networks().withName("cluster").get();
57
String serviceNetwork = network.getSpec().getServiceNetwork().get(0);
58
59
// Get infrastructure details
60
Infrastructure infra = client.config().infrastructures().withName("cluster").get();
61
String platform = infra.getStatus().getPlatform();
62
```
63
64
### Build and Image Configuration
65
66
Cluster-wide build and image management settings including build defaults, image registry configuration, and image content policies.
67
68
```java { .api }
69
interface OpenShiftConfigAPIGroupDSL {
70
/** Cluster build configuration and defaults */
71
NonNamespaceOperation<Build, BuildList, Resource<Build>> builds();
72
73
/** Image configuration and registry settings */
74
NonNamespaceOperation<Image, ImageList, Resource<Image>> images();
75
76
/** Image content policies and restrictions */
77
NonNamespaceOperation<ImageContentPolicy, ImageContentPolicyList, Resource<ImageContentPolicy>> imageContentPolicies();
78
79
/** Image digest mirror sets for registry mirroring */
80
NonNamespaceOperation<ImageDigestMirrorSet, ImageDigestMirrorSetList, Resource<ImageDigestMirrorSet>> imageDigestMirrorSets();
81
82
/** Image tag mirror sets for registry mirroring */
83
NonNamespaceOperation<ImageTagMirrorSet, ImageTagMirrorSetList, Resource<ImageTagMirrorSet>> imageTagMirrorSets();
84
}
85
```
86
87
**Usage Examples:**
88
89
```java
90
// Get cluster build configuration
91
Build buildConfig = client.config().builds().withName("cluster").get();
92
93
// Get image configuration
94
Image imageConfig = client.config().images().withName("cluster").get();
95
String externalRegistryHostname = imageConfig.getStatus().getExternalRegistryHostnames().get(0);
96
97
// List image content policies
98
ImageContentPolicyList policies = client.config().imageContentPolicies().list();
99
```
100
101
### Ingress and Console Configuration
102
103
Ingress controller and web console configuration for cluster access and user interface settings.
104
105
```java { .api }
106
interface OpenShiftConfigAPIGroupDSL {
107
/** Ingress controller configuration */
108
NonNamespaceOperation<Ingress, IngressList, Resource<Ingress>> ingresses();
109
110
/** Web console configuration */
111
NonNamespaceOperation<Console, ConsoleList, Resource<Console>> consoles();
112
}
113
```
114
115
**Usage Examples:**
116
117
```java
118
// Get ingress configuration
119
Ingress ingress = client.config().ingresses().withName("cluster").get();
120
String appsDomain = ingress.getSpec().getDomain();
121
122
// Get console configuration
123
Console console = client.config().consoles().withName("cluster").get();
124
String consoleURL = console.getStatus().getConsoleURL();
125
```
126
127
### Feature Gates and Cluster Capabilities
128
129
Feature gate management and cluster capability configuration for enabling/disabling OpenShift features.
130
131
```java { .api }
132
interface OpenShiftConfigAPIGroupDSL {
133
/** Feature gates for enabling/disabling cluster features */
134
NonNamespaceOperation<FeatureGate, FeatureGateList, Resource<FeatureGate>> featureGates();
135
136
/** Scheduler configuration */
137
NonNamespaceOperation<Scheduler, SchedulerList, Resource<Scheduler>> schedulers();
138
139
/** OperatorHub configuration */
140
NonNamespaceOperation<OperatorHub, OperatorHubList, Resource<OperatorHub>> operatorHubs();
141
142
/** Project configuration and defaults */
143
NonNamespaceOperation<Project, ProjectList, Resource<Project>> projects();
144
}
145
```
146
147
**Usage Examples:**
148
149
```java
150
// Get feature gate configuration
151
FeatureGate featureGate = client.config().featureGates().withName("cluster").get();
152
Set<String> enabledFeatures = featureGate.getSpec().getFeatureSet();
153
154
// Get scheduler configuration
155
Scheduler scheduler = client.config().schedulers().withName("cluster").get();
156
157
// Get OperatorHub configuration
158
OperatorHub operatorHub = client.config().operatorHubs().withName("cluster").get();
159
boolean disableAllDefaultSources = operatorHub.getSpec().getDisableAllDefaultSources();
160
```
161
162
### Cluster Status and Operators
163
164
Cluster version information and operator status monitoring.
165
166
```java { .api }
167
interface OpenShiftConfigAPIGroupDSL {
168
/** Cluster version and update information */
169
NonNamespaceOperation<ClusterVersion, ClusterVersionList, Resource<ClusterVersion>> clusterVersions();
170
171
/** Cluster operator status and health */
172
NonNamespaceOperation<ClusterOperator, ClusterOperatorList, Resource<ClusterOperator>> clusterOperators();
173
}
174
```
175
176
**Usage Examples:**
177
178
```java
179
// Get cluster version
180
ClusterVersion version = client.config().clusterVersions().withName("version").get();
181
String currentVersion = version.getStatus().getDesired().getVersion();
182
List<Update> availableUpdates = version.getStatus().getAvailableUpdates();
183
184
// List cluster operators and their status
185
ClusterOperatorList operators = client.config().clusterOperators().list();
186
for (ClusterOperator operator : operators.getItems()) {
187
String name = operator.getMetadata().getName();
188
List<ClusterOperatorStatusCondition> conditions = operator.getStatus().getConditions();
189
190
boolean available = conditions.stream()
191
.anyMatch(c -> "Available".equals(c.getType()) && "True".equals(c.getStatus()));
192
193
System.out.println(name + " available: " + available);
194
}
195
196
// Get specific operator status
197
ClusterOperator ingressOperator = client.config().clusterOperators()
198
.withName("ingress")
199
.get();
200
```
201
202
## Usage Patterns
203
204
### Cluster Configuration Inspection
205
206
```java
207
try (OpenShiftClient client = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) {
208
// Get overall cluster information
209
Infrastructure infra = client.config().infrastructures().withName("cluster").get();
210
System.out.println("Platform: " + infra.getStatus().getPlatform());
211
System.out.println("Region: " + infra.getStatus().getPlatformStatus().getAws().getRegion());
212
213
// Check cluster version and available updates
214
ClusterVersion version = client.config().clusterVersions().withName("version").get();
215
System.out.println("Current version: " + version.getStatus().getDesired().getVersion());
216
217
// Check DNS and networking
218
DNS dns = client.config().dnses().withName("cluster").get();
219
Network network = client.config().networks().withName("cluster").get();
220
221
System.out.println("Cluster domain: " + dns.getSpec().getClusterDomain());
222
System.out.println("Service network: " + network.getSpec().getServiceNetwork());
223
224
// Check ingress configuration
225
Ingress ingress = client.config().ingresses().withName("cluster").get();
226
System.out.println("Apps domain: " + ingress.getSpec().getDomain());
227
}
228
```
229
230
### Feature Gate Management
231
232
```java
233
// Check and modify feature gates
234
FeatureGate featureGate = client.config().featureGates().withName("cluster").get();
235
236
// Create custom feature gate configuration (typically not recommended)
237
FeatureGate customFeatureGate = new FeatureGateBuilder()
238
.withMetadata(new ObjectMetaBuilder().withName("cluster").build())
239
.withSpec(new FeatureGateSpecBuilder()
240
.withFeatureSet("CustomNoUpgrade")
241
.build())
242
.build();
243
244
// Note: Modifying feature gates can affect cluster stability
245
// client.config().featureGates().createOrReplace(customFeatureGate);
246
```