OCI docs improvements
Co-authored-by: Kingdon Barrett <kingdon@weave.works> Co-authored-by: Sunny <darkowlzz@protonmail.com> Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
@@ -97,9 +97,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Setup Flux CLI
|
- name: Setup Flux CLI
|
||||||
uses: fluxcd/flux2/action@main
|
uses: fluxcd/flux2/action@main
|
||||||
|
- name: Login to GHCR
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Generate manifests
|
- name: Generate manifests
|
||||||
run: |
|
run: |
|
||||||
kustomize build ./manifests/staging > ./deploy/app.yaml
|
kustomize build ./manifests/staging > ./deploy/app.yaml
|
||||||
@@ -132,7 +138,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Setup Flux CLI
|
- name: Setup Flux CLI
|
||||||
uses: fluxcd/flux2/action@main
|
uses: fluxcd/flux2/action@main
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ import (
|
|||||||
var buildArtifactCmd = &cobra.Command{
|
var buildArtifactCmd = &cobra.Command{
|
||||||
Use: "artifact",
|
Use: "artifact",
|
||||||
Short: "Build artifact",
|
Short: "Build artifact",
|
||||||
Long: `The build artifact command creates an tgz file with the manifests from the given directory.`,
|
Long: `The build artifact command creates a tgz file with the manifests from the given directory.`,
|
||||||
Example: ` # Build the given manifests directory into an artifact
|
Example: ` # Build the given manifests directory into an artifact
|
||||||
flux build artifact --path ./path/to/local/manifests --output ./path/to/artifact.tgz
|
flux build artifact --path ./path/to/local/manifests --output ./path/to/artifact.tgz
|
||||||
|
|
||||||
# List the files bundles in the artifact
|
# List the files bundled in the artifact
|
||||||
tar -ztvf ./path/to/artifact.tgz
|
tar -ztvf ./path/to/artifact.tgz
|
||||||
`,
|
`,
|
||||||
RunE: buildArtifactCmdRun,
|
RunE: buildArtifactCmdRun,
|
||||||
@@ -47,7 +47,7 @@ var buildArtifactArgs buildArtifactFlags
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
buildArtifactCmd.Flags().StringVar(&buildArtifactArgs.path, "path", "", "Path to the directory where the Kubernetes manifests are located.")
|
buildArtifactCmd.Flags().StringVar(&buildArtifactArgs.path, "path", "", "Path to the directory where the Kubernetes manifests are located.")
|
||||||
buildArtifactCmd.Flags().StringVarP(&buildArtifactArgs.output, "output", "0", "artifact.tgz", "Path to where the artifact tgz file should be written.")
|
buildArtifactCmd.Flags().StringVarP(&buildArtifactArgs.output, "output", "o", "artifact.tgz", "Path to where the artifact tgz file should be written.")
|
||||||
buildCmd.AddCommand(buildArtifactCmd)
|
buildCmd.AddCommand(buildArtifactCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ func buildArtifactCmdRun(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if fs, err := os.Stat(buildArtifactArgs.path); err != nil || !fs.IsDir() {
|
if fs, err := os.Stat(buildArtifactArgs.path); err != nil || !fs.IsDir() {
|
||||||
return fmt.Errorf("invalid path %q", buildArtifactArgs.path)
|
return fmt.Errorf("invalid path '%s', must point to an existing directory", buildArtifactArgs.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Actionf("building artifact from %s", buildArtifactArgs.path)
|
logger.Actionf("building artifact from %s", buildArtifactArgs.path)
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ import (
|
|||||||
|
|
||||||
var createSecretOCICmd = &cobra.Command{
|
var createSecretOCICmd = &cobra.Command{
|
||||||
Use: "oci [name]",
|
Use: "oci [name]",
|
||||||
Short: "Create or update a Kubernetes secret for OCI Registry authentication",
|
Short: "Create or update a Kubernetes image pull secret",
|
||||||
Long: `The create secret oci command generates a Kubernetes secret with `,
|
Long: `The create secret oci command generates a Kubernetes secret that can be used for OCIRepository authentication`,
|
||||||
Example: ` # Create an OCI authentication secret on disk and encrypt it with Mozilla SOPS
|
Example: ` # Create an OCI authentication secret on disk and encrypt it with Mozilla SOPS
|
||||||
flux create secret oci podinfo-auth \
|
flux create secret oci podinfo-auth \
|
||||||
--url=ghcr.io \
|
--url=ghcr.io \
|
||||||
@@ -39,7 +39,7 @@ var createSecretOCICmd = &cobra.Command{
|
|||||||
--password=password \
|
--password=password \
|
||||||
--export > repo-auth.yaml
|
--export > repo-auth.yaml
|
||||||
|
|
||||||
sops --encrypt --encrypted-regex '^(data|stringData)$' \
|
sops --encrypt --encrypted-regex '^(data|stringData)$' \
|
||||||
--in-place repo-auth.yaml
|
--in-place repo-auth.yaml
|
||||||
`,
|
`,
|
||||||
RunE: createSecretOCICmdRun,
|
RunE: createSecretOCICmdRun,
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ func newSourceOCIFlags() sourceOCIRepositoryFlags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
createSourceOCIRepositoryCmd.Flags().Var(&sourceOCIRepositoryArgs.provider, "provider", sourceBucketArgs.provider.Description())
|
createSourceOCIRepositoryCmd.Flags().Var(&sourceOCIRepositoryArgs.provider, "provider", sourceOCIRepositoryArgs.provider.Description())
|
||||||
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.url, "url", "", "the OCI repository URL")
|
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.url, "url", "", "the OCI repository URL")
|
||||||
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.tag, "tag", "", "the OCI artifact tag")
|
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.tag, "tag", "", "the OCI artifact tag")
|
||||||
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.semver, "tag-semver", "", "the OCI artifact tag semver range")
|
createSourceOCIRepositoryCmd.Flags().StringVar(&sourceOCIRepositoryArgs.semver, "tag-semver", "", "the OCI artifact tag semver range")
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
var deleteSourceOCIRepositoryCmd = &cobra.Command{
|
var deleteSourceOCIRepositoryCmd = &cobra.Command{
|
||||||
Use: "oci [name]",
|
Use: "oci [name]",
|
||||||
Short: "Delete a OCIRepository source",
|
Short: "Delete an OCIRepository source",
|
||||||
Long: "The delete source oci command deletes the given OCIRepository from the cluster.",
|
Long: "The delete source oci command deletes the given OCIRepository from the cluster.",
|
||||||
Example: ` # Delete an OCIRepository
|
Example: ` # Delete an OCIRepository
|
||||||
flux delete source oci podinfo`,
|
flux delete source oci podinfo`,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ var getSourceOCIRepositoryCmd = &cobra.Command{
|
|||||||
Example: ` # List all OCIRepositories and their status
|
Example: ` # List all OCIRepositories and their status
|
||||||
flux get sources oci
|
flux get sources oci
|
||||||
|
|
||||||
# List OCIRepositories from all namespaces
|
# List OCIRepositories from all namespaces
|
||||||
flux get sources oci --all-namespaces`,
|
flux get sources oci --all-namespaces`,
|
||||||
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.OCIRepositoryKind)),
|
ValidArgsFunction: resourceNamesCompletionFunc(sourcev1.GroupVersion.WithKind(sourcev1.OCIRepositoryKind)),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2021 The Flux authors
|
Copyright 2022 The Flux authors
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ var pullArtifactCmd = &cobra.Command{
|
|||||||
Short: "Pull artifact",
|
Short: "Pull artifact",
|
||||||
Long: `The pull artifact command downloads and extracts the OCI artifact content to the given path.
|
Long: `The pull artifact command downloads and extracts the OCI artifact content to the given path.
|
||||||
The pull command uses the credentials from '~/.docker/config.json'.`,
|
The pull command uses the credentials from '~/.docker/config.json'.`,
|
||||||
Example: `# Pull an OCI artifact created by flux from GHCR
|
Example: ` # Pull an OCI artifact created by flux from GHCR
|
||||||
flux pull artifact oci://ghcr.io/org/manifests/app:v0.0.1 --output ./path/to/local/manifests
|
flux pull artifact oci://ghcr.io/org/manifests/app:v0.0.1 --output ./path/to/local/manifests
|
||||||
`,
|
`,
|
||||||
RunE: pullArtifactCmdRun,
|
RunE: pullArtifactCmdRun,
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ type pullArtifactFlags struct {
|
|||||||
var pullArtifactArgs pullArtifactFlags
|
var pullArtifactArgs pullArtifactFlags
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
pullArtifactCmd.Flags().StringVarP(&pullArtifactArgs.output, "output", "o", "", "Path where the artifact content should be extracted.")
|
pullArtifactCmd.Flags().StringVarP(&pullArtifactArgs.output, "output", "o", "", "path where the artifact content should be extracted.")
|
||||||
pullCmd.AddCommand(pullArtifactCmd)
|
pullCmd.AddCommand(pullArtifactCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2021 The Flux authors
|
Copyright 2022 The Flux authors
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ type pushArtifactFlags struct {
|
|||||||
var pushArtifactArgs pushArtifactFlags
|
var pushArtifactArgs pushArtifactFlags
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.path, "path", "", "Path to the directory where the Kubernetes manifests are located.")
|
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.path, "path", "", "path to the directory where the Kubernetes manifests are located")
|
||||||
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.source, "source", "", "The source address, e.g. the Git URL.")
|
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.source, "source", "", "the source address, e.g. the Git URL")
|
||||||
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.revision, "revision", "", "The source revision in the format '<branch|tag>/<commit-sha>'")
|
pushArtifactCmd.Flags().StringVar(&pushArtifactArgs.revision, "revision", "", "the source revision in the format '<branch|tag>/<commit-sha>'")
|
||||||
pushCmd.AddCommand(pushArtifactCmd)
|
pushCmd.AddCommand(pushArtifactCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2020 The Flux authors
|
Copyright 2022 The Flux authors
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2020 The Flux authors
|
Copyright 2022 The Flux authors
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
var suspendSourceOCIRepositoryCmd = &cobra.Command{
|
var suspendSourceOCIRepositoryCmd = &cobra.Command{
|
||||||
Use: "oci [name]",
|
Use: "oci [name]",
|
||||||
Short: "Suspend reconciliation of a OCIRepository",
|
Short: "Suspend reconciliation of an OCIRepository",
|
||||||
Long: "The suspend command disables the reconciliation of an OCIRepository resource.",
|
Long: "The suspend command disables the reconciliation of an OCIRepository resource.",
|
||||||
Example: ` # Suspend reconciliation for an existing OCIRepository
|
Example: ` # Suspend reconciliation for an existing OCIRepository
|
||||||
flux suspend source oci podinfo`,
|
flux suspend source oci podinfo`,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2021 The Flux authors
|
Copyright 2022 The Flux authors
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ type tagArtifactFlags struct {
|
|||||||
var tagArtifactArgs tagArtifactFlags
|
var tagArtifactArgs tagArtifactFlags
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
tagArtifactCmd.Flags().StringSliceVar(&tagArtifactArgs.tags, "tag", nil, "Tag name.")
|
tagArtifactCmd.Flags().StringSliceVar(&tagArtifactArgs.tags, "tag", nil, "tag name")
|
||||||
tagCmd.AddCommand(tagArtifactCmd)
|
tagCmd.AddCommand(tagArtifactCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user