-
Notifications
You must be signed in to change notification settings - Fork 34
Conversation
Some meta-comments on the approach:
|
I think the operator should just create the certs without running a job, but that package isn't exposed in Contour so we need to do that work first. Duplicating the code doesn't seem like a good approach, but would unblock the operator work. I guess it could also call the contour binary like the certgen job as an another intermediate step. |
Yep, I agree that's a good option. However, I'd also like the operator to allow the possibility of using cert-manager to create the certificates, which implies some config in the contour spec WDYT @danehans ? |
@jpeach My plan for the operator is to be consistent with |
I see, that sounds reasonable to me. Let's capture this approach in the code comments? |
The operator should be able to generate certs for a user, this is super helpful to get running quickly as well as fill that gap for those who don't want to deal with their own cert generation, but it is important to allow certs to come from cert-manager, but also to come from standard k8s secrets directly should a user have their own internal system for generating certs. |
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.
Added some initial feedback.
controller/contour/job.go
Outdated
|
||
// currentJob gets the Job for contour from the api server, returning true | ||
// and the Job if successful. | ||
func (r *Reconciler) currentJob(ctx context.Context, contour *operatorv1alpha1.Contour) (bool, *batchv1.Job, error) { |
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.
Rather than trying to update the job in place, what I'd suggest is using GenerateName to name the job (IIRC that can be made to work) and labelling it with an owner ref. That way you can always List() to find the certgen jobs you own, and still generate unique names when you need a new one.
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.
labelling it with an owner ref.
@jpeach the Contour
that creates the Job
resides in a different namespace, so it can't be used as an owner. Is the original job the owner?
61ba99e
to
90377e3
Compare
@jpeach I've updated the PR based on your feedback, PTAL. |
Signed-off-by: Daneyon Hansen <daneyonhansen@gmail.com>
controller/contour/job.go
Outdated
|
||
const ( | ||
jobContainerName = "contour" | ||
jobImageName = "docker.io/projectcontour/contour:main" |
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.
The job should use the versioned contour container image. The reason we used main historically was that re-applying the YAML would fail on upgrades because that would attempt to modify the job spec. I don't think you gave that issue here since you are recreating the job rather than modifying it.
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.
@jpeach I updated the desired Job
to use the image from the Config
API and removed jobImageName
. I would expect the image from Config
is set as part of the release process. If not, then the default image tag should be updated when the operator is ready for release.
0f6ef73
to
4f4add4
Compare
Signed-off-by: Daneyon Hansen <daneyonhansen@gmail.com>
Adds support for managing the Contour certgen
Job
.Fixes #39
@jpeach @skriss @stevesloka @Miciah PTAL