Skip to content

Commit 8cc8798

Browse files
committed
Add the provider field to the OCIRepository API
Signed-off-by: Stefan Prodan <[email protected]>
1 parent acc95d8 commit 8cc8798

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

api/v1beta2/ocirepository_types.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,28 @@ const (
3030

3131
// OCIRepositoryPrefix is the prefix used for OCIRepository URLs.
3232
OCIRepositoryPrefix = "oci://"
33+
34+
// GenericOCIProvider provides support for authentication using static credentials
35+
// for any OCI compatible API such as Docker Registry, GitHub Container Registry,
36+
// Docker Hub, Quay, etc.
37+
GenericOCIProvider string = "generic"
38+
39+
// AmazonOCIProvider provides support for OCI authentication using AWS IRSA.
40+
AmazonOCIProvider string = "aws"
41+
42+
// GoogleOCIProvider provides support for OCI authentication using GCP workload identity.
43+
GoogleOCIProvider string = "gcp"
44+
45+
// AzureOCIProvider provides support for OCI authentication using a Azure Service Principal,
46+
// Managed Identity or Shared Key.
47+
AzureOCIProvider string = "azure"
3348
)
3449

3550
// OCIRepositorySpec defines the desired state of OCIRepository
3651
type OCIRepositorySpec struct {
3752
// URL is a reference to an OCI artifact repository hosted
3853
// on a remote container registry.
39-
// +kubebuilder:validation:Pattern="^oci://"
54+
// +kubebuilder:validation:Pattern="^oci://.*$"
4055
// +required
4156
URL string `json:"url"`
4257

@@ -45,6 +60,13 @@ type OCIRepositorySpec struct {
4560
// +optional
4661
Reference *OCIRepositoryRef `json:"ref,omitempty"`
4762

63+
// The provider used for authentication, can be 'aws', 'azure', 'gcp' or 'generic'.
64+
// When not specified, defaults to 'generic'.
65+
// +kubebuilder:validation:Enum=generic;aws;azure;gcp
66+
// +kubebuilder:default:=generic
67+
// +optional
68+
Provider string `json:"provider,omitempty"`
69+
4870
// SecretRef contains the secret name containing the registry login
4971
// credentials to resolve image metadata.
5072
// The secret must be of type kubernetes.io/dockerconfigjson.

config/crd/bases/source.toolkit.fluxcd.io_ocirepositories.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ spec:
7575
interval:
7676
description: The interval at which to check for image updates.
7777
type: string
78+
provider:
79+
default: generic
80+
description: The provider used for authentication, can be 'aws', 'azure',
81+
'gcp' or 'generic'. When not specified, defaults to 'generic'.
82+
enum:
83+
- generic
84+
- aws
85+
- azure
86+
- gcp
87+
type: string
7888
ref:
7989
description: The OCI reference to pull and monitor for changes, defaults
8090
to the latest tag.
@@ -119,7 +129,7 @@ spec:
119129
url:
120130
description: URL is a reference to an OCI artifact repository hosted
121131
on a remote container registry.
122-
pattern: ^oci://
132+
pattern: ^oci://.*$
123133
type: string
124134
required:
125135
- interval

docs/api/source.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,19 @@ defaults to the latest tag.</p>
968968
</tr>
969969
<tr>
970970
<td>
971+
<code>provider</code><br>
972+
<em>
973+
string
974+
</em>
975+
</td>
976+
<td>
977+
<em>(Optional)</em>
978+
<p>The provider used for authentication, can be &lsquo;aws&rsquo;, &lsquo;azure&rsquo;, &lsquo;gcp&rsquo; or &lsquo;generic&rsquo;.
979+
When not specified, defaults to &lsquo;generic&rsquo;.</p>
980+
</td>
981+
</tr>
982+
<tr>
983+
<td>
971984
<code>secretRef</code><br>
972985
<em>
973986
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/meta#LocalObjectReference">
@@ -2621,6 +2634,19 @@ defaults to the latest tag.</p>
26212634
</tr>
26222635
<tr>
26232636
<td>
2637+
<code>provider</code><br>
2638+
<em>
2639+
string
2640+
</em>
2641+
</td>
2642+
<td>
2643+
<em>(Optional)</em>
2644+
<p>The provider used for authentication, can be &lsquo;aws&rsquo;, &lsquo;azure&rsquo;, &lsquo;gcp&rsquo; or &lsquo;generic&rsquo;.
2645+
When not specified, defaults to &lsquo;generic&rsquo;.</p>
2646+
</td>
2647+
</tr>
2648+
<tr>
2649+
<td>
26242650
<code>secretRef</code><br>
26252651
<em>
26262652
<a href="https://godoc.org/github.com/fluxcd/pkg/apis/meta#LocalObjectReference">

0 commit comments

Comments
 (0)