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

Support cert-manager for certificate management #277

Merged
merged 7 commits into from
Feb 26, 2020

Conversation

Gallardot
Copy link
Member

What problem does this PR solve?

#237

What is changed and how does it work?

Check List

Tests

  • No code

Code changes

  • Has Terraform scripts change

Side effects

  • No

Related changes

  • Need to update the documentation

Does this PR introduce a user-facing change?:

Support cert-manager for certificate management.
Add doc for the helm charts.

@claassistantio
Copy link

claassistantio commented Feb 24, 2020

CLA assistant check
All committers have signed the CLA.

@cwen0
Copy link
Member

cwen0 commented Feb 24, 2020

@Gallardot Thanks for your contribution! Please sign CLA, first!

@zhouqiang-cl
Copy link
Contributor

@Gallardot thank you very much.

@zhouqiang-cl
Copy link
Contributor

@yeya24 please take a look too

Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks for your great work! Overall LGTM, just a few nits. Let @cwen0 give another review.


## Parameters

The following tables list the configurable parameters of the Chaos Mesh chart and their default values.
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow. This is amazing! I think every user needs that, thanks!

| `chaosDaemon.image` | the docker image for chaos-daemon | `pingcap/chaos-mesh:latest` |
| `chaosDaemon.imagePullPolicy` | image pull policy | `Always` |
| `chaosDaemon.grpcPort` | | `31767` |
| `chaosDaemon.httpPort` | | `31766` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it better to add some comments about the two ports? Like their usage?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not very familiar with chaosDaemon. I may need some help.
chaosDaemon.grpcPort | the port which grpc server listens on
chaosDaemon.httpPort | the port which http server listens on

code from here
https://github.com/pingcap/chaos-mesh/blob/7ce47e8d6fb9d047fc82a0b555f5b690f42f8942/cmd/chaos-daemon/main.go#L38-L39

It's OK?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is okay. Thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

| `controllerManager.nodeSelector` | Node labels for chaos-controller-manager pod assignment | `{}` |
| `controllerManager.tolerations` | Toleration labels for chaos-controller-manager pod assignment | `[]` |
| `controllerManager.affinity` | Map of chaos-controller-manager node/pod affinities | `{}` |
| `controllerManager.podAnnotations` | Deployment chaos-controller-manager annotations | `{}`|
Copy link
Contributor

Choose a reason for hiding this comment

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

Deployment chaos-controller-manager annotations is kind of misleading since these annotations are for pods. What about just simply Pod annotations of chaos-controller-manager

*/}}
{{- define "chaos-mesh.webhook" -}}
{{- printf "admission-webhook.pingcap.com" -}}
{{- end -}}
Copy link
Contributor

Choose a reason for hiding this comment

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

We may need a new line here

kubectl -n ${K8S_NAMESPACE} apply -f -

