Skip to content

Commit e14643d

Browse files
authored
Merge pull request #9622 from soltysh/deprecate_secrets
Use oc create secret instead of deprecated oc secrets subcommands
2 parents 439beb9 + 512b97f commit e14643d

7 files changed

+18
-18
lines changed

Diff for: cli_reference/cli_by_example_content.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -726,13 +726,13 @@ endif::[]
726726
[options="nowrap"]
727727
----
728728
// Create a new secret named my-secret with a key named ssh-privatekey
729-
$ oc secrets new my-secret ~/.ssh/ssh-privatekey
729+
$ oc create secret generic my-secret --from-file=ssh-privatekey=<path/to/ssh/private/key>
730730
731731
// Create a new secret named my-secret with keys named ssh-privatekey and ssh-publickey instead of the names of the keys on disk
732-
$ oc secrets new my-secret ssh-privatekey=~/.ssh/id_rsa ssh-publickey=~/.ssh/id_rsa.pub
732+
$ oc create secret generic my-secret --from-file=ssh-privatekey=<path/to/ssh/private/key> --from-file=ssh-publickey=<path/to/ssh/public/key>
733733
734734
// Create a new secret named my-secret with keys for each file in the folder "bar"
735-
$ oc secrets new my-secret path/to/bar
735+
$ oc create secret generic my-secret --from-file=<path/to/bar>
736736
----
737737
====
738738

Diff for: day_two_guide/topics/managing_docker_registries.adoc

+7-7
Original file line numberDiff line numberDiff line change
@@ -299,19 +299,19 @@ to the `docker` registry:
299299
+
300300
----
301301
$ oc project <my_project>
302-
$ oc secrets new-dockercfg <my_registry> --docker-server=<my.registry.example.com> --docker-username=<username> --docker-password=<my_password> --docker-email=<[email protected]>
302+
$ oc create secret docker-registry <my_registry> --docker-server=<my.registry.example.com> --docker-username=<username> --docker-password=<my_password> --docker-email=<[email protected]>
303303
----
304304

305305
. If a `.dockercfg` file exists, create the secret using the `oc` command:
306306
+
307307
----
308-
$ oc secrets new <my_registry> .dockercfg=<.dockercfg>
308+
$ oc create secret generic <my_registry> --from-file=.dockercfg=<path/to/.dockercfg> --type=kubernetes.io/dockercfg
309309
----
310310

311311
. Populate the `$HOME/.docker/config.json` file:
312312
+
313313
----
314-
$ oc secrets new <my_registry> .dockerconfigjson=<.docker/config.json>
314+
$ oc create secret generic <my_registry> --from-file=.dockerconfigjson=<path/to/.dockercfg> --type=kubernetes.io/dockerconfigjson
315315
----
316316

317317
. Use the `dockercfg` secret to pull images from the authenticated registry by
@@ -363,8 +363,8 @@ to the service accounts.
363363
+
364364
----
365365
$ oc project <my_project>
366-
$ oc secrets new-dockercfg <my_registry> --docker-server=*<my_registry_example.com> --docker-username=<username> --docker-password=<my_password> --docker-email=<[email protected]>
367-
$ oc secrets new-dockercfg <my_docker_registry_ext_auth> --docker-server=<my.authsystem.example.com> --docker-username=<username> --docker-password=<my_password> --docker-email=<[email protected]>
366+
$ oc create secret docker-registry <my_registry> --docker-server=*<my_registry_example.com> --docker-username=<username> --docker-password=<my_password> --docker-email=<[email protected]>
367+
$ oc create secret docker-registry <my_docker_registry_ext_auth> --docker-server=<my.authsystem.example.com> --docker-username=<username> --docker-password=<my_password> --docker-email=<[email protected]>
368368
$ oc secrets link default <my_registry> --for=pull
369369
$ oc secrets link default <my_docker_registry_ext_auth> --for=pull
370370
$ oc secrets link builder <my_registry>
@@ -438,7 +438,7 @@ openshift_master_admission_plugin_config={"openshift.io/ImagePolicy":{"configura
438438
There is a current issue to be fixed in {product-title} 3.6.1 where
439439
`ImagePolicy` pods can not be deployed using default templates, and give the
440440
following error message `Failed create | Error creating: Pod "" is invalid:
441-
spec.containers[0].\image: Forbidden: this image is prohibited by policy`.
441+
spec.containers[0].\image: Forbidden: this image is prohibited by policy`.
442442
443443
See the
444444
https://access.redhat.com/solutions/3165041[Image Policy is not working as
@@ -629,7 +629,7 @@ $ TOKEN=$(oc sa get-token <my_serviceaccount> -n <registry_project>)
629629
. Use the token as the password to create a `dockercfg` secret:
630630
+
631631
----
632-
$ oc secrets new-dockercfg <my_registry>
632+
$ oc create secret docker-registry <my_registry> \
633633
--docker-server=<myregistry.example.com> --docker-username=<notused> --docker-password=${TOKEN} --docker-email=<[email protected]>
634634
----
635635

Diff for: install_config/registry/deploy_registry_existing_clusters.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ If no certificate is found, a self-signed certificate is created using the
416416
. Create the secret:
417417
+
418418
----
419-
$ oc secrets new console-secret \
419+
$ oc create secret generic console-secret \
420420
/path/to/console.cert
421421
----
422422
+

Diff for: install_config/registry/securing_and_exposing_registry.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ security reasons, it is recommended to not make it greater than this value.
7878
. Create the secret for the registry certificates:
7979
+
8080
----
81-
$ oc secrets new registry-certificates \
81+
$ oc create secret generic registry-certificates \
8282
/etc/secrets/registry.crt \
8383
/etc/secrets/registry.key
8484
----

Diff for: install_config/router/default_haproxy_router.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ the new value. If `ROUTER_MAX_CONNECTIONS` is not present, the default value of
305305
====
306306
A connection includes the frontend and internal backend. This counts as two
307307
connections. Be sure to set `ROUTER_MAX_CONNECTIONS` to double than the number
308-
of connections you intend to create.
308+
of connections you intend to create.
309309
====
310310

311311
[[bind-strict-sni]]
@@ -1038,13 +1038,13 @@ If the certificate secret was added to the router, overwrite the secret. If not,
10381038
To overwrite the secret, run the following command:
10391039
+
10401040
----
1041-
$ oc secrets new router-certs tls.crt=custom-router.crt tls.key=custom-router.key -o json --type='kubernetes.io/tls' --confirm | oc replace -f -
1041+
$ oc create secret generic router-certs --from-file=tls.crt=custom-router.crt --from-file=tls.key=custom-router.key --type=kubernetes.io/tls -o json | oc replace -f -
10421042
----
10431043
+
10441044
To create a new secret, run the following commands:
10451045
+
10461046
----
1047-
$ oc secrets new router-certs tls.crt=custom-router.crt tls.key=custom-router.key --type='kubernetes.io/tls' --confirm
1047+
$ oc create secret generic router-certs --from-file=tls.crt=custom-router.crt --from-file=tls.key=custom-router.key --type=kubernetes.io/tls
10481048
10491049
$ oc volume dc/router --add --mount-path=/etc/pki/tls/private --secret-name='router-certs' --name router-certs
10501050
----

Diff for: install_config/storage_examples/azure_blob_docker_registry_example.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ middleware:
6969
+
7070
[source,bash]
7171
----
72-
$ oc secrets new registry-config config.yaml=registryconfig.yaml
72+
$ oc create secret generic registry-config --from-file=config.yaml=registryconfig.yaml
7373
----
7474

7575
. Add the secret:
@@ -100,7 +100,7 @@ $ oc delete secret registry-config
100100
+
101101
[source,bash]
102102
----
103-
$ oc secrets new registry-config config.yaml=registryconfig.yaml
103+
$ oc create secret generic registry-config --from-file=config.yaml=registryconfig.yaml
104104
----
105105

106106
.. Update the configuration by starting a new rollout:

Diff for: security/build_process.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Using this example scenario, you can add an input secret to a new `BuildConfig`:
8282
. Create the secret, if it does not exist:
8383
+
8484
----
85-
$ oc secrets new secret-npmrc .npmrc=~/.npmrc
85+
$ oc create secret generic secret-npmrc --from-file=.npmrc=~/.npmrc
8686
----
8787
+
8888
This creates a new secret named *_secret-npmrc_*, which contains the base64

0 commit comments

Comments
 (0)