Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
flux2
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
fluxcd
flux2
Commits
fe4b6597
Unverified
Commit
fe4b6597
authored
2 years ago
by
Somtochi Onyekwere
Committed by
Stefan Prodan
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Update cli description
Signed-off-by:
Somtochi Onyekwere
<
somtochionyekwere@gmail.com
>
parent
4c576bf5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/flux/create_secret_oci.go
+8
-4
8 additions, 4 deletions
cmd/flux/create_secret_oci.go
pkg/manifestgen/sourcesecret/sourcesecret.go
+8
-2
8 additions, 2 deletions
pkg/manifestgen/sourcesecret/sourcesecret.go
with
16 additions
and
6 deletions
cmd/flux/create_secret_oci.go
+
8
−
4
View file @
fe4b6597
...
@@ -30,13 +30,17 @@ import (
...
@@ -30,13 +30,17 @@ import (
var
createSecretOCICmd
=
&
cobra
.
Command
{
var
createSecretOCICmd
=
&
cobra
.
Command
{
Use
:
"oci [name]"
,
Use
:
"oci [name]"
,
Short
:
"Create or update a Kubernetes secret for
docker
authentication"
,
Short
:
"Create or update a Kubernetes secret for
OCI Registry
authentication"
,
Long
:
`The create secret oci command generates a Kubernetes secret with `
,
Long
:
`The create secret oci command generates a Kubernetes secret with `
,
Example
:
` # Create a
secret for a OCI repository using basic authentication
Example
:
` # Create a
n 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
/stefanprodan/charts
\
--url=ghcr.io \
--username=username \
--username=username \
--password=password
--password=password \
--export > repo-auth.yaml
sops --encrypt --encrypted-regex '^(data|stringData)$' \
--in-place repo-auth.yaml
`
,
`
,
RunE
:
createSecretOCICmdRun
,
RunE
:
createSecretOCICmdRun
,
}
}
...
...
This diff is collapsed.
Click to expand it.
pkg/manifestgen/sourcesecret/sourcesecret.go
+
8
−
2
View file @
fe4b6597
...
@@ -38,12 +38,18 @@ import (
...
@@ -38,12 +38,18 @@ import (
const
defaultSSHPort
=
22
const
defaultSSHPort
=
22
type
DockerConfigJson
struct
{
// DockerConfigJSON represents a local docker auth config file
// for pulling images.
type
DockerConfigJSON
struct
{
Auths
DockerConfig
`json:"auths"`
Auths
DockerConfig
`json:"auths"`
}
}
// DockerConfig represents the config file used by the docker CLI.
// This config that represents the credentials that should be used
// when pulling images from specific image repositories.
type
DockerConfig
map
[
string
]
DockerConfigEntry
type
DockerConfig
map
[
string
]
DockerConfigEntry
// DockerConfigEntry holds the user information that grant the access to docker registry
type
DockerConfigEntry
struct
{
type
DockerConfigEntry
struct
{
Username
string
`json:"username,omitempty"`
Username
string
`json:"username,omitempty"`
Password
string
`json:"password,omitempty"`
Password
string
`json:"password,omitempty"`
...
@@ -221,7 +227,7 @@ func resourceToString(data []byte) string {
...
@@ -221,7 +227,7 @@ func resourceToString(data []byte) string {
func
generateDockerConfigJson
(
url
,
username
,
password
string
)
([]
byte
,
error
)
{
func
generateDockerConfigJson
(
url
,
username
,
password
string
)
([]
byte
,
error
)
{
cred
:=
fmt
.
Sprintf
(
"%s:%s"
,
username
,
password
)
cred
:=
fmt
.
Sprintf
(
"%s:%s"
,
username
,
password
)
auth
:=
base64
.
StdEncoding
.
EncodeToString
([]
byte
(
cred
))
auth
:=
base64
.
StdEncoding
.
EncodeToString
([]
byte
(
cred
))
cfg
:=
DockerConfigJ
son
{
cfg
:=
DockerConfigJ
SON
{
Auths
:
map
[
string
]
DockerConfigEntry
{
Auths
:
map
[
string
]
DockerConfigEntry
{
url
:
{
url
:
{
Username
:
username
,
Username
:
username
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment