Skip to content

Commit 18c4d9d

Browse files
feat: oci support (Beta) (#18646)
Signed-off-by: Blake Pettersson <[email protected]> Co-authored-by: Michael Crenshaw <[email protected]>
1 parent 109cd6c commit 18c4d9d

File tree

81 files changed

+5434
-1541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+5434
-1541
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ cmd/argocd/argocd
2727
cmd/argocd-application-controller/argocd-application-controller
2828
cmd/argocd-repo-server/argocd-repo-server
2929
cmd/argocd-server/argocd-server
30+
31+
# ignore generated `.argocd-helm-dep-up` marker file; this should not be committed to git
32+
reposerver/repository/testdata/**/.argocd-helm-dep-up

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ install-test-tools-local:
598598
./hack/install.sh kustomize
599599
./hack/install.sh helm
600600
./hack/install.sh gotestsum
601+
./hack/install.sh oras
601602

602603
# Installs all tools required for running codegen (Linux packages)
603604
.PHONY: install-codegen-tools-local

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ commit-server: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go
88
ui: sh -c 'cd ui && ${ARGOCD_E2E_YARN_CMD:-yarn} start'
99
git-server: test/fixture/testrepos/start-git.sh
1010
helm-registry: test/fixture/testrepos/start-helm-registry.sh
11+
oci-registry: test/fixture/testrepos/start-authenticated-helm-registry.sh
1112
dev-mounter: [[ "$ARGOCD_E2E_TEST" != "true" ]] && go run hack/dev-mounter/main.go --configmap argocd-ssh-known-hosts-cm=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} --configmap argocd-tls-certs-cm=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} --configmap argocd-gpg-keys-cm=${ARGOCD_GPG_DATA_PATH:-/tmp/argocd-local/gpg/source}
1213
applicationset-controller: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "GOCOVERDIR=${ARGOCD_COVERAGE_DIR:-/tmp/coverage/applicationset-controller} FORCE_LOG_COLORS=4 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_SSH_DATA_PATH=${ARGOCD_SSH_DATA_PATH:-/tmp/argocd-local/ssh} ARGOCD_BINARY_NAME=argocd-applicationset-controller $COMMAND --loglevel debug --metrics-addr localhost:12345 --probe-addr localhost:12346 --argocd-repo-server localhost:${ARGOCD_E2E_REPOSERVER_PORT:-8081}"
1314
notification: [ "$BIN_MODE" = 'true' ] && COMMAND=./dist/argocd || COMMAND='go run ./cmd/main.go' && sh -c "GOCOVERDIR=${ARGOCD_COVERAGE_DIR:-/tmp/coverage/notification} FORCE_LOG_COLORS=4 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_TLS_DATA_PATH=${ARGOCD_TLS_DATA_PATH:-/tmp/argocd-local/tls} ARGOCD_BINARY_NAME=argocd-notifications $COMMAND --loglevel debug --application-namespaces=${ARGOCD_APPLICATION_NAMESPACES:-''} --self-service-notification-enabled=${ARGOCD_NOTIFICATION_CONTROLLER_SELF_SERVICE_NOTIFICATION_ENABLED:-'false'}"

assets/swagger.json

