Skip to content

Commit

Permalink
pkg/asset: replace depricated assets
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
  • Loading branch information
hexfusion committed Feb 26, 2019
1 parent a110dbd commit d20c0d3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 90 deletions.
6 changes: 0 additions & 6 deletions pkg/asset/ignition/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ func (a *Bootstrap) Dependencies() []asset.Asset {
&tls.EtcdCA{},
&tls.EtcdCABundle{},
&tls.EtcdClientCertKey{},
&tls.EtcdMetricsCA{},
&tls.EtcdMetricsCABundle{},
&tls.EtcdMetricsClientCertKey{},
&tls.EtcdMetricsSignerCertKey{},
&tls.EtcdMetricsSignerClientCertKey{},
&tls.EtcdSignerCertKey{},
Expand Down Expand Up @@ -393,9 +390,6 @@ func (a *Bootstrap) addParentFiles(dependencies asset.Parents) {
&tls.EtcdCA{},
&tls.EtcdCABundle{},
&tls.EtcdClientCertKey{},
&tls.EtcdMetricsCA{},
&tls.EtcdMetricsCABundle{},
&tls.EtcdMetricsClientCertKey{},
&tls.EtcdMetricsSignerCertKey{},
&tls.EtcdMetricsSignerClientCertKey{},
&tls.EtcdSignerCertKey{},
Expand Down
18 changes: 9 additions & 9 deletions pkg/asset/manifests/operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func (m *Manifests) Dependencies() []asset.Asset {
&tls.RootCA{},
&tls.EtcdCA{},
&tls.EtcdClientCertKey{},
&tls.EtcdMetricsCA{},
&tls.EtcdMetricsClientCertKey{},
&tls.EtcdMetricsSignerCertKey{},
&tls.EtcdMetricsSignerClientCertKey{},
&tls.MCSCertKey{},

&bootkube.KubeCloudConfig{},
Expand Down Expand Up @@ -129,16 +129,16 @@ func (m *Manifests) generateBootKubeManifests(dependencies asset.Parents) []*ass
etcdCA := &tls.EtcdCA{}
mcsCertKey := &tls.MCSCertKey{}
etcdClientCertKey := &tls.EtcdClientCertKey{}
etcdMetricsCA := &tls.EtcdMetricsCA{}
etcdMetricsClientCertKey := &tls.EtcdMetricsClientCertKey{}
etcdMetricsSignerCertKey := &tls.EtcdMetricsSignerCertKey{}
etcdMetricsSignerClientCertKey := &tls.EtcdMetricsSignerClientCertKey{}
rootCA := &tls.RootCA{}
dependencies.Get(
clusterID,
installConfig,
etcdCA,
etcdClientCertKey,
etcdMetricsCA,
etcdMetricsClientCertKey,
etcdMetricsSignerCertKey,
etcdMetricsSignerClientCertKey,
mcsCertKey,
rootCA,
)
Expand All @@ -153,9 +153,9 @@ func (m *Manifests) generateBootKubeManifests(dependencies asset.Parents) []*ass
EtcdCaCert: string(etcdCA.Cert()),
EtcdClientCert: base64.StdEncoding.EncodeToString(etcdClientCertKey.Cert()),
EtcdClientKey: base64.StdEncoding.EncodeToString(etcdClientCertKey.Key()),
EtcdMetricsCaCert: string(etcdMetricsCA.Cert()),
EtcdMetricsClientCert: base64.StdEncoding.EncodeToString(etcdMetricsClientCertKey.Cert()),
EtcdMetricsClientKey: base64.StdEncoding.EncodeToString(etcdMetricsClientCertKey.Key()),
EtcdMetricsCaCert: string(etcdMetricsSignerCertKey.Cert()),
EtcdMetricsClientCert: base64.StdEncoding.EncodeToString(etcdMetricsSignerClientCertKey.Cert()),
EtcdMetricsClientKey: base64.StdEncoding.EncodeToString(etcdMetricsSignerClientCertKey.Key()),
McsTLSCert: base64.StdEncoding.EncodeToString(mcsCertKey.Cert()),
McsTLSKey: base64.StdEncoding.EncodeToString(mcsCertKey.Key()),
PullSecretBase64: base64.StdEncoding.EncodeToString([]byte(installConfig.Config.PullSecret)),
Expand Down
2 changes: 2 additions & 0 deletions pkg/asset/targets/targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ var (
&bootkube.OpenshiftMachineConfigOperator{},
&bootkube.EtcdServiceKubeSystem{},
&bootkube.HostEtcdServiceKubeSystem{},
&bootkube.OpenshiftConfigSecretEtcdMetricsClient{},
&bootkube.OpenshiftConfigConfigmapEtcdMetricsServingCA{},
&openshift.BindingDiscovery{},
&openshift.CloudCredsSecret{},
&openshift.KubeadminPasswordSecret{},
Expand Down
76 changes: 1 addition & 75 deletions pkg/asset/tls/etcdmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,80 +7,6 @@ import (
"github.com/openshift/installer/pkg/asset"
)

// EtcdMetricsCA is the asset that generates the etcd-metrics-ca key/cert pair.
// [DEPRECATED]
type EtcdMetricsCA struct {
SignedCertKey
}

var _ asset.Asset = (*EtcdMetricsCA)(nil)

// Dependencies returns the dependency of the the cert/key pair, which includes
// the parent CA, and install config if it depends on the install config for
// DNS names, etc.
func (a *EtcdMetricsCA) Dependencies() []asset.Asset {
return []asset.Asset{
&RootCA{},
}
}

// Generate generates the cert/key pair based on its dependencies.
func (a *EtcdMetricsCA) Generate(dependencies asset.Parents) error {
rootCA := &RootCA{}
dependencies.Get(rootCA)

cfg := &CertCfg{
Subject: pkix.Name{CommonName: "etcd-metrics", OrganizationalUnit: []string{"etcd-metrics"}},
KeyUsages: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
Validity: ValidityTenYears,
IsCA: true,
}

return a.SignedCertKey.Generate(cfg, rootCA, "etcd-metrics-client-ca", DoNotAppendParent)
}

// Name returns the human-friendly name of the asset.
func (a *EtcdMetricsCA) Name() string {
return "Certificate (etcd-metrics)"
}

// EtcdMetricsClientCertKey is the asset that generates the etcd-metrics client key/cert pair.
// [DEPRECATED]
type EtcdMetricsClientCertKey struct {
SignedCertKey
}

var _ asset.Asset = (*EtcdMetricsClientCertKey)(nil)

// Dependencies returns the dependency of the the cert/key pair, which includes
// the parent CA, and install config if it depends on the install config for
// DNS names, etc.
func (a *EtcdMetricsClientCertKey) Dependencies() []asset.Asset {
return []asset.Asset{
&EtcdMetricsCA{},
}
}

// Generate generates the cert/key pair based on its dependencies.
func (a *EtcdMetricsClientCertKey) Generate(dependencies asset.Parents) error {
etcdCA := &EtcdMetricsCA{}
dependencies.Get(etcdCA)

cfg := &CertCfg{
Subject: pkix.Name{CommonName: "etcd-metrics", OrganizationalUnit: []string{"etcd-metrics"}},
KeyUsages: x509.KeyUsageKeyEncipherment,
ExtKeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth},
Validity: ValidityTenYears,
}

return a.SignedCertKey.Generate(cfg, etcdCA, "etcd-metrics-client", DoNotAppendParent)
}

// Name returns the human-friendly name of the asset.
func (a *EtcdMetricsClientCertKey) Name() string {
return "Certificate (etcd-metrics)"
}

// EtcdMetricsSignerCertKey is a key/cert pair that signs the etcd-metrics client and peer certs.
type EtcdMetricsSignerCertKey struct {
SelfSignedCertKey
Expand Down Expand Up @@ -110,7 +36,7 @@ func (c *EtcdMetricsSignerCertKey) Name() string {
return "Certificate (etcd-metrics-signer)"
}

// EtcdMetricsCABundle is the asset the generates the etcd-ca-bundle,
// EtcdMetricsCABundle is the asset the generates the etcd-metrics-ca-bundle,
// which contains all the individual client CAs.
type EtcdMetricsCABundle struct {
CertBundle
Expand Down

0 comments on commit d20c0d3

Please sign in to comment.