Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish documents and introduce webhook health checker #52

Merged
merged 3 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Release Notes.

- Fix operator role patch issues
- Fix invalid CSR signername
- Fix bug in the configmap controller

#### Chores
- Bump up KubeBuilder to V3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ For more details, please read [Java agent injector](docs/java-agent-injector.md)

## Operator

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

```
Expand Down
2 changes: 1 addition & 1 deletion docs/binary-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ To onboard operator or adapter, you should push the image to a registry where th

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

* 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/)
* 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.
* Apply the manifests for the Controller and CRDs in `config`:

```
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/java-agent-injector-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- mkdir -p /sky/agent && cp -r /skywalking/agent/* /sky/agent
command:
- sh
image: apache/skywalking-java-agent:8.7.0-jdk8
image: apache/skywalking-java-agent:8.8.0-java8
name: inject-skywalking-agent
volumeMounts:
- mountPath: /sky/agent
Expand Down Expand Up @@ -349,7 +349,7 @@ spec:
-i cp {} /sky/agent/plugins/
command:
- sh
image: apache/skywalking-java-agent:8.7.0-jdk8
image: apache/skywalking-java-agent:8.8.0-java8
name: inject-skywalking-agent
volumeMounts:
- mountPath: /sky/agent
Expand Down
4 changes: 2 additions & 2 deletions docs/java-agent-injector.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ initContainers:
- mkdir -p /sky/agent && cp -r /skywalking/agent/* /sky/agent
command:
- sh
image: apache/skywalking-java-agent:8.7.0-jdk8
image: apache/skywalking-java-agent:8.8.0-java8
name: inject-skywalking-agent
volumeMounts:
- mountPath: /sky/agent
Expand Down Expand Up @@ -155,7 +155,7 @@ The injector can recognize the following annotations to configure the sidecar:
| Annotation key | Description | Annotation Default value |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| `sidecar.skywalking.apache.org/initcontainer.Name` | The name of the injected java agent container. | `inject-skywalking-agent` |
| `sidecar.skywalking.apache.org/initcontainer.Image` | The container image of the injected java agent container. | `apache/skywalking-java-agent:8.7.0-jdk8` |
| `sidecar.skywalking.apache.org/initcontainer.Image` | The container image of the injected java agent container. | `apache/skywalking-java-agent:8.8.0-java8` |
| `sidecar.skywalking.apache.org/initcontainer.Command` | The command of the injected java agent container. | `sh` |
| `sidecar.skywalking.apache.org/initcontainer.args.Option` | The args option of the injected java agent container. | `-c` |
| `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` |
Expand Down
41 changes: 0 additions & 41 deletions hack/wait-webhook.sh

This file was deleted.

14 changes: 8 additions & 6 deletions operator/controllers/operator/configmap_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ func (r *ConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
// if validate false , we will delete the configmap and recreate a default configmap
if !apierrors.IsNotFound(err) {
ok, errinfo := injector.ValidateConfigmap(configmap)
if !ok {
log.Error(errinfo, "the default configmap validate false")
if deleteErr := r.Client.Delete(ctx, configmap); deleteErr != nil {
log.Error(deleteErr, "failed to delete the configmap that validate false")
}
if ok {
return ctrl.Result{}, nil
}
log.Info("delete the configmap that validate false")
log.Error(errinfo, "the default configmap validate false")
if deleteErr := r.Client.Delete(ctx, configmap); deleteErr != nil {
log.Error(deleteErr, "failed to delete the configmap that validate false")
return ctrl.Result{}, deleteErr
}
log.Info("deleted the configmap that validate false")
}
app := kubernetes.Application{
Client: r.Client,
Expand Down
23 changes: 15 additions & 8 deletions operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,22 @@ func main() {
&webhook.Admission{
Handler: &injector.JavaagentInjector{Client: mgr.GetClient()}})
setupLog.Info("/mutate-v1-pod webhook is registered")
}

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up health check")
os.Exit(1)
}
if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up ready check")
os.Exit(1)
if err := mgr.AddHealthzCheck("healthz", mgr.GetWebhookServer().StartedChecker()); err != nil {
setupLog.Error(err, "unable to set up health check for webhook")
os.Exit(1)
}
if err := mgr.AddReadyzCheck("readyz", mgr.GetWebhookServer().StartedChecker()); err != nil {
setupLog.Error(err, "unable to set up ready check for webhook")
os.Exit(1)
}
} else {
if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up ready check")
}
if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up ready check")
}
}

setupLog.Info("starting manager")
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/oap-agent-adapter-hpa/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ setup:
- namespace: skywalking-swck-system
resource: pod
for: condition=Ready
- name: wait webhook installing
command: |
bash hack/wait-webhook.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove wait-webhook.sh? Is it referred to some place else?

- name: install metrics-adapter
command: |
export ADAPTER_IMG=metrics-adapter
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/oap-ui-agent-external-storage/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ setup:
- namespace: skywalking-swck-system
resource: pod
for: condition=Ready
- name: wait webhook installing
command: |
bash hack/wait-webhook.sh
- name: setup elasticsearch
command: |
kubectl apply -f test/e2e/deploy-elasticsearch.yaml
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/oap-ui-agent-internal-storage/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ setup:
- namespace: skywalking-swck-system
resource: pod
for: condition=Ready
- name: wait webhook installing
command: |
bash hack/wait-webhook.sh
- name: setup storage(use the internal type)
command: |
kubectl apply -f test/e2e/internal-storage.yaml
Expand Down
3 changes: 0 additions & 3 deletions test/e2e/oap-ui-agent/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ setup:
- namespace: skywalking-swck-system
resource: pod
for: condition=Ready
- name: wait webhook installing
command: |
bash hack/wait-webhook.sh
- name: setup oapserver and ui
command: |
kubectl create namespace skywalking-system
Expand Down