Skip to content

Commit bd250f1

Browse files
authored
Merge pull request #7324 from ahardin-rh/online-3.9-stage
[online-3.9] Use oc create secret instead of deprecated oc secrets su…
2 parents 4ce3c33 + cd2380f commit bd250f1

File tree

3 files changed

+64
-45
lines changed

3 files changed

+64
-45
lines changed

dev_guide/builds/build_inputs.adoc

+41-30
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ it to the builder service account, and then your `BuildConfig`.
434434
To create a secret from a *_.gitconfig_* file:
435435

436436
----
437-
$ oc secrets new mysecret .gitconfig=path/to/.gitconfig
437+
$ oc create secret generic <secret_name> --from-file=<path/to/.gitconfig>
438438
----
439439

440440
[NOTE]
@@ -458,16 +458,19 @@ Create the `secret` first before using the user name and password to access the
458458
private repository:
459459

460460
----
461-
$ oc secrets new-basicauth <secret_name> \
462-
--username=<user_name> \
463-
--password=<password>
461+
$ oc create secret generic <secret_name> \
462+
--from-literal=username=<user_name> \
463+
--from-literal=password=<password> \
464+
--type=kubernetes.io/basic-auth
464465
----
465466

466467
To create a basic authentication secret with a token:
467468

468469
----
469-
$ oc secrets new-basicauth <secret_name> \
470-
--password=<token>
470+
$ oc create secret generic <secret_name> \
471+
--from-literal=password=<token> \
472+
--type=kubernetes.io/basic-auth
473+
471474
----
472475

473476
[[source-secrets-ssh-key-authentication]]
@@ -498,8 +501,9 @@ Before using the SSH key to access the private repository, create the secret
498501
first:
499502

500503
----
501-
$ oc secrets new-sshauth sshsecret \
502-
--ssh-privatekey=$HOME/.ssh/id_rsa
504+
$ oc create secret generic <secret_name> \
505+
--from-file=ssh-privatekey=<path/to/ssh/private/key> \
506+
--type=kubernetes.io/ssh-auth
503507
----
504508

505509
[[source-secrets-trusted-certificate-authorities]]
@@ -519,7 +523,7 @@ significantly more secure than disabling Git's SSL verification, which accepts
519523
any TLS certificate that is presented.
520524
+
521525
----
522-
$ oc secrets new mycert ca.crt=</path/to/file> <1>
526+
$ oc create secret generic mycert --from-file=ca.crt=</path/to/file> <1>
523527
----
524528
<1> The key name *_ca.crt_* must be used.
525529

@@ -540,45 +544,49 @@ creating source clone secrets for your specific needs.
540544
.. To create an SSH-based authentication secret with a *_.gitconfig_* file:
541545
+
542546
----
543-
$ oc secrets new-sshauth sshsecret \
544-
--ssh-privatekey=$HOME/.ssh/id_rsa \
545-
--gitconfig=</path/to/file>
547+
$ oc create secret generic <secret_name> \
548+
--from-file=ssh-privatekey=<path/to/ssh/private/key> \
549+
--from-file=<path/to/.gitconfig> \
550+
--type=kubernetes.io/ssh-auth
546551
----
547552

548553
.. To create a secret that combines a *_.gitconfig_* file and CA certificate:
549554
+
550555
----
551-
$ oc secrets new mysecret \
552-
ca.crt=path/to/certificate \
553-
.gitconfig=path/to/.gitconfig
556+
$ oc create secret generic <secret_name> \
557+
--from-file=ca.crt=<path/to/certificate> \
558+
--from-file=<path/to/.gitconfig>
554559
----
555560

556561
.. To create a basic authentication secret with a CA certificate file:
557562
+
558563
----
559-
$ oc secrets new-basicauth <secret_name> \
560-
--username=<user_name> \
561-
--password=<password> \
562-
--ca-cert=</path/to/file>
564+
$ oc create secret generic <secret_name> \
565+
--from-literal=username=<user_name> \
566+
--from-literal=password=<password> \
567+
--from-file=ca-cert=</path/to/file> \
568+
--type=kubernetes.io/basic-auth
563569
----
564570

565571
.. To create a basic authentication secret with a *_.gitconfig_* file:
566572
+
567573
----
568-
$ oc secrets new-basicauth <secret_name> \
569-
--username=<user_name> \
570-
--password=<password> \
571-
--gitconfig=</path/to/file>
574+
$ oc create secret generic <secret_name> \
575+
--from-literal=username=<user_name> \
576+
--from-literal=password=<password> \
577+
--from-file=</path/to/.gitconfig> \
578+
--type=kubernetes.io/basic-auth
572579
----
573580

574581
.. To create a basic authentication secret with a *_.gitconfig_* file and CA certificate file:
575582
+
576583
----
577-
$ oc secrets new-basicauth <secret_name> \
578-
--username=<user_name> \
579-
--password=<password> \
580-
--gitconfig=</path/to/file> \
581-
--ca-cert=</path/to/file>
584+
$ oc create secret generic <secret_name> \
585+
--from-literal=username=<user_name> \
586+
--from-literal=password=<password> \
587+
--from-file=</path/to/.gitconfig> \
588+
--from-file=ca-cert=</path/to/file> \
589+
--type=kubernetes.io/basic-auth
582590
----
583591

584592

