Skip to content

Commit

Permalink
Add --cert-ref to flux create source oci
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
  • Loading branch information
stefanprodan committed Jul 8, 2022
1 parent 09cbd93 commit 60129ec
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions cmd/flux/create_source_oci.go
Expand Up @@ -56,6 +56,7 @@ type sourceOCIRepositoryFlags struct {
digest string
secretRef string
serviceAccount string
certSecretRef string
ignorePaths []string
}

Expand All @@ -68,6 +69,7 @@ func init() {
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.digest, "digest", "", "the OCI artifact digest")
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.secretRef, "secret-ref", "", "the name of the Kubernetes image pull secret (type 'kubernetes.io/dockerconfigjson')")
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.serviceAccount, "service-account", "", "the name of the Kubernetes service account that refers to an image pull secret")
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.certSecretRef, "cert-ref", "", "the name of a secret to use for TLS certificates")
createSourceOCIRepositoryCmd.Flags().StringSliceVar(&sourceOCIRepositoryArgs.ignorePaths, "ignore-paths", nil, "set paths to ignore resources (can specify multiple paths with commas: path1,path2)")

createSourceCmd.AddCommand(createSourceOCIRepositoryCmd)
Expand Down Expand Up @@ -135,6 +137,12 @@ func createSourceOCIRepositoryCmdRun(cmd *cobra.Command, args []string) error {
}
}

if secretName := sourceOCIRepositoryArgs.certSecretRef; secretName != "" {
repository.Spec.CertSecretRef = &meta.LocalObjectReference{
Name: secretName,
}
}

if createArgs.export {
return printExport(exportOCIRepository(repository))
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/flux/testdata/oci/create_source_oci.golden
Expand Up @@ -2,4 +2,4 @@
✔ OCIRepository created
◎ waiting for OCIRepository reconciliation
✔ OCIRepository reconciliation completed
✔ fetched revision: 3b6cdcc7adcc9a84d3214ee1c029543789d90b5ae69debe9efa3f66e982875de
✔ fetched digest: 3b6cdcc7adcc9a84d3214ee1c029543789d90b5ae69debe9efa3f66e982875de
2 changes: 1 addition & 1 deletion cmd/flux/testdata/oci/get_oci.golden
@@ -1,2 +1,2 @@
NAME REVISION SUSPENDED READY MESSAGE
thrfg 3b6cdcc7adcc9a84d3214ee1c029543789d90b5ae69debe9efa3f66e982875de False True stored artifact for revision '3b6cdcc7adcc9a84d3214ee1c029543789d90b5ae69debe9efa3f66e982875de'
thrfg 3b6cdcc7adcc9a84d3214ee1c029543789d90b5ae69debe9efa3f66e982875de False True stored artifact for digest '3b6cdcc7adcc9a84d3214ee1c029543789d90b5ae69debe9efa3f66e982875de'
2 changes: 1 addition & 1 deletion manifests/bases/source-controller/kustomization.yaml
Expand Up @@ -15,4 +15,4 @@ patchesJson6902:
# TODO: remove the hardcoded image when OCIRepository is released
images:
- name: fluxcd/source-controller
newTag: oci-ba5f5353
newTag: oci-09a9ef44

0 comments on commit 60129ec

Please sign in to comment.