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

feat: Support oci-based helm repository #4018

Merged
merged 4 commits into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 32 additions & 27 deletions assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"AccountService"
],
"summary": "CreateToken creates a token",
"operationId": "CreateTokenMixin10",
"operationId": "CreateToken",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -157,7 +157,7 @@
"AccountService"
],
"summary": "DeleteToken deletes a token",
"operationId": "DeleteTokenMixin10",
"operationId": "DeleteToken",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -188,7 +188,7 @@
"ApplicationService"
],
"summary": "List returns list of applications",
"operationId": "ListMixin9",
"operationId": "List",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -239,7 +239,7 @@
"ApplicationService"
],
"summary": "Create creates an application",
"operationId": "CreateMixin9",
"operationId": "Create",
"parameters": [
{
"name": "body",
Expand All @@ -266,7 +266,7 @@
"ApplicationService"
],
"summary": "Update updates an application",
"operationId": "UpdateMixin9",
"operationId": "Update",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -400,7 +400,7 @@
"ApplicationService"
],
"summary": "Get returns an application by name",
"operationId": "GetMixin9",
"operationId": "Get",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -452,7 +452,7 @@
"ApplicationService"
],
"summary": "Delete deletes an application",
"operationId": "DeleteMixin9",
"operationId": "Delete",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1162,7 +1162,7 @@
"ClusterService"
],
"summary": "List returns list of clusters",
"operationId": "List",
"operationId": "ListMixin3",
"parameters": [
{
"type": "string",
Expand All @@ -1189,7 +1189,7 @@
"ClusterService"
],
"summary": "Create creates a cluster",
"operationId": "Create",
"operationId": "CreateMixin3",
"parameters": [
{
"name": "body",
Expand All @@ -1216,7 +1216,7 @@
"ClusterService"
],
"summary": "Update updates a cluster",
"operationId": "Update",
"operationId": "UpdateMixin3",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1250,7 +1250,7 @@
"ClusterService"
],
"summary": "Get returns a cluster by server address",
"operationId": "GetMixin2",
"operationId": "GetMixin3",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1278,7 +1278,7 @@
"ClusterService"
],
"summary": "Delete deletes a cluster",
"operationId": "Delete",
"operationId": "DeleteMixin3",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1358,7 +1358,7 @@
"GPGKeyService"
],
"summary": "List all available repository certificates",
"operationId": "ListMixin7",
"operationId": "ListMixin4",
"parameters": [
{
"type": "string",
Expand All @@ -1381,7 +1381,7 @@
"GPGKeyService"
],
"summary": "Create one or more GPG public keys in the server's configuration",
"operationId": "CreateMixin7",
"operationId": "CreateMixin4",
"parameters": [
{
"description": "Raw key data of the GPG key(s) to create",
Expand All @@ -1407,7 +1407,7 @@
"GPGKeyService"
],
"summary": "Delete specified GPG public key from the server's configuration",
"operationId": "DeleteMixin7",
"operationId": "DeleteMixin4",
"parameters": [
{
"type": "string",
Expand All @@ -1432,7 +1432,7 @@
"GPGKeyService"
],
"summary": "Get information about specified GPG public key from the server",
"operationId": "GetMixin7",
"operationId": "GetMixin4",
"parameters": [
{
"type": "string",
Expand All @@ -1458,7 +1458,7 @@
"ProjectService"
],
"summary": "List returns list of projects",
"operationId": "ListMixin6",
"operationId": "ListMixin5",
"parameters": [
{
"type": "string",
Expand All @@ -1480,7 +1480,7 @@
"ProjectService"
],
"summary": "Create a new project",
"operationId": "CreateMixin6",
"operationId": "CreateMixin5",
"parameters": [
{
"name": "body",
Expand All @@ -1507,7 +1507,7 @@
"ProjectService"
],
"summary": "Get returns a project by name",
"operationId": "GetMixin6",
"operationId": "GetMixin5",
"parameters": [
{
"type": "string",
Expand All @@ -1530,7 +1530,7 @@
"ProjectService"
],
"summary": "Delete deletes a project",
"operationId": "DeleteMixin6",
"operationId": "DeleteMixin5",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1630,7 +1630,7 @@
"ProjectService"
],
"summary": "Update updates a project",
"operationId": "UpdateMixin6",
"operationId": "UpdateMixin5",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1664,7 +1664,7 @@
"ProjectService"
],
"summary": "Create a new project token",
"operationId": "CreateToken",
"operationId": "CreateTokenMixin5",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1703,7 +1703,7 @@
"ProjectService"
],
"summary": "Delete a new project token",
"operationId": "DeleteToken",
"operationId": "DeleteTokenMixin5",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -1948,7 +1948,7 @@
"RepositoryService"
],
"summary": "Get returns a repository or its credentials",
"operationId": "GetMixin3",
"operationId": "GetMixin7",
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -2144,7 +2144,7 @@
"SessionService"
],
"summary": "Create a new JWT for authentication and set a cookie if using HTTP",
"operationId": "CreateMixin11",
"operationId": "CreateMixin8",
"parameters": [
{
"name": "body",
Expand All @@ -2169,7 +2169,7 @@
"SessionService"
],
"summary": "Delete an existing JWT cookie if using HTTP",
"operationId": "DeleteMixin11",
"operationId": "DeleteMixin8",
"responses": {
"200": {
"description": "A successful response.",
Expand Down Expand Up @@ -2203,7 +2203,7 @@
"SettingsService"
],
"summary": "Get returns Argo CD settings",
"operationId": "Get",
"operationId": "GetMixin10",
"responses": {
"200": {
"description": "A successful response.",
Expand Down Expand Up @@ -4682,6 +4682,11 @@
"format": "boolean",
"title": "Whether git-lfs support should be enabled for this repo"
},
"enableOCI": {
"type": "boolean",
"format": "boolean",
"title": "Whether helm-oci support should be enabled for this repo"
},
"inheritedCreds": {
"type": "boolean",
"format": "boolean",
Expand Down
11 changes: 9 additions & 2 deletions cmd/argocd/commands/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
tlsClientCertPath string
tlsClientCertKeyPath string
enableLfs bool
enableOci bool
)

// For better readability and easier formatting
Expand All @@ -69,6 +70,9 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {

# Add a private Helm repository named 'stable' via HTTPS
argocd repo add https://kubernetes-charts.storage.googleapis.com --type helm --name stable --username test --password test

# Add a private Helm OCI-based repository named 'stable' via HTTPS
argocd repo add helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type helm --name stable --enable-oci --username test --password test
`

var command = &cobra.Command{
Expand Down Expand Up @@ -126,6 +130,7 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
repo.InsecureIgnoreHostKey = insecureIgnoreHostKey
repo.Insecure = insecureSkipServerVerification
repo.EnableLFS = enableLfs
repo.EnableOCI = enableOci

if repo.Type == "helm" && repo.Name == "" {
errors.CheckError(fmt.Errorf("Must specify --name for repos of type 'helm'"))
Expand Down Expand Up @@ -157,6 +162,7 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
TlsClientCertData: repo.TLSClientCertData,
TlsClientCertKey: repo.TLSClientCertKey,
Insecure: repo.IsInsecure(),
EnableOci: repo.EnableOCI,
}
_, err := repoIf.ValidateAccess(context.Background(), &repoAccessReq)
errors.CheckError(err)
Expand All @@ -181,6 +187,7 @@ func NewRepoAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
command.Flags().BoolVar(&insecureIgnoreHostKey, "insecure-ignore-host-key", false, "disables SSH strict host key checking (deprecated, use --insecure-skip-server-verification instead)")
command.Flags().BoolVar(&insecureSkipServerVerification, "insecure-skip-server-verification", false, "disables server certificate and host key checks")
command.Flags().BoolVar(&enableLfs, "enable-lfs", false, "enable git-lfs (Large File Support) on this repository")
command.Flags().BoolVar(&enableOci, "enable-oci", false, "enable helm-oci (Helm OCI-Based Repository)")
command.Flags().BoolVar(&upsert, "upsert", false, "Override an existing repository with the same name even if the spec differs")
return command
}
Expand Down Expand Up @@ -209,7 +216,7 @@ func NewRepoRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command
// Print table of repo info
func printRepoTable(repos appsv1.Repositories) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
_, _ = fmt.Fprintf(w, "TYPE\tNAME\tREPO\tINSECURE\tLFS\tCREDS\tSTATUS\tMESSAGE\n")
_, _ = fmt.Fprintf(w, "TYPE\tNAME\tREPO\tINSECURE\tOCI\tLFS\tCREDS\tSTATUS\tMESSAGE\n")
for _, r := range repos {
var hasCreds string
if !r.HasCredentials() {
Expand All @@ -221,7 +228,7 @@ func printRepoTable(repos appsv1.Repositories) {
hasCreds = "true"
}
}
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%v\t%v\t%s\t%s\t%s\n", r.Type, r.Name, r.Repo, r.IsInsecure(), r.EnableLFS, hasCreds, r.ConnectionState.Status, r.ConnectionState.Message)
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%v\t%v\t%v\t%s\t%s\t%s\n", r.Type, r.Name, r.Repo, r.IsInsecure(), r.EnableOCI, r.EnableLFS, hasCreds, r.ConnectionState.Status, r.ConnectionState.Message)
}
_ = w.Flush()
}
Expand Down
4 changes: 4 additions & 0 deletions docs/user-guide/commands/argocd_repo_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ argocd repo add REPOURL [flags]
# Add a private Helm repository named 'stable' via HTTPS
argocd repo add https://kubernetes-charts.storage.googleapis.com --type helm --name stable --username test --password test

# Add a private Helm OCI-based repository named 'stable' via HTTPS
argocd repo add helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type helm --name stable --enable-oci --username test --password test

```

### Options

```
--enable-lfs enable git-lfs (Large File Support) on this repository
--enable-oci enable helm-oci (Helm OCI-Based Repository)
-h, --help help for add
--insecure-ignore-host-key disables SSH strict host key checking (deprecated, use --insecure-skip-server-verification instead)
--insecure-skip-server-verification disables server certificate and host key checks
Expand Down
Loading