Skip to content

Commit 065c2b8

Browse files
Add a configuration section
Signed-off-by: Danil Grigorev <[email protected]>
1 parent dd1c5f1 commit 065c2b8

13 files changed

+329
-44
lines changed

docs/book/src/reference/providers.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,26 @@ type IPAMProvider struct {
8181
```
8282

8383
The following sections provide details about `ProviderSpec` and `ProviderStatus`, which are shared among all the provider types.
84+
85+
## Provider Status
86+
87+
`ProviderStatus`: observed state of the Provider, consisting of:
88+
89+
- Contract (optional string): core provider contract being adhered to (e.g., "v1beta1")
90+
- Conditions (optional clusterv1.Conditions): current service state of the provider
91+
- ObservedGeneration (optional int64): latest generation observed by the controller
92+
- InstalledVersion (optional string): version of the provider that is installed
93+
94+
YAML example:
95+
96+
```yaml
97+
status:
98+
contract: "v1beta1"
99+
conditions:
100+
- type: "Ready"
101+
status: "True"
102+
reason: "ProviderAvailable"
103+
message: "Provider is available and ready"
104+
observedGeneration: 1
105+
installedVersion: "v0.1.0"
106+
```

docs/book/src/topics/basic-capi-provider-installation.md

Lines changed: 0 additions & 12 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/book/src/topics/air-gapped-environtment.md renamed to docs/book/src/topics/configuration/air-gapped-environtment.md

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -84,35 +84,3 @@ yq eval -i '.metadata.labels += {"my-label": "label-value"}' configmap.yaml
8484
```sh
8585
kubectl create -f configmap.yaml
8686
```
87-
88-
## Patching provider manifests
89-
90-
Provider manifests can be patched using JSON merge patches. This can be useful when you need to modify the provider manifests that are fetched from the repository. In order to provider
91-
manifests `spec.ResourcePatches` has to be used where an array of patches can be specified:
92-
93-
```yaml
94-
---
95-
apiVersion: operator.cluster.x-k8s.io/v1alpha2
96-
kind: CoreProvider
97-
metadata:
98-
name: cluster-api
99-
namespace: capi-system
100-
spec:
101-
resourcePatches:
102-
- |
103-
apiVersion: v1
104-
kind: Service
105-
metadata:
106-
labels:
107-
test-label: test-value
108-
```
109-
110-
More information about JSON merge patches can be found here <https://datatracker.ietf.org/doc/html/rfc7396>
111-
112-
There are couple of rules for the patch to match a manifest:
113-
114-
- The `kind` field must match the target object.
115-
- If `apiVersion` is specified it will only be applied to matching objects.
116-
- If `metadata.name` and `metadata.namespace` not specified, the patch will be applied to all objects of the specified kind.
117-
- If `metadata.name` is specified, the patch will be applied to the object with the specified name. This is for cluster scoped objects.
118-
- If both `metadata.name` and `metadata.namespace` are specified, the patch will be applied to the object with the specified name and namespace.
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Configuration
2+
3+
## Provider Spec
4+
5+
1. `ProviderSpec`: desired state of the Provider, consisting of:
6+
- Version (string): provider version (e.g., "v0.1.0")
7+
- Manager (optional ManagerSpec): controller manager properties for the provider
8+
- Deployment (optional DeploymentSpec): deployment properties for the provider
9+
- ConfigSecret (optional SecretReference): reference to the config secret
10+
- FetchConfig (optional FetchConfiguration): how the operator will fetch components and metadata
11+
12+
YAML example:
13+
14+
```yaml
15+
...
16+
spec:
17+
version: "v0.1.0"
18+
manager:
19+
maxConcurrentReconciles: 5
20+
deployment:
21+
replicas: 1
22+
configSecret:
23+
name: "provider-secret"
24+
fetchConfig:
25+
url: "https://github.com/owner/repo/releases"
26+
...
27+
```
28+
29+
2. `ManagerSpec`: controller manager properties for the provider, consisting of:
30+
- ProfilerAddress (optional string): pprof profiler bind address (e.g., "localhost:6060")
31+
- MaxConcurrentReconciles (optional int): maximum number of concurrent reconciles
32+
- Verbosity (optional int): logs verbosity
33+
- FeatureGates (optional map[string]bool): provider specific feature flags
34+
35+
YAML example:
36+
37+
```yaml
38+
...
39+
spec:
40+
manager:
41+
profilerAddress: "localhost:6060"
42+
maxConcurrentReconciles: 5
43+
verbosity: 1
44+
featureGates:
45+
FeatureA: true
46+
FeatureB: false
47+
...
48+
```
49+
50+
3. `DeploymentSpec`: deployment properties for the provider, consisting of:
51+
- Replicas (optional int): number of desired pods
52+
- NodeSelector (optional map[string]string): node label selector
53+
- Tolerations (optional []corev1.Toleration): pod tolerations
54+
- Affinity (optional corev1.Affinity): pod scheduling constraints
55+
- Containers (optional []ContainerSpec): list of deployment containers
56+
- ServiceAccountName (optional string): pod service account
57+
- ImagePullSecrets (optional []corev1.LocalObjectReference): list of image pull secrets specified in the Deployment
58+
59+
YAML example:
60+
61+
```yaml
62+
...
63+
spec:
64+
deployment:
65+
replicas: 2
66+
nodeSelector:
67+
disktype: ssd
68+
tolerations:
69+
- key: "example"
70+
operator: "Exists"
71+
effect: "NoSchedule"
72+
affinity:
73+
nodeAffinity:
74+
requiredDuringSchedulingIgnoredDuringExecution:
75+
nodeSelectorTerms:
76+
- matchExpressions:
77+
- key: "example"
78+
operator: "In"
79+
values:
80+
- "true"
81+
containers:
82+
- name: "containerA"
83+
imageUrl: "example.com/repo/image-name:v1.0.0"
84+
args:
85+
exampleArg: "value"
86+
...
87+
```
88+
89+
4. `ContainerSpec`: container properties for the provider, consisting of:
90+
- Name (string): container name
91+
- ImageURL (optional string): container image URL
92+
- Args (optional map[string]string): extra provider specific flags
93+
- Env (optional []corev1.EnvVar): environment variables
94+
- Resources (optional corev1.ResourceRequirements): compute resources
95+
- Command (optional []string): override container's entrypoint array
96+
97+
YAML example:
98+
99+
```yaml
100+
...
101+
spec:
102+
deployment:
103+
containers:
104+
- name: "example-container"
105+
imageUrl: "example.com/repo/image-name:v1.0.0"
106+
args:
107+
exampleArg: "value"
108+
env:
109+
- name: "EXAMPLE_ENV"
110+
value: "example-value"
111+
resources:
112+
limits:
113+
cpu: "1"
114+
memory: "1Gi"
115+
requests:
116+
cpu: "500m"
117+
memory: "500Mi"
118+
command:
119+
- "/bin/bash"
120+
...
121+
```
122+
123+
5. `FetchConfiguration`: components and metadata fetch options, consisting of:
124+
- URL (optional string): URL for remote Github repository releases (e.g., "<https://github.com/owner/repo/releases>")
125+
- Selector (optional metav1.LabelSelector): label selector to use for fetching provider components and metadata from ConfigMaps stored in the cluster
126+
127+
YAML example:
128+
129+
```yaml
130+
...
131+
spec:
132+
fetchConfig:
133+
url: "https://github.com/owner/repo/releases"
134+
selector:
135+
matchLabels:
136+
...
137+
```
138+
139+
6. `SecretReference`: pointer to a secret object, consisting of:
140+
141+
- Name (string): name of the secret
142+
- Namespace (optional string): namespace of the secret, defaults to the provider object namespace
143+
144+
YAML example:
145+
146+
```yaml
147+
...
148+
spec:
149+
configSecret:
150+
name: capa-secret
151+
namespace: capa-system
152+
...
153+
```

0 commit comments

Comments
 (0)