-
Notifications
You must be signed in to change notification settings - Fork 1.5k
BUG 1684206: *: store etcd CA and client certs in cluster #1363
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
Merged
Merged
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
8 changes: 8 additions & 0 deletions
8
data/data/manifests/bootkube/kube-system-configmap-etcd-ca-bundle.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,8 @@ | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: etcd-ca-bundle | ||
| namespace: kube-system | ||
| data: | ||
| ca-bundle.crt: | | ||
| {{.EtcdCaBundle | indent 4}} |
9 changes: 9 additions & 0 deletions
9
data/data/manifests/bootkube/kube-system-secret-etcd-client-ca-deprecated.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 | ||
| metadata: | ||
| name: etcd-client-ca-deprecated | ||
| namespace: kube-system | ||
| type: SecretTypeTLS | ||
| data: | ||
| tls.crt: {{ .EtcdClientCaCert }} | ||
| tls.key: {{ .EtcdClientCaKey }} | ||
9 changes: 9 additions & 0 deletions
9
data/data/manifests/bootkube/kube-system-secret-etcd-signer-client.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 | ||
| metadata: | ||
| name: etcd-signer-client | ||
| namespace: kube-system | ||
| type: SecretTypeTLS | ||
| data: | ||
| tls.crt: {{ .EtcdSignerClientCert }} | ||
| tls.key: {{ .EtcdSignerClientKey }} |
9 changes: 9 additions & 0 deletions
9
data/data/manifests/bootkube/kube-system-secret-etcd-signer.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 | ||
| metadata: | ||
| name: etcd-signer | ||
| namespace: kube-system | ||
| type: SecretTypeTLS | ||
| data: | ||
| tls.crt: {{ .EtcdSignerCert }} | ||
| tls.key: {{ .EtcdSignerKey }} |
File renamed without changes.
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
64 changes: 64 additions & 0 deletions
64
pkg/asset/templates/content/bootkube/kube-system-configmap-etcd-ca-bundle.go
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 ( | ||
| kubeSystemConfigmapEtcdCAFileName = "kube-system-configmap-etcd-ca-bundle.yaml.template" | ||
| ) | ||
|
|
||
| var _ asset.WritableAsset = (*KubeSystemConfigmapEtcdCA)(nil) | ||
|
|
||
| // KubeSystemConfigmapEtcdCA is the constant to represent contents of kube-system-configmap-etcd-ca-bundle.yaml.template file. | ||
| type KubeSystemConfigmapEtcdCA struct { | ||
| FileList []*asset.File | ||
| } | ||
|
|
||
| // Dependencies returns all of the dependencies directly needed by the asset | ||
| func (t *KubeSystemConfigmapEtcdCA) Dependencies() []asset.Asset { | ||
| return []asset.Asset{} | ||
| } | ||
|
|
||
| // Name returns the human-friendly name of the asset. | ||
| func (t *KubeSystemConfigmapEtcdCA) Name() string { | ||
| return "KubeSystemConfigmapEtcdCA" | ||
| } | ||
|
|
||
| // Generate generates the actual files by this asset | ||
| func (t *KubeSystemConfigmapEtcdCA) Generate(parents asset.Parents) error { | ||
| fileName := kubeSystemConfigmapEtcdCAFileName | ||
| 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 *KubeSystemConfigmapEtcdCA) Files() []*asset.File { | ||
| return t.FileList | ||
| } | ||
|
|
||
| // Load returns the asset from disk. | ||
| func (t *KubeSystemConfigmapEtcdCA) Load(f asset.FileFetcher) (bool, error) { | ||
| file, err := f.FetchByName(filepath.Join(content.TemplateDir, kubeSystemConfigmapEtcdCAFileName)) | ||
| if err != nil { | ||
| if os.IsNotExist(err) { | ||
| return false, nil | ||
| } | ||
| return false, err | ||
| } | ||
| t.FileList = []*asset.File{file} | ||
| return true, nil | ||
| } |
64 changes: 64 additions & 0 deletions
64
pkg/asset/templates/content/bootkube/kube-system-secret-etcd-client-ca-deprecated.go
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 ( | ||
| kubeSystemSecretEtcdClientCADeprecatedFileName = "kube-system-secret-etcd-client-ca-deprecated.yaml.template" | ||
| ) | ||
|
|
||
| var _ asset.WritableAsset = (*KubeSystemSecretEtcdClientCADeprecated)(nil) | ||
|
|
||
| // KubeSystemSecretEtcdClientCADeprecated is the constant to represent contents of kube-system-secret-etcd-client-ca-deprecated.yaml.template file. | ||
| type KubeSystemSecretEtcdClientCADeprecated struct { | ||
| FileList []*asset.File | ||
| } | ||
|
|
||
| // Dependencies returns all of the dependencies directly needed by the asset | ||
| func (t *KubeSystemSecretEtcdClientCADeprecated) Dependencies() []asset.Asset { | ||
| return []asset.Asset{} | ||
| } | ||
|
|
||
| // Name returns the human-friendly name of the asset. | ||
| func (t *KubeSystemSecretEtcdClientCADeprecated) Name() string { | ||
| return "KubeSystemSecretEtcdClientCADeprecated" | ||
| } | ||
|
|
||
| // Generate generates the actual files by this asset | ||
| func (t *KubeSystemSecretEtcdClientCADeprecated) Generate(parents asset.Parents) error { | ||
| fileName := kubeSystemSecretEtcdClientCADeprecatedFileName | ||
| 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 *KubeSystemSecretEtcdClientCADeprecated) Files() []*asset.File { | ||
| return t.FileList | ||
| } | ||
|
|
||
| // Load returns the asset from disk. | ||
| func (t *KubeSystemSecretEtcdClientCADeprecated) Load(f asset.FileFetcher) (bool, error) { | ||
| file, err := f.FetchByName(filepath.Join(content.TemplateDir, kubeSystemSecretEtcdClientCADeprecatedFileName)) | ||
| if err != nil { | ||
| if os.IsNotExist(err) { | ||
| return false, nil | ||
| } | ||
| return false, err | ||
| } | ||
| t.FileList = []*asset.File{file} | ||
| return true, nil | ||
| } |
Oops, something went wrong.
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.
Why are we opening with a deprecated object?
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.
no sure what you mean by that.
This mimics the deprecation comment on https://github.com/openshift/installer/blob/c52894b2c2064e5cb8a6d736ccdbe29279d18ceb/pkg/asset/tls/etcd.go#L11
anf https://github.com/openshift/installer/blob/c52894b2c2064e5cb8a6d736ccdbe29279d18ceb/pkg/asset/manifests/operators.go#L168