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

Using an OCI compliant image registry instead of S3 for storage #523

Merged
merged 2 commits into from
May 13, 2020

Conversation

marccampbell
Copy link
Member

@marccampbell marccampbell commented May 12, 2020

This is an experimental feature to fix #520. It also adds docker/distribution to the local dev env (leaving minio also). This is not enabled in dev by default, so no dev env migration is necessary.
This will not impact deployed versions because this feature is not enabled by default.

  • Add an OCI compliant image registry to the dev stack
  • Update the go code to push image versions to the registry, when configured
  • Update the go code to pull image versions from the registry, when configured
  • Move the typescript code that reads from s3 (view files page) into go so we don't need to port that
  • Upload support bundles to the OCI registry
  • Download support bundles from the OCI registry
  • Provide validation during startup that the registry supports ORA
  • Path for migrating from S3 to OCI
  • Document the registries we support, put an alpha label on this one ([1.16.0] Add docs for OCI Registry storage kots.io#206)

Some quality of life todos before merging:

  • Create some functions and shared config in that archive.go file. Building OCI refs is fragile.
  • Update the e2e tests to include an installation on registry

Some new things:

  • Injected analyzers don't contain messages

@marccampbell marccampbell force-pushed the issue/520 branch 7 times, most recently from aed7988 to b0375d5 Compare May 13, 2020 20:52
@marccampbell marccampbell marked this pull request as ready for review May 13, 2020 20:57
@laverya laverya self-requested a review May 13, 2020 21:42
# - name: STORAGE_BASEURI
# value: "docker://kotsadm-storage-registry:5000"
# - name: STORAGE_BASEURI_PLAINHTTP
# value: "true"
Copy link
Member

Choose a reason for hiding this comment

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

should these stay commented out?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was torn on this one. Enabling this makes the environment use the new OCI storage. But there's no migration, so if these are present, it will break envs.

Any thoughts on how you'd like to see this rolled out as an alpha feature to the skaffold environment?

@@ -78,6 +80,7 @@ func Start() {
r.Path("/api/v1/upload").Methods("PUT").HandlerFunc(handlers.UploadExistingApp)
r.Path("/api/v1/download").Methods("GET").HandlerFunc(handlers.DownloadApp)
r.Path("/api/v1/app/{appSlug}/sequence/{sequence}/renderedcontents").Methods("OPTIONS", "GET").HandlerFunc(handlers.GetAppRenderedContents)
r.Path("/api/v1/app/{appSlug}/sequence/{sequence}/contents").Methods("OPTIONS", "GET").HandlerFunc(handlers.GetAppContents)
Copy link
Member

Choose a reason for hiding this comment

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

is this an entirely new route?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. It used to be a GQL route. This is used on the ViewFiles page to render the application contents. I didn't want to put the OCI get/put code in Typescript, so I ported this endpoint to Go /Rest.

return
}

JSON(w, 200, map[string]interface{}{"files": archiveFiles})
Copy link
Member

Choose a reason for hiding this comment

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

could we make this into a better defined type?
at least map[string]map[string][]byte

Success: false,
}

sess, err := session.Parse(r.Header.Get("Authorization"))
Copy link
Member

Choose a reason for hiding this comment

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

I really wish we could do this in a middleware like with gin

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. We should write a design proposal up for this change

io.Copy(w, f)
}

func UploadTroubleshootBundle(w http.ResponseWriter, r *http.Request) {
Copy link
Member

Choose a reason for hiding this comment

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

should we call this "UploadSupportBundle", like the other functions here?

"github.com/replicatedhq/kots/kotsadm/pkg/supportbundle/types"
"github.com/segmentio/ksuid"
)

func SetBundleAnalysis(id string, insights []byte) error {
Copy link
Member

Choose a reason for hiding this comment

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

was this never called?

Copy link
Member Author

Choose a reason for hiding this comment

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

moved to analysis.go. this file was big, splitting it up since i added a lot more to it

Copy link
Member

Choose a reason for hiding this comment

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

🤦 the downsides of marking files as 'read' as you go is that you can't cmd+f them

@marccampbell marccampbell merged commit c452f38 into master May 13, 2020
@marccampbell marccampbell deleted the issue/520 branch May 23, 2022 11:57
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.

KOTS should use an image registry instead of S3-compatible object store
2 participants