Skip to content

Commit 5e3fce8

Browse files
authored
Polish documents and introduce webhook health checker (#52)
* fix bug in the configmap controller * add webhook healthychecker * fix issue in the doc * delete the script of waiting webhook install * update changes.md
1 parent 2882c3b commit 5e3fce8

12 files changed

Lines changed: 30 additions & 73 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Release Notes.
1212

1313
- Fix operator role patch issues
1414
- Fix invalid CSR signername
15+
- Fix bug in the configmap controller
1516

1617
#### Chores
1718
- Bump up KubeBuilder to V3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ For more details, please read [Java agent injector](docs/java-agent-injector.md)
3535

3636
## Operator
3737

38-
* To install the operator in an existing cluster, make sure you have [`cert-manager` installed](https://cert-manager.io/docs/installation/)
38+
* To install the operator in an existing cluster, make sure you have [`cert-manager`](https://cert-manager.io/docs/installation/) installed.
3939
* Apply the manifests for the Controller and CRDs in release/config:
4040

4141
```

docs/binary-readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ To onboard operator or adapter, you should push the image to a registry where th
3535

3636
The java agent injector and operator share a same binary. To onboard them, you should follow:
3737

38-
* To install the java agent injector and operator in an existing cluster, make sure you have [`cert-manager` installed](https://cert-manager.io/docs/installation/)
38+
* To install the java agent injector and operator in an existing cluster, make sure you have [`cert-manager`](https://cert-manager.io/docs/installation/) installed.
3939
* Apply the manifests for the Controller and CRDs in `config`:
4040

4141
```

docs/examples/java-agent-injector-usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ spec:
6767
- mkdir -p /sky/agent && cp -r /skywalking/agent/* /sky/agent
6868
command:
6969
- sh
70-
image: apache/skywalking-java-agent:8.7.0-jdk8
70+
image: apache/skywalking-java-agent:8.8.0-java8
7171
name: inject-skywalking-agent
7272
volumeMounts:
7373
- mountPath: /sky/agent
@@ -349,7 +349,7 @@ spec:
349349
-i cp {} /sky/agent/plugins/
350350
command:
351351
- sh
352-
image: apache/skywalking-java-agent:8.7.0-jdk8
352+
image: apache/skywalking-java-agent:8.8.0-java8
353353
name: inject-skywalking-agent
354354
volumeMounts:
355355
- mountPath: /sky/agent

docs/java-agent-injector.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ initContainers:
9898
- mkdir -p /sky/agent && cp -r /skywalking/agent/* /sky/agent
9999
command:
100100
- sh
101-
image: apache/skywalking-java-agent:8.7.0-jdk8
101+
image: apache/skywalking-java-agent:8.8.0-java8
102102
name: inject-skywalking-agent
103103
volumeMounts:
104104
- mountPath: /sky/agent
@@ -155,7 +155,7 @@ The injector can recognize the following annotations to configure the sidecar:
155155
| Annotation key | Description | Annotation Default value |
156156
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
157157
| `sidecar.skywalking.apache.org/initcontainer.Name` | The name of the injected java agent container. | `inject-skywalking-agent` |
158-
| `sidecar.skywalking.apache.org/initcontainer.Image` | The container image of the injected java agent container. | `apache/skywalking-java-agent:8.7.0-jdk8` |
158+
| `sidecar.skywalking.apache.org/initcontainer.Image` | The container image of the injected java agent container. | `apache/skywalking-java-agent:8.8.0-java8` |
159159
| `sidecar.skywalking.apache.org/initcontainer.Command` | The command of the injected java agent container. | `sh` |
160160
| `sidecar.skywalking.apache.org/initcontainer.args.Option` | The args option of the injected java agent container. | `-c` |
161161
| `sidecar.skywalking.apache.org/initcontainer.args.Command` | The args command of the injected java agent container. | `mkdir -p /sky/agent && cp -r /skywalking/agent/* /sky/agent` |

hack/wait-webhook.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

operator/controllers/operator/configmap_controller.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ func (r *ConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
5757
// if validate false , we will delete the configmap and recreate a default configmap
5858
if !apierrors.IsNotFound(err) {
5959
ok, errinfo := injector.ValidateConfigmap(configmap)
60-
if !ok {
61-
log.Error(errinfo, "the default configmap validate false")
62-
if deleteErr := r.Client.Delete(ctx, configmap); deleteErr != nil {
63-
log.Error(deleteErr, "failed to delete the configmap that validate false")
64-
}
60+
if ok {
61+
return ctrl.Result{}, nil
6562
}
66-
log.Info("delete the configmap that validate false")
63+
log.Error(errinfo, "the default configmap validate false")
64+
if deleteErr := r.Client.Delete(ctx, configmap); deleteErr != nil {
65+
log.Error(deleteErr, "failed to delete the configmap that validate false")
66+
return ctrl.Result{}, deleteErr
67+
}
68+
log.Info("deleted the configmap that validate false")
6769
}
6870
app := kubernetes.Application{
6971
Client: r.Client,

operator/main.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,22 @@ func main() {
162162
&webhook.Admission{
163163
Handler: &injector.JavaagentInjector{Client: mgr.GetClient()}})
164164
setupLog.Info("/mutate-v1-pod webhook is registered")
165-
}
166165

167-
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
168-
setupLog.Error(err, "unable to set up health check")
169-
os.Exit(1)
170-
}
171-
if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
172-
setupLog.Error(err, "unable to set up ready check")
173-
os.Exit(1)
166+
if err := mgr.AddHealthzCheck("healthz", mgr.GetWebhookServer().StartedChecker()); err != nil {
167+
setupLog.Error(err, "unable to set up health check for webhook")
168+
os.Exit(1)
169+
}
170+
if err := mgr.AddReadyzCheck("readyz", mgr.GetWebhookServer().StartedChecker()); err != nil {
171+
setupLog.Error(err, "unable to set up ready check for webhook")
172+
os.Exit(1)
173+
}
174+
} else {
175+
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
176+
setupLog.Error(err, "unable to set up ready check")
177+
}
178+
if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
179+
setupLog.Error(err, "unable to set up ready check")
180+
}
174181
}
175182

176183
setupLog.Info("starting manager")

test/e2e/oap-agent-adapter-hpa/e2e.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ setup:
3939
- namespace: skywalking-swck-system
4040
resource: pod
4141
for: condition=Ready
42-
- name: wait webhook installing
43-
command: |
44-
bash hack/wait-webhook.sh
4542
- name: install metrics-adapter
4643
command: |
4744
export ADAPTER_IMG=metrics-adapter

test/e2e/oap-ui-agent-external-storage/e2e.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ setup:
3939
- namespace: skywalking-swck-system
4040
resource: pod
4141
for: condition=Ready
42-
- name: wait webhook installing
43-
command: |
44-
bash hack/wait-webhook.sh
4542
- name: setup elasticsearch
4643
command: |
4744
kubectl apply -f test/e2e/deploy-elasticsearch.yaml

0 commit comments

Comments
 (0)