-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9309 from djoshy/add-mcs-ca-annos
MCO-1457: Clean up MCS CA & TLS cert objects for management
- Loading branch information
Showing
36 changed files
with
2,258 additions
and
62 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
data/data/manifests/bootkube/machine-config-server-ca-configmap.yaml.template
This file contains 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,13 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: machine-config-server-ca | ||
namespace: openshift-machine-config-operator | ||
annotations: | ||
openshift.io/description: CA bundle that stores all valid CAs for the MachineConfigServer TLS certificate | ||
openshift.io/owning-component: machine-config-operator | ||
labels: | ||
auth.openshift.io/managed-certificate-type: ca-bundle | ||
data: | ||
ca-bundle.crt: | | ||
{{.RootCaCert | indent 4}} |
17 changes: 17 additions & 0 deletions
17
data/data/manifests/bootkube/machine-config-server-ca-secret.yaml.template
This file contains 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,17 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: machine-config-server-ca | ||
namespace: openshift-machine-config-operator | ||
annotations: | ||
openshift.io/owning-component: machine-config-operator | ||
openshift.io/description: CA used to sign the MachineConfigServer TLS certificate | ||
auth.openshift.io/certificate-issuer: {{.RootCAIssuerName}} | ||
auth.openshift.io/certificate-not-after: {{.RootCANotAfter}} | ||
auth.openshift.io/certificate-not-before: {{.RootCANotBefore}} | ||
labels: | ||
auth.openshift.io/managed-certificate-type: signer | ||
type: kubernetes.io/tls | ||
data: | ||
tls.crt: {{.RootCACertBase64}} | ||
tls.key: {{.RootCASignerKeyBase64}} |
This file contains 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 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 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 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 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 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
65 changes: 65 additions & 0 deletions
65
pkg/asset/templates/content/bootkube/machine-config-server-ca-configmap.go
This file contains 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,65 @@ | ||
package bootkube | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/openshift/installer/pkg/asset" | ||
"github.com/openshift/installer/pkg/asset/templates/content" | ||
) | ||
|
||
const ( | ||
machineConfigServerCAConfigMapFileName = "machine-config-server-ca-configmap.yaml.template" | ||
) | ||
|
||
var _ asset.WritableAsset = (*MachineConfigServerCAConfigMap)(nil) | ||
|
||
// MachineConfigServerCAConfigMap is the constant to represent contents of machine-config-server-ca-configmap.yaml.template file. | ||
type MachineConfigServerCAConfigMap struct { | ||
FileList []*asset.File | ||
} | ||
|
||
// Dependencies returns all of the dependencies directly needed by the asset. | ||
func (t *MachineConfigServerCAConfigMap) Dependencies() []asset.Asset { | ||
return []asset.Asset{} | ||
} | ||
|
||
// Name returns the human-friendly name of the asset. | ||
func (t *MachineConfigServerCAConfigMap) Name() string { | ||
return "MachineConfigServerCAConfigMap" | ||
} | ||
|
||
// Generate generates the actual files by this asset. | ||
func (t *MachineConfigServerCAConfigMap) Generate(_ context.Context, parents asset.Parents) error { | ||
fileName := machineConfigServerCAConfigMapFileName | ||
data, err := content.GetBootkubeTemplate(fileName) | ||
if err != nil { | ||
return err | ||
} | ||
t.FileList = []*asset.File{ | ||
{ | ||
Filename: filepath.Join(content.TemplateDir, fileName), | ||
Data: data, | ||
}, | ||
} | ||
return nil | ||
} | ||
|
||
// Files returns the files generated by the asset. | ||
func (t *MachineConfigServerCAConfigMap) Files() []*asset.File { | ||
return t.FileList | ||
} | ||
|
||
// Load returns the asset from disk. | ||
func (t *MachineConfigServerCAConfigMap) Load(f asset.FileFetcher) (bool, error) { | ||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, machineConfigServerCAConfigMapFileName)) | ||
if err != nil { | ||
if os.IsNotExist(err) { | ||
return false, nil | ||
} | ||
return false, err | ||
} | ||
t.FileList = []*asset.File{file} | ||
return true, nil | ||
} |
65 changes: 65 additions & 0 deletions
65
pkg/asset/templates/content/bootkube/machine-config-server-ca-secret.go
This file contains 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,65 @@ | ||
package bootkube | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/openshift/installer/pkg/asset" | ||
"github.com/openshift/installer/pkg/asset/templates/content" | ||
) | ||
|
||
const ( | ||
machineConfigServerCASecretFileName = "machine-config-server-ca-secret.yaml.template" // #nosec G101 | ||
) | ||
|
||
var _ asset.WritableAsset = (*MachineConfigServerCASecret)(nil) | ||
|
||
// MachineConfigServerCASecret is the constant to represent contents of machine-config-server-ca-secret.yaml.template file. | ||
type MachineConfigServerCASecret struct { | ||
FileList []*asset.File | ||
} | ||
|
||
// Dependencies returns all of the dependencies directly needed by the asset. | ||
func (t *MachineConfigServerCASecret) Dependencies() []asset.Asset { | ||
return []asset.Asset{} | ||
} | ||
|
||
// Name returns the human-friendly name of the asset. | ||
func (t *MachineConfigServerCASecret) Name() string { | ||
return "MachineConfigServerCASecret" | ||
} | ||
|
||
// Generate generates the actual files by this asset. | ||
func (t *MachineConfigServerCASecret) Generate(_ context.Context, parents asset.Parents) error { | ||
fileName := machineConfigServerCASecretFileName | ||
data, err := content.GetBootkubeTemplate(fileName) | ||
if err != nil { | ||
return err | ||
} | ||
t.FileList = []*asset.File{ | ||
{ | ||
Filename: filepath.Join(content.TemplateDir, fileName), | ||
Data: data, | ||
}, | ||
} | ||
return nil | ||
} | ||
|
||
// Files returns the files generated by the asset. | ||
func (t *MachineConfigServerCASecret) Files() []*asset.File { | ||
return t.FileList | ||
} | ||
|
||
// Load returns the asset from disk. | ||
func (t *MachineConfigServerCASecret) Load(f asset.FileFetcher) (bool, error) { | ||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, machineConfigServerCASecretFileName)) | ||
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.