{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

kubectl delete secrets -n {{ .Release.Namespace }} {{ template "chaos-mesh.certs" . }} || true
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

secretName: {{ template "chaos-mesh.certs" . }}
issuerRef:
name: chaos-mesh-selfsigned
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

enabled: false
autoDeleteSecret: false

FailurePolicy: Ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

| `dashboard.resources` | CPU/Memory resource requests/limits for chaos-dashboard pod | `requests: { cpu: "250m", memory: "512Mi" }, limits:{ cpu: "500m", memory: "1024Mi" }` |
| `dashboard.volume.storage` | | `3Gi` |
| `dashboard.volume.storageClassName` | | `standard` |
| `prometheus.create` | enable the prometheus | `false` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't need the, enable Prometheus is fine

| `chaosDaemon.podAnnotations` | Deployment chaos-daemon annotations | `{}` |
| `chaosDaemon.runtime` | runtime specifies which container runtime to use. Currently we only supports docker and containerd. | `docker` |
| `chaosDaemon.socketPath` | specifies the container runtime socket | `/var/run/docker.sock` |
| `dashboard.create` | enable the chaos-dashboard | `false` |
Copy link
Contributor

Choose a reason for hiding this comment

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

enable chaos-dashboard

service:
name: chaos-mesh-controller-manager
namespace: ${K8S_NAMESPACE}
path: "/inject-v1-pod"
Copy link
Contributor

@yeya24 yeya24 Feb 24, 2020

Choose a reason for hiding this comment

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

I tried to deploy with certManager.enabled = false and I got the error below in webhook-mw-job pod. Seems the service field is still required

# job failed
webhook-mw-job-4fpbb                        0/1     Error       0          69s
webhook-mw-job-89zxk                        0/1     Error       0          29s
webhook-mw-job-kv44l                        0/1     Error       0          99s
webhook-mw-job-lrb6z                        0/1     Error       0          89s
webhook-mw-job-qlfsj                        0/1     Error       0          101s


klo webhook-mw-job-kv44l    
The MutatingWebhookConfiguration "chaos-mesh-sidecar-injector" is invalid: webhooks[0].clientConfig: Required value: exactly one of url or service is required

Copy link
Member Author

Choose a reason for hiding this comment

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

What is your k8s version? My version is v1.17.2 . System operating normally . I will fix it right now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am using 1.17.0

Copy link
Member Author

Choose a reason for hiding this comment

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

Can not recurrence this error, if I use 1.17.0. But I have added the service field on the MutatingWebhookConfiguration. Please try again. Thank you.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! With the updated PR, and then it works!

@Gallardot
Copy link
Member Author

I have no idea for why the Jenkins job failed. I need some help.
@zhouqiang-cl

@Gallardot
Copy link
Member Author

Maybe need to do the same things like @YangKeao at this 83a4100 ?

@zhouqiang-cl

@YangKeao
Copy link
Member

@Gallardot go get sigs.k8s.io/controller-tools/cmd/[email protected] to upgrade controller-gen, and then make yaml will fix it.

@zhouqiang-cl
Copy link
Contributor

Maybe need to do the same things like @YangKeao at this 83a4100 ?

@Gallardot @cwen0 will fix it

README.md Outdated

```bash
# helm 2.X
helm delete chaos-mesh
Copy link
Member

Choose a reason for hiding this comment

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

helm delete chaos-mesh --purge

@@ -0,0 +1,138 @@
# Chaos Mesh
Copy link
Member

Choose a reason for hiding this comment

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

@dcalvin PTAL

webhook:
certManager:
enabled: true
autoDeleteSecret: true
Copy link
Member

Choose a reason for hiding this comment

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

autoDeleteSecret is misleading, How about naming it deleteSecret, If the deleteSecret is true, we will create a job to delete the secret, Otherwise, do nothing

Copy link
Member Author

Choose a reason for hiding this comment

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

Good advice. I'm confused about that too.

@@ -0,0 +1,58 @@
---
Copy link
Member

Choose a reason for hiding this comment

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

rename this file to webhook-configuration.yaml?

Copy link
Member Author

Choose a reason for hiding this comment

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

All done. Please take a look again.Thanks.

@codecov-io
Copy link

codecov-io commented Feb 25, 2020

Codecov Report

Merging #277 into master will increase coverage by 1.43%.
The diff coverage is 39.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #277      +/-   ##
==========================================
+ Coverage    60.4%   61.84%   +1.43%     
==========================================
  Files          36       40       +4     
  Lines        1985     2445     +460     
==========================================
+ Hits         1199     1512     +313     
- Misses        692      833     +141     
- Partials       94      100       +6
Impacted Files Coverage Δ
api/v1alpha1/timechaos_types.go 4.34% <0%> (-0.31%) ⬇️
pkg/chaosdaemon/time_server.go 100% <100%> (ø) ⬆️
pkg/utils/time.go 33.33% <33.33%> (ø)
pkg/time/time_linux.go 49.12% <66.66%> (-0.88%) ⬇️
pkg/webhook/inject/inject.go 75.07% <0%> (ø)
pkg/webhook/config/watcher/watcher.go 54.08% <0%> (ø)
pkg/webhook/config/watcher/config.go 100% <0%> (ø)
pkg/webhook/config/config.go 90% <0%> (+2.5%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce4a192...7fe605f. Read the comment docs.

yeya24
yeya24 previously approved these changes Feb 25, 2020
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

I think it looks good on my side, thanks! You just need to address other reviewers' comments.

Copy link
Member

@cwen0 cwen0 left a comment

Choose a reason for hiding this comment

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

LGTM

@cwen0
Copy link
Member

cwen0 commented Feb 26, 2020

@yeya24 PTAL again, thanks!

Copy link
Member

@fewdan fewdan left a comment

Choose a reason for hiding this comment

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

LGTM

@zhouqiang-cl
Copy link
Contributor

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Feb 26, 2020

/run-all-tests

@sre-bot sre-bot merged commit 43450b9 into chaos-mesh:master Feb 26, 2020
@Gallardot Gallardot deleted the cert branch February 27, 2020 02:09
sjwsl pushed a commit to sjwsl/chaos-mesh that referenced this pull request May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants