-
Notifications
You must be signed in to change notification settings - Fork 32
Issue cert-manager certificates for etcd-operator #9
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
base: main
Are you sure you want to change the base?
Conversation
@ArkaSaha30 please rebase this PR. I just merged #8 |
23af956
to
b177198
Compare
A couple of high level thoughts:
|
cc @hakman |
b177198
to
5e15ec4
Compare
3685a85
to
f5456d0
Compare
Sure, thank you! |
Please read #10 |
f5456d0
to
b5e5e38
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ArkaSaha30 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Updating the current progress here, making changes to this PR to accommodate certificates prefixed with etcd cluster names as per mentioned in the issue. |
@ArkaSaha30 : Please let me know if you need help in any tasks. Just to avoid overlap, I'll wait for you to confirm if I can pick up some of the tasks. Thanks. |
Sure, thank you! |
Sure, once you complete this, I will add that the code for secrets mounting in the same PR. |
b5e5e38
to
b5e719e
Compare
b5e719e
to
b59f6a1
Compare
Updated the PR to align with the certificate management design,
etcd-operator-controller-manager logs:
|
b59f6a1
to
699b561
Compare
Please rebase this PR and resolve the workflow failure, thx |
edc0294
to
3cdf84a
Compare
Signed-off-by: ArkaSaha30 <[email protected]>
Signed-off-by: ArkaSaha30 <[email protected]>
This commit will add EnsureCertificateSecret which will - get invoked only when `GetCertificateConfig` in reconcile logic returns isNotFoundError(i.e. the Certificate is not present) - check if `issuerName`, `issuerKind` is correctly defined - call `ValidateCertificateSecret` which will: - check if secret is already present - check if private key is present and matches with the certificate - if `ValidateCertificateSecret` returns error, create certificate Signed-off-by: ArkaSaha30 <[email protected]> fix Signed-off-by: ArkaSaha30 <[email protected]>
Signed-off-by: ArkaSaha30 <[email protected]>
Signed-off-by: ArkaSaha30 <[email protected]>
Signed-off-by: ArkaSaha30 <[email protected]>
Signed-off-by: ArkaSaha30 <[email protected]>
Pre-requisites:
|
@ArkaSaha30, sorry but the tests are still failing. |
Yes, I am fixing them. |
863bd09
to
f20fd10
Compare
Signed-off-by: ArkaSaha30 <[email protected]>
Signed-off-by: ArkaSaha30 <[email protected]>
func (r *EtcdClusterReconciler) getStatefulSetPods(sts *appsv1.StatefulSet, ctx context.Context) (*corev1.PodList, error) { | ||
podList := corev1.PodList{} | ||
err := r.Client.List(ctx, &podList, client.InNamespace(sts.Namespace), client.MatchingLabels(sts.Spec.Selector.MatchLabels)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &podList, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to reuse getStatefulSet
instead of adding a new method?
etcd-operator/internal/controller/utils.go
Lines 396 to 403 in 2c9366a
func getStatefulSet(ctx context.Context, c client.Client, name, namespace string) (*appsv1.StatefulSet, error) { | |
sts := &appsv1.StatefulSet{} | |
err := c.Get(ctx, client.ObjectKey{Name: name, Namespace: namespace}, sts) | |
if err != nil { | |
return nil, err | |
} | |
return sts, nil | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you can. The StatefulSet API doesn't have a way to return the pods. I believe the way to get them is by listing pods using the selector, as Arka did it (line 480).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you can. The StatefulSet API doesn't have a way to return the pods. I believe the way to get them is by listing pods using the selector, as Arka did it (line 480).
+1
I was wondering if certificate creation can be independent of pod creation/ready. If so, we can form the certificate/secret name etcdcluster-sample-[n]
where n=0, n< statefulset replicas
.
This PR will add a basic capability to issue self-signed certificates for etcd-operator.
Prerequisite: cert-manager needs to be installed before deploying the etcd-operator
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.16.2/cert-manager.yaml
Once etcd-operator is deployed it requests 3 certificates from an issuer in the
etcd-operator-system
namespace