Lines changed: 155 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/argocd-repo-server/commands/argocd_repo_server.go

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,30 +53,33 @@ var (
5353

5454
func NewCommand() *cobra.Command {
5555
var (
56-
parallelismLimit int64
57-
listenPort int
58-
listenHost string
59-
metricsPort int
60-
metricsHost string
61-
otlpAddress string
62-
otlpInsecure bool
63-
otlpHeaders map[string]string
64-
otlpAttrs []string
65-
cacheSrc func() (*reposervercache.Cache, error)
66-
tlsConfigCustomizer tls.ConfigCustomizer
67-
tlsConfigCustomizerSrc func() (tls.ConfigCustomizer, error)
68-
redisClient *redis.Client
69-
disableTLS bool
70-
maxCombinedDirectoryManifestsSize string
71-
cmpTarExcludedGlobs []string
72-
allowOutOfBoundsSymlinks bool
73-
streamedManifestMaxTarSize string
74-
streamedManifestMaxExtractedSize string
75-
helmManifestMaxExtractedSize string
76-
helmRegistryMaxIndexSize string
77-
disableManifestMaxExtractedSize bool
78-
includeHiddenDirectories bool
79-
cmpUseManifestGeneratePaths bool
56+
parallelismLimit int64
57+
listenPort int
58+
listenHost string
59+
metricsPort int
60+
metricsHost string
61+
otlpAddress string
62+
otlpInsecure bool
63+
otlpHeaders map[string]string
64+
otlpAttrs []string
65+
cacheSrc func() (*reposervercache.Cache, error)
66+
tlsConfigCustomizer tls.ConfigCustomizer
67+
tlsConfigCustomizerSrc func() (tls.ConfigCustomizer, error)
68+
redisClient *redis.Client
69+
disableTLS bool
70+
maxCombinedDirectoryManifestsSize string
71+
cmpTarExcludedGlobs []string
72+
allowOutOfBoundsSymlinks bool
73+
streamedManifestMaxTarSize string
74+
streamedManifestMaxExtractedSize string
75+
helmManifestMaxExtractedSize string
76+
helmRegistryMaxIndexSize string
77+
ociManifestMaxExtractedSize string
78+
disableOCIManifestMaxExtractedSize bool
79+
disableManifestMaxExtractedSize bool
80+
includeHiddenDirectories bool
81+
cmpUseManifestGeneratePaths bool
82+
ociMediaTypes []string
8083
)
8184
command := cobra.Command{
8285
Use: cliName,
@@ -125,6 +128,9 @@ func NewCommand() *cobra.Command {
125128
helmManifestMaxExtractedSizeQuantity, err := resource.ParseQuantity(helmManifestMaxExtractedSize)
126129
errors.CheckError(err)
127130

131+
ociManifestMaxExtractedSizeQuantity, err := resource.ParseQuantity(ociManifestMaxExtractedSize)
132+
errors.CheckError(err)
133+
128134
helmRegistryMaxIndexSizeQuantity, err := resource.ParseQuantity(helmRegistryMaxIndexSize)
129135
errors.CheckError(err)
130136

@@ -144,8 +150,11 @@ func NewCommand() *cobra.Command {
144150
StreamedManifestMaxTarSize: streamedManifestMaxTarSizeQuantity.ToDec().Value(),
145151
HelmManifestMaxExtractedSize: helmManifestMaxExtractedSizeQuantity.ToDec().Value(),
146152
HelmRegistryMaxIndexSize: helmRegistryMaxIndexSizeQuantity.ToDec().Value(),
153+
OCIManifestMaxExtractedSize: ociManifestMaxExtractedSizeQuantity.ToDec().Value(),
154+
DisableOCIManifestMaxExtractedSize: disableOCIManifestMaxExtractedSize,
147155
IncludeHiddenDirectories: includeHiddenDirectories,
148156
CMPUseManifestGeneratePaths: cmpUseManifestGeneratePaths,
157+
OCIMediaTypes: ociMediaTypes,
149158
}, askPassServer)
150159
errors.CheckError(err)
151160

@@ -249,9 +258,12 @@ func NewCommand() *cobra.Command {
249258
command.Flags().StringVar(&streamedManifestMaxExtractedSize, "streamed-manifest-max-extracted-size", env.StringFromEnv("ARGOCD_REPO_SERVER_STREAMED_MANIFEST_MAX_EXTRACTED_SIZE", "1G"), "Maximum size of streamed manifest archives when extracted")
250259
command.Flags().StringVar(&helmManifestMaxExtractedSize, "helm-manifest-max-extracted-size", env.StringFromEnv("ARGOCD_REPO_SERVER_HELM_MANIFEST_MAX_EXTRACTED_SIZE", "1G"), "Maximum size of helm manifest archives when extracted")
251260
command.Flags().StringVar(&helmRegistryMaxIndexSize, "helm-registry-max-index-size", env.StringFromEnv("ARGOCD_REPO_SERVER_HELM_MANIFEST_MAX_INDEX_SIZE", "1G"), "Maximum size of registry index file")
261+
command.Flags().StringVar(&ociManifestMaxExtractedSize, "oci-manifest-max-extracted-size", env.StringFromEnv("ARGOCD_REPO_SERVER_OCI_MANIFEST_MAX_EXTRACTED_SIZE", "1G"), "Maximum size of oci manifest archives when extracted")
262+
command.Flags().BoolVar(&disableOCIManifestMaxExtractedSize, "disable-oci-manifest-max-extracted-size", env.ParseBoolFromEnv("ARGOCD_REPO_SERVER_DISABLE_OCI_MANIFEST_MAX_EXTRACTED_SIZE", false), "Disable maximum size of oci manifest archives when extracted")
252263
command.Flags().BoolVar(&disableManifestMaxExtractedSize, "disable-helm-manifest-max-extracted-size", env.ParseBoolFromEnv("ARGOCD_REPO_SERVER_DISABLE_HELM_MANIFEST_MAX_EXTRACTED_SIZE", false), "Disable maximum size of helm manifest archives when extracted")
253264
command.Flags().BoolVar(&includeHiddenDirectories, "include-hidden-directories", env.ParseBoolFromEnv("ARGOCD_REPO_SERVER_INCLUDE_HIDDEN_DIRECTORIES", false), "Include hidden directories from Git")
254265
command.Flags().BoolVar(&cmpUseManifestGeneratePaths, "plugin-use-manifest-generate-paths", env.ParseBoolFromEnv("ARGOCD_REPO_SERVER_PLUGIN_USE_MANIFEST_GENERATE_PATHS", false), "Pass the resources described in argocd.argoproj.io/manifest-generate-paths value to the cmpserver to generate the application manifests.")
266+
command.Flags().StringSliceVar(&ociMediaTypes, "oci-layer-media-types", env.StringsFromEnv("ARGOCD_REPO_SERVER_OCI_LAYER_MEDIA_TYPES", []string{"application/vnd.oci.image.layer.v1.tar", "application/vnd.oci.image.layer.v1.tar+gzip", "application/vnd.cncf.helm.chart.content.v1.tar+gzip"}, ","), "Comma separated list of allowed media types for OCI media types. This only accounts for media types within layers.")
255267
tlsConfigCustomizerSrc = tls.AddTLSFlagsToCmd(&command)
256268
cacheSrc = reposervercache.AddCacheFlagsToCmd(&command, cacheutil.Options{
257269
OnClientCreated: func(client *redis.Client) {

cmd/argocd/commands/admin/repo.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ func NewGenRepoSpecCommand() *cobra.Command {
6868
6969
# Add a private Helm OCI-based repository named 'stable' via HTTPS
7070
argocd admin repo generate-spec helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type helm --name stable --enable-oci --username test --password test
71+
72+
# Add a private HTTPS OCI repository named 'stable'
73+
argocd repo generate-spec oci://helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type oci --name stable --username test --password test
74+
75+
# Add a private OCI repository named 'stable' without verifying the server's TLS certificate
76+
argocd repo generate-spec oci://helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type oci --name stable --username test --password test --insecure-skip-server-verification
77+
78+
# Add a private HTTP OCI repository named 'stable'
79+
argocd repo generate-spec oci://helm-oci-registry.cn-zhangjiakou.cr.aliyuncs.com --type oci --name stable --username test --password test --insecure-oci-force-http
7180
`
7281

7382
command := &cobra.Command{
@@ -130,6 +139,7 @@ func NewGenRepoSpecCommand() *cobra.Command {
130139
repoOpts.Repo.EnableLFS = repoOpts.EnableLfs
131140
repoOpts.Repo.EnableOCI = repoOpts.EnableOci
132141
repoOpts.Repo.UseAzureWorkloadIdentity = repoOpts.UseAzureWorkloadIdentity
142+
repoOpts.Repo.InsecureOCIForceHttp = repoOpts.InsecureOCIForceHTTP
133143

134144
if repoOpts.Repo.Type == "helm" && repoOpts.Repo.Name == "" {
135145
errors.CheckError(stderrors.New("must specify --name for repos of type 'helm'"))

cmd/argocd/commands/app_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,6 +2154,10 @@ func (c *fakeAppServiceClient) GetApplicationSyncWindows(_ context.Context, _ *a
21542154
return nil, nil
21552155
}
21562156

2157+
func (c *fakeAppServiceClient) GetOCIMetadata(_ context.Context, _ *applicationpkg.RevisionMetadataQuery, _ ...grpc.CallOption) (*v1alpha1.OCIMetadata, error) {
2158+
return nil, nil
2159+
}
2160+
21572161
func (c *fakeAppServiceClient) RevisionMetadata(_ context.Context, _ *applicationpkg.RevisionMetadataQuery, _ ...grpc.CallOption) (*v1alpha1.RevisionMetadata, error) {
21582162
return nil, nil
21592163
}

0 commit comments

Comments
 (0)