@@ -681,7 +689,8 @@ To add an input secret to an existing `BuildConfig`:
681689
. Create the secret, if it does not exist:
682690
+
683691
----
684-
$ oc secrets new secret-npmrc .npmrc=~/.npmrc
692+
$ oc create secret generic secret-npmrc \
693+
--from-file=.npmrc=<path/to/.npmrc>
685694
----
686695
+
687696
This creates a new secret named *_secret-npmrc_*, which contains the base64
@@ -929,7 +938,9 @@ be used to store configuration and passwords.
929938
. Create the secret from your local *_.docker/config.json_* file:
930939
+
931940
----
932-
$ oc secrets new dockerhub ~/.docker/config.json
941+
$ oc create secret generic dockerhub \
942+
--from-file=.dockerconfigjson=<path/to/.docker/config.json> \
943+
--type=kubernetes.io/dockerconfigjson
933944
----
934945
+
935946
This generates a JSON specification of the secret named `dockerhub` and

dev_guide/managing_images.adoc

+19-13
Original file line numberDiff line numberDiff line change
@@ -585,22 +585,28 @@ If you already have a *_.dockercfg_* file for
585585
the secured registry, you can create a secret from that file by running:
586586

587587
----
588-
$ oc secrets new <pull_secret_name> .dockercfg=<path/to/.dockercfg>
588+
$ oc create secret generic <pull_secret_name> \
589+
--from-file=.dockercfg=<path/to/.dockercfg> \
590+
--type=kubernetes.io/dockercfg
589591
----
590592

591593
Or if you have a *_$HOME/.docker/config.json_* file:
592594

593595
----
594-
$ oc secrets new <pull_secret_name> .dockerconfigjson=<path/to/.docker/config.json>
596+
$ oc create secret generic <pull_secret_name> \
597+
--from-file=.dockerconfigjson=<path/to/.docker/config.json> \
598+
--type=kubernetes.io/dockerconfigjson
595599
----
596600

597601
If you do not already have a Docker credentials file for the secured registry,
598602
you can create a secret by running:
599603

600604
----
601-
$ oc secrets new-dockercfg <pull_secret_name> \
602-
--docker-server=<registry_server> --docker-username=<user_name> \
603-
--docker-password=<password> --docker-email=<email>
605+
$ oc create secret docker-registry <pull_secret_name> \
606+
--docker-server=<registry_server> \
607+
--docker-username=<user_name> \
608+
--docker-password=<password> \
609+
--docker-email=<email>
604610
----
605611

606612
To use a secret for pulling images for pods, you must add the secret to your
@@ -638,7 +644,7 @@ applies.
638644
. Create a secret for the delegated authentication server:
639645
+
640646
----
641-
$ oc secret new-dockercfg \
647+
$ oc create secret docker-registry \
642648
--docker-server=sso.redhat.com \
643649
644650
--docker-password=******** \
@@ -651,7 +657,7 @@ secret/redhat-connect-sso
651657
. Create a secret for the private registry:
652658
+
653659
----
654-
$ oc secret new-dockercfg \
660+
$ oc create secret docker-registry \
655661
--docker-server=privateregistry.example.com \
656662
657663
--docker-password=******** \
@@ -675,7 +681,7 @@ $ docker login registry.connect.redhat.com --username [email protected]
675681
Password: *************
676682
Login Succeeded
677683
678-
$ oc secret new redhat-connect .dockerconfigjson=/root/.docker/config.json
684+
$ oc create secret generic redhat-connect --from-file=.dockerconfigjson=.docker/config.json
679685
680686
$ oc secrets link default redhat-connect --for=pull
681687
----
@@ -948,7 +954,7 @@ which is used to store your credentials.
948954
Create the secret first, before importing the image from the private repository:
949955

950956
----
951-
$ oc secrets new-dockercfg <secret_name> \
957+
$ oc create secret docker-registry <secret_name> \
952958
--docker-server=<docker_registry_server> \
953959
--docker-username=<docker_user> \
954960
--docker-password=<docker_password> \
@@ -958,7 +964,7 @@ $ oc secrets new-dockercfg <secret_name> \
958964
For more options, see:
959965

960966
----
961-
$ oc secrets new --help
967+
$ oc create secret docker-registry --help
962968
----
963969

964970
After the secret is configured, proceed with creating the new image stream or
@@ -1032,15 +1038,15 @@ Before performing this procedure, the following must be satisfied:
10321038

10331039
- The destination project you push to must already exist.
10341040
- The user must be authorized to `{get, update} "imagestream/layers"` in that
1035-
project. In addition, since the image stream does not already exist, the user
1036-
must be authorized to `{create} "imagestream"` in that project. If you are a project
1041+
project. In addition, since the image stream does not already exist, the user
1042+
must be authorized to `{create} "imagestream"` in that project. If you are a project
10371043
administrator, then you would have these permissions.
10381044

10391045
[NOTE]
10401046
====
10411047
The *system:image-pusher* role does not grant permission to create new image streams,
10421048
only to push images to existing image streams, so it cannot be used to push images
1043-
to image streams that do not yet exist unless additional permissions are also granted to
1049+
to image streams that do not yet exist unless additional permissions are also granted to
10441050
the user.
10451051
====
10461052

dev_guide/service_accounts.adoc

+4-2
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,12 @@ This example creates and adds secrets to a service account:
101101

102102
====
103103
----
104-
$ oc secrets new secret-plans plan1.txt plan2.txt
104+
$ oc create secret generic secret-plans \
105+
--from-file=plan1.txt \
106+
--from-file=plan2.txt
105107
secret/secret-plans
106108
107-
$ oc secrets new-dockercfg my-pull-secret \
109+
$ oc create secret docker-registry my-pull-secret \
108110
--docker-username=mastermind \
109111
--docker-password=12345 \
110112

0 commit comments

Comments
 (0)