-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Generate an ignition-auth key and provide it to the MCS
#1740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
data/data/manifests/bootkube/openshift-config-secret-ignition-auth.yaml.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| type: Opaque | ||
| metadata: | ||
| namespace: openshift-machine-config-operator | ||
| name: ignition-auth | ||
| data: | ||
| master: {{.IgnitionAuthMasterBase64}} | ||
| worker: {{.IgnitionAuthWorkerBase64}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package installconfig | ||
|
|
||
| import ( | ||
| utilrand "k8s.io/apimachinery/pkg/util/rand" | ||
|
|
||
| "github.com/openshift/installer/pkg/asset" | ||
| ) | ||
|
|
||
| // IgnitionAuth gates access to the Machine Config Server | ||
| type IgnitionAuth struct { | ||
| Master string | ||
| Worker string | ||
| } | ||
|
|
||
| var _ asset.Asset = (*IgnitionAuth)(nil) | ||
|
|
||
| // Dependencies returns nothing. | ||
| func (a *IgnitionAuth) Dependencies() []asset.Asset { | ||
| return []asset.Asset{} | ||
| } | ||
|
|
||
| // Generate generates a new IgnitionAuth | ||
| func (a *IgnitionAuth) Generate(dep asset.Parents) error { | ||
| a.Master = utilrand.String(64) | ||
| a.Worker = utilrand.String(64) | ||
| return nil | ||
| } | ||
|
|
||
| // Name returns the human-friendly name of the asset. | ||
| func (a *IgnitionAuth) Name() string { | ||
| return "Ignition Auth" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package bootkube | ||
|
|
||
| import ( | ||
| "os" | ||
| "path/filepath" | ||
|
|
||
| "github.com/openshift/installer/pkg/asset" | ||
| "github.com/openshift/installer/pkg/asset/templates/content" | ||
| ) | ||
|
|
||
| const ( | ||
| openshiftConfigSecretIgnitionAuthFileName = "openshift-config-secret-ignition-auth.yaml.template" | ||
| ) | ||
|
|
||
| var _ asset.WritableAsset = (*OpenshiftConfigSecretIgnitionAuth)(nil) | ||
|
|
||
| // OpenshiftConfigSecretIgnitionAuth is the constant to represent contents of openshift-config-secret-ignition-auth.yaml.template file. | ||
| type OpenshiftConfigSecretIgnitionAuth struct { | ||
| FileList []*asset.File | ||
| } | ||
|
|
||
| // Dependencies returns all of the dependencies directly needed by the asset | ||
| func (t *OpenshiftConfigSecretIgnitionAuth) Dependencies() []asset.Asset { | ||
| return []asset.Asset{} | ||
| } | ||
|
|
||
| // Name returns the human-friendly name of the asset. | ||
| func (t *OpenshiftConfigSecretIgnitionAuth) Name() string { | ||
| return "OpenshiftConfigSecretIgnitionAuth" | ||
| } | ||
|
|
||
| // Generate generates the actual files by this asset | ||
| func (t *OpenshiftConfigSecretIgnitionAuth) Generate(parents asset.Parents) error { | ||
| fileName := openshiftConfigSecretIgnitionAuthFileName | ||
| data, err := content.GetBootkubeTemplate(fileName) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| t.FileList = []*asset.File{ | ||
| { | ||
| Filename: filepath.Join(content.TemplateDir, fileName), | ||
| Data: []byte(data), | ||
| }, | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| // Files returns the files generated by the asset. | ||
| func (t *OpenshiftConfigSecretIgnitionAuth) Files() []*asset.File { | ||
| return t.FileList | ||
| } | ||
|
|
||
| // Load returns the asset from disk. | ||
| func (t *OpenshiftConfigSecretIgnitionAuth) Load(f asset.FileFetcher) (bool, error) { | ||
| file, err := f.FetchByName(filepath.Join(content.TemplateDir, openshiftConfigSecretIgnitionAuthFileName)) | ||
| if err != nil { | ||
| if os.IsNotExist(err) { | ||
| return false, nil | ||
| } | ||
| return false, err | ||
| } | ||
| t.FileList = []*asset.File{file} | ||
| return true, nil | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double check, is there any need to
utilrand.Seedbefore or between generations?