Skip to content

Commit 8a84eb2

Browse files
committed
*: Replace PullSecretPath with PullSecret
Instead of passing the pull secret around as a path, pass it around as a JSON string. This makes it easier to embed in Kubernetes, since we're punting the file-reading to callers at config-YAML-creation time. Store it as a string (like the SSH pubkey) instead of parsing it out into a more detailed structure, because we expect to consume it as an opaque string (just pass it to the registry without peaking inside). I've left some deprecated handling for folks who are still using pullSecretPath in their YAML. I'll file a follow-up pull request to drop it once we get the CI template in openshift/release updated to use pullSecret.
1 parent 2fd2561 commit 8a84eb2

File tree

19 files changed

+44
-56
lines changed

19 files changed

+44
-56
lines changed

Documentation/dev/libvirt-howto.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ EOF
6464
1. Set the `imagePath` to the **absolute** path of the operating system image you downloaded
6565
1. Set the `name` (e.g. test1)
6666
1. Look at the `podCIDR` and `serviceCIDR` fields in the `networking` section. Make sure they don't conflict with anything important.
67-
1. Set the `pullSecretPath` to the **absolute** path of your downloaded pull secret file.
67+
1. Set the `pullSecret` to your JSON pull secret.
6868

6969
#### 1.7 Set up NetworkManager DNS overlay
7070
This step is optional, but useful for being able to resolve cluster-internal hostnames from your host.

config.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ Note: This field MUST be set manually prior to creating the cluster.
174174
EOF
175175
}
176176

177-
variable "tectonic_pull_secret_path" {
177+
variable "tectonic_pull_secret" {
178178
type = "string"
179179
default = ""
180180

181181
description = <<EOF
182-
The path the pull secret file in JSON format.
182+
The pull secret in JSON format.
183183
This is known to be a "Docker pull secret" as produced by the docker login [1] command.
184184
A sample JSON content is shown in [2].
185185
You can download the pull secret from your Account overview page at [3].

examples/tectonic.aws.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ nodePools:
230230
# The platform used for deploying.
231231
platform: aws
232232

233-
# The path the pull secret file in JSON format.
233+
# The pull secret in JSON format.
234234
# This is known to be a "Docker pull secret" as produced by the docker login [1] command.
235235
# A sample JSON content is shown in [2].
236236
# You can download the pull secret from your Account overview page at [3].
@@ -240,7 +240,7 @@ platform: aws
240240
# [2] https://coreos.com/os/docs/latest/registry-authentication.html#manual-registry-auth-setup
241241
#
242242
# [3] https://account.coreos.com/overview
243-
pullSecretPath:
243+
pullSecret: '{"auths": {}}'
244244

245245
worker:
246246
# The name of the node pool(s) to use for workers

examples/tectonic.libvirt.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ nodePools:
9898
# The platform used for deploying.
9999
platform: libvirt
100100

101-
# The path the pull secret file in JSON format.
101+
# The pull secret in JSON format.
102102
# This is known to be a "Docker pull secret" as produced by the docker login [1] command.
103103
# A sample JSON content is shown in [2].
104104
# You can download the pull secret from your Account overview page at [3].
@@ -108,7 +108,7 @@ platform: libvirt
108108
# [2] https://coreos.com/os/docs/latest/registry-authentication.html#manual-registry-auth-setup
109109
#
110110
# [3] https://account.coreos.com/overview
111-
pullSecretPath:
111+
pullSecret: '{"auths": {}}'
112112

113113
worker:
114114
nodePools:

installer/pkg/config-generator/fixtures/test-aws.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ master:
1212
worker:
1313
nodePools:
1414
- worker
15-
pullSecretPath: /path/config.json
15+
pullSecret: '{"auths": {}}'
1616
containerLinux:
1717
channel: stable
1818
version: latest

installer/pkg/config/cluster.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ type Cluster struct {
8888
Networking `json:",inline" yaml:"networking,omitempty"`
8989
NodePools `json:"-" yaml:"nodePools"`
9090
Platform Platform `json:"tectonic_platform" yaml:"platform,omitempty"`
91-
PullSecretPath string `json:"tectonic_pull_secret_path,omitempty" yaml:"pullSecretPath,omitempty"`
91+
PullSecret string `json:"tectonic_pull_secret,omitempty" yaml:"pullSecret,omitempty"`
92+
PullSecretPath string `json:"-" yaml:"pullSecretPath,omitempty"` // Deprecated: remove after openshift/release is ported to pullSecret
9293
Worker `json:",inline" yaml:"worker,omitempty"`
9394
}
9495

installer/pkg/config/parser.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package config
22

33
import (
4+
"errors"
45
"io/ioutil"
56

67
"gopkg.in/yaml.v2"
@@ -14,6 +15,19 @@ func ParseConfig(data []byte) (*Cluster, error) {
1415
return nil, err
1516
}
1617

18+
// Deprecated: remove after openshift/release is ported to pullSecret
19+
if cluster.PullSecretPath != "" {
20+
if cluster.PullSecret != "" {
21+
return nil, errors.New("pullSecretPath is deprecated; just set pullSecret")
22+
}
23+
24+
data, err := ioutil.ReadFile(cluster.PullSecretPath)
25+
if err != nil {
26+
return nil, err
27+
}
28+
cluster.PullSecret = string(data)
29+
}
30+
1731
return &cluster, nil
1832
}
1933

installer/pkg/config/validate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (c *Cluster) Validate() []error {
8383
errs = append(errs, c.validateNetworking()...)
8484
errs = append(errs, c.validateAWS()...)
8585
errs = append(errs, c.validateCL()...)
86-
errs = append(errs, c.validateTectonicFiles()...)
86+
errs = append(errs, c.validatePullSecret()...)
8787
errs = append(errs, c.validateLibvirt()...)
8888
errs = append(errs, c.validateCA()...)
8989
if err := validate.PrefixError("cluster name", validate.ClusterName(c.Name)); err != nil {
@@ -280,9 +280,9 @@ func (c *Cluster) validateTNCS3Bucket() error {
280280
return nil
281281
}
282282

283-
func (c *Cluster) validateTectonicFiles() []error {
283+
func (c *Cluster) validatePullSecret() []error {
284284
var errs []error
285-
if err := validate.JSONFile(c.PullSecretPath); err != nil {
285+
if err := validate.JSON([]byte(c.PullSecret)); err != nil {
286286
errs = append(errs, err)
287287
}
288288
return errs

installer/pkg/workflow/fixtures/aws.basic.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ nodePools:
3232
- name: worker
3333
count: 3
3434
platform: aws
35-
pullSecretPath:
35+
pullSecret: '{"auths": {}}'
3636
worker:
3737
nodePools:
3838
- worker

installer/pkg/workflow/fixtures/terraform.tfvars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@
2929
"tectonic_service_cidr": "10.3.0.0/16",
3030
"tectonic_cluster_cidr": "10.2.0.0/16",
3131
"tectonic_platform": "aws",
32+
"tectonic_pull_secret": "{\"auths\": {}}",
3233
"tectonic_worker_count": 3
3334
}

0 commit comments

Comments
 (0)