mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
Replace Helm Hub with Artifact Hub (#8626)
* Replace Helm Hub with Artifact Hub Signed-off-by: Scott Rigby <scott@r6by.com> * Update link to new doc entry for Monocular compatible search API Signed-off-by: Scott Rigby <scott@r6by.com> * Add struct for Artifact Hub data, and return correct URL for both artifact hub instances and backwards compatibility for Monocular search API Signed-off-by: Scott Rigby <scott@r6by.com> * Keep default endpoint hub.helm.sh, so the helm org controls the domain. At least until artifacthub moves to CNCF incubation Signed-off-by: Scott Rigby <scott@r6by.com>
This commit is contained in:
parent
bed1a42a39
commit
c495e88250
5 changed files with 38 additions and 16 deletions
|
|
@ -9,7 +9,7 @@ Helm is a tool for managing Charts. Charts are packages of pre-configured Kubern
|
|||
|
||||
Use Helm to:
|
||||
|
||||
- Find and use [popular software packaged as Helm Charts](https://hub.helm.sh) to run in Kubernetes
|
||||
- Find and use [popular software packaged as Helm Charts](https://artifacthub.io/packages/search?kind=0) to run in Kubernetes
|
||||
- Share your own applications as Helm Charts
|
||||
- Create reproducible builds of your Kubernetes applications
|
||||
- Intelligently manage your Kubernetes manifest files
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ import (
|
|||
|
||||
const searchDesc = `
|
||||
Search provides the ability to search for Helm charts in the various places
|
||||
they can be stored including the Helm Hub and repositories you have added. Use
|
||||
search subcommands to search different locations for charts.
|
||||
they can be stored including the Artifact Hub and repositories you have added.
|
||||
Use search subcommands to search different locations for charts.
|
||||
`
|
||||
|
||||
func newSearchCmd(out io.Writer) *cobra.Command {
|
||||
|
|
|
|||
|
|
@ -30,15 +30,23 @@ import (
|
|||
)
|
||||
|
||||
const searchHubDesc = `
|
||||
Search the Helm Hub or an instance of Monocular for Helm charts.
|
||||
Search for Helm charts in the Artifact Hub or your own hub instance.
|
||||
|
||||
The Helm Hub provides a centralized search for publicly available distributed
|
||||
charts. It is maintained by the Helm project. It can be visited at
|
||||
https://hub.helm.sh
|
||||
Artifact Hub is a web-based application that enables finding, installing, and
|
||||
publishing packages and configurations for CNCF projects, including publicly
|
||||
available distributed charts Helm charts. It is a Cloud Native Computing
|
||||
Foundation sandbox project. You can browse the hub at https://artifacthub.io/
|
||||
|
||||
Monocular is a web-based application that enables the search and discovery of
|
||||
charts from multiple Helm Chart repositories. It is the codebase that powers the
|
||||
Helm Hub. You can find it at https://github.com/helm/monocular
|
||||
The [KEYWORD] argument accepts either a keyword string, or quoted string of rich
|
||||
query options. For rich query options documentation, see
|
||||
https://artifacthub.github.io/hub/api/?urls.primaryName=Monocular%20compatible%20search%20API#/Monocular/get_api_chartsvc_v1_charts_search
|
||||
|
||||
Previous versions of Helm used an instance of Monocular as the default
|
||||
'endpoint', so for backwards compatibility Artifact Hub is compatible with the
|
||||
Monocular search API. Similarly, when setting the 'endpoint' flag, the specified
|
||||
endpoint must also be implement a Monocular compatible search API endpoint.
|
||||
Note that when specifying a Monocular instance as the 'endpoint', rich queries
|
||||
are not supported. For API details, see https://github.com/helm/monocular
|
||||
`
|
||||
|
||||
type searchHubOptions struct {
|
||||
|
|
@ -51,8 +59,8 @@ func newSearchHubCmd(out io.Writer) *cobra.Command {
|
|||
o := &searchHubOptions{}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "hub [keyword]",
|
||||
Short: "search for charts in the Helm Hub or an instance of Monocular",
|
||||
Use: "hub [KEYWORD]",
|
||||
Short: "search for charts in the Artifact Hub or your own hub instance",
|
||||
Long: searchHubDesc,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return o.run(out, args)
|
||||
|
|
@ -60,7 +68,7 @@ func newSearchHubCmd(out io.Writer) *cobra.Command {
|
|||
}
|
||||
|
||||
f := cmd.Flags()
|
||||
f.StringVar(&o.searchEndpoint, "endpoint", "https://hub.helm.sh", "monocular instance to query for charts")
|
||||
f.StringVar(&o.searchEndpoint, "endpoint", "https://hub.helm.sh", "Hub instance to query for charts")
|
||||
f.UintVar(&o.maxColWidth, "max-col-width", 50, "maximum column width for output table")
|
||||
bindOutputFlag(cmd, &o.outputFormat)
|
||||
|
||||
|
|
@ -98,7 +106,14 @@ type hubSearchWriter struct {
|
|||
func newHubSearchWriter(results []monocular.SearchResult, endpoint string, columnWidth uint) *hubSearchWriter {
|
||||
var elements []hubChartElement
|
||||
for _, r := range results {
|
||||
// Backwards compatibility for Monocular
|
||||
url := endpoint + "/charts/" + r.ID
|
||||
|
||||
// Check for artifactHub compatibility
|
||||
if r.ArtifactHub.PackageURL != "" {
|
||||
url = r.ArtifactHub.PackageURL
|
||||
}
|
||||
|
||||
elements = append(elements, hubChartElement{url, r.Relationships.LatestChartVersion.Data.Version, r.Relationships.LatestChartVersion.Data.AppVersion, r.Attributes.Description})
|
||||
}
|
||||
return &hubSearchWriter{elements, columnWidth}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package monocular contains the logic for interacting with monocular instances
|
||||
// like the Helm Hub.
|
||||
// Package monocular contains the logic for interacting with a Monocular
|
||||
// compatible search API endpoint. For example, as implemented by the Artifact
|
||||
// Hub.
|
||||
//
|
||||
// This is a library for interacting with monocular
|
||||
// This is a library for interacting with a monocular compatible search API
|
||||
package monocular
|
||||
|
|
|
|||
|
|
@ -40,12 +40,18 @@ const SearchPath = "api/chartsvc/v1/charts/search"
|
|||
// SearchResult represents an individual chart result
|
||||
type SearchResult struct {
|
||||
ID string `json:"id"`
|
||||
ArtifactHub ArtifactHub `json:"artifactHub"`
|
||||
Type string `json:"type"`
|
||||
Attributes Chart `json:"attributes"`
|
||||
Links Links `json:"links"`
|
||||
Relationships Relationships `json:"relationships"`
|
||||
}
|
||||
|
||||
// ArtifactHub represents data specific to Artifact Hub instances
|
||||
type ArtifactHub struct {
|
||||
PackageURL string `json:"packageUrl"`
|
||||
}
|
||||
|
||||
// Chart is the attributes for the chart
|
||||
type Chart struct {
|
||||
Name string `json:"name"`
|
||||
|
|
|
|||
Loading…
Reference in a new issue