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

Remove scaffolding images #19

Merged
merged 5 commits into from
Jan 10, 2024
Merged

Remove scaffolding images #19

merged 5 commits into from
Jan 10, 2024

Conversation

bouskaJ
Copy link
Collaborator

@bouskaJ bouskaJ commented Jan 8, 2024

Fixes #3 .

As wrote in the README.md file. This PR disable locally running operator because the operator connect directly to the trillian component. The communication is done through RPC. The RPC protocol does rely on HTTP/2 and this traffic is hard (but not impossible - see https://www.redhat.com/en/blog/grpc-or-http/2-ingress-connectivity-in-openshift) to route outside the cluster.

I will open new issue for fixing that.

@bouskaJ bouskaJ changed the title Labels Remove scaffolding images Jan 8, 2024
@bouskaJ bouskaJ force-pushed the labels branch 8 times, most recently from 1cd6f5d to c5577ad Compare January 8, 2024 17:45
@bouskaJ bouskaJ marked this pull request as ready for review January 8, 2024 17:53
@bouskaJ bouskaJ requested a review from cooktheryan January 8, 2024 17:56
@cooktheryan
Copy link
Collaborator

@bouskaJ how does the helm charts handle this today? Also, if we have the svc address defined in the configuration do we have the capabilities of bypassing the OpenShift Haproxy?

@bouskaJ
Copy link
Collaborator Author

bouskaJ commented Jan 9, 2024

@bouskaJ how does the helm charts handle this today?

Helm does not have any active member so there is no capability to run outside the cluster. It creates Job resources that runs always in the cluster. Also handling the configuration is quite hackish and it was solved by Jobs that are based on images from the https://github.com/securesign/scaffolding project and it brings additional cost of productization and maintenance. Also, it is hard to synchronize them so you can always see a lot of failed pods, restarting and waiting for something.

Also, if we have the svc address defined in the configuration do we have the capabilities of bypassing the OpenShift Haproxy?

I am not sure what you mean by this. The svc addresses are routed inside the cluster by default. Routing them outside is done by Route resource (that works only for http traffic and can be enhanced for the RPC) or using the nodeport.

I think both solutions (RPC route or nodeport) are possible, it just need some time to dig into it. The benefit of removing the dependency on the scaffolding images is worth that IMHO.

@bouskaJ
Copy link
Collaborator Author

bouskaJ commented Jan 9, 2024

@lance do you want to comment?

@bouskaJ
Copy link
Collaborator Author

bouskaJ commented Jan 9, 2024

I managed to workaround the issue using https://www.redhat.com/en/blog/grpc-or-http/2-ingress-connectivity-in-openshift. I will make it part of this PR.

@cooktheryan cooktheryan requested a review from lance January 9, 2024 13:48
@cooktheryan
Copy link
Collaborator

@sallyom or i can look at the code but @lance going to assign you as the main reviewer based on the above.

cc @lkatalin

1 similar comment
@cooktheryan
Copy link
Collaborator

@sallyom or i can look at the code but @lance going to assign you as the main reviewer based on the above.

cc @lkatalin

@lance
Copy link
Member

lance commented Jan 9, 2024

Also handling the configuration is quite hackish and it was solved by Jobs that are based on images from the https://github.com/securesign/scaffolding project and it brings additional cost of productization and maintenance. Also, it is hard to synchronize them so you can always see a lot of failed pods, restarting and waiting for something.

I agree with this. I have never really liked all of the scaffolding images we are required to produce for helm installation. These do things like initialize the database and initial service configuration. With the exception of backfill-redis none of these images are used after a Helm install.

The fact that these same simple processes can be easily incorporated into a Go operator is nice and yes, it does significantly reduce our internal resource utilization for builds, and makes product releases simpler, as we will eliminate around a half dozen images that we need to ship.

Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

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

Looking good! I left a few comments inline. Also, I like that we are using the app.kubernetes.io.part-of label for the application name. 👍

It looks like the trillian bits still need work on the initialization phases. I could be missing something, but I did not see where the database tables are created, for example.

I did not check every line of the ct_log initialization and compare with https://github.com/securesign/scaffolding/blob/redhat-v0.6/cmd/ctlog/createctconfig/main.go either. Is that scaffolding image the basis for the init code in, for example controllers/ctlog/create.go?

Overall, I like the pattern.

I think it's important that we get all of the initialization steps done correctly, of course. It might be nice to reference the scaffolding code in comments here, so that it's clear where the behavior is derived from. This also introduces a risk that scaffolding and the operator could diverge - something we need to be on top of.

This does seem to set us back a little bit with regard to BYO certs/keys/db/etc. doesn't it?

controllers/trillian/create.go Show resolved Hide resolved
controllers/trillian/create.go Show resolved Hide resolved
controllers/trillian/create.go Show resolved Hide resolved
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
Labels: labels,
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if utilities like this should always inject a part-of label. Or maybe that's what's always passed in... Just wondering if having the part-of labels always added at the point of object creation would help with consistency. Take it or leave it. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's always passed in the labels map that is parsed by https://github.com/securesign/secure-sign-operator/blob/labels/controllers/common/utils/kubernetes/common.go#L6 but maybe it make sense to have it explicitly defined. 👍 WIll fix it.

ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
Labels: labels,
Copy link
Member

Choose a reason for hiding this comment

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

The same comment here as from CreateConfigMap regarding labels.

controllers/constants/constants.go Show resolved Hide resolved
controllers/constants/images.go Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

How will we handle customers who want to bring their own certificates?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is possibility to set the secretName in the CRD (https://github.com/securesign/secure-sign-operator/blob/main/api/v1alpha1/fulcio_types.go#L13) the automatic key generation is optional and it was added in #14 (we will need to tidy the API once it's fully defined to be more understandable)

@bouskaJ
Copy link
Collaborator Author

bouskaJ commented Jan 10, 2024

@lance I think we are good to go. I would left the custom DB support (and the related create-db job), API refactoring and better documentation for follow-up PRs.

Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

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

/lgtm

@cooktheryan cooktheryan merged commit 074e2a6 into main Jan 10, 2024
1 check passed
@cooktheryan cooktheryan deleted the labels branch January 10, 2024 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate Jobs to the operator workload
3 participants