mirror of https://github.com/kubernetes/kops.git
Remove dead code
This commit is contained in:
parent
640bcc9d03
commit
e0d9259be1
|
@ -94,10 +94,6 @@ func (k fakeCAStore) FindCertificatePool(name string) (*fi.CertificatePool, erro
|
||||||
panic("fakeCAStore does not implement FindCertificatePool")
|
panic("fakeCAStore does not implement FindCertificatePool")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k fakeCAStore) FindCertificateKeyset(name string) (*kops.Keyset, error) {
|
|
||||||
panic("fakeCAStore does not implement FindCertificateKeyset")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (k fakeCAStore) FindPrivateKey(name string) (*pki.PrivateKey, error) {
|
func (k fakeCAStore) FindPrivateKey(name string) (*pki.PrivateKey, error) {
|
||||||
primaryId := k.privateKeysets[name].Spec.PrimaryId
|
primaryId := k.privateKeysets[name].Spec.PrimaryId
|
||||||
for _, item := range k.privateKeysets[name].Spec.Keys {
|
for _, item := range k.privateKeysets[name].Spec.Keys {
|
||||||
|
@ -108,10 +104,6 @@ func (k fakeCAStore) FindPrivateKey(name string) (*pki.PrivateKey, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k fakeCAStore) FindPrivateKeyset(name string) (*kops.Keyset, error) {
|
|
||||||
return k.privateKeysets[name], nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (k fakeCAStore) FindCert(name string) (*pki.Certificate, error) {
|
func (k fakeCAStore) FindCert(name string) (*pki.Certificate, error) {
|
||||||
return k.certs[name], nil
|
return k.certs[name], nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,21 +73,11 @@ func (s *configserverKeyStore) FindCertificatePool(name string) (*fi.Certificate
|
||||||
return nil, fmt.Errorf("FindCertificatePool not supported by configserverKeyStore")
|
return nil, fmt.Errorf("FindCertificatePool not supported by configserverKeyStore")
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindCertificateKeyset implements fi.CAStore
|
|
||||||
func (s *configserverKeyStore) FindCertificateKeyset(name string) (*kops.Keyset, error) {
|
|
||||||
return nil, fmt.Errorf("FindCertificateKeyset not supported by configserverKeyStore")
|
|
||||||
}
|
|
||||||
|
|
||||||
// FindPrivateKey implements fi.CAStore
|
// FindPrivateKey implements fi.CAStore
|
||||||
func (s *configserverKeyStore) FindPrivateKey(name string) (*pki.PrivateKey, error) {
|
func (s *configserverKeyStore) FindPrivateKey(name string) (*pki.PrivateKey, error) {
|
||||||
return nil, fmt.Errorf("FindPrivateKey not supported by configserverKeyStore")
|
return nil, fmt.Errorf("FindPrivateKey not supported by configserverKeyStore")
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindPrivateKeyset implements fi.CAStore
|
|
||||||
func (s *configserverKeyStore) FindPrivateKeyset(name string) (*kops.Keyset, error) {
|
|
||||||
return nil, fmt.Errorf("FindPrivateKeyset not supported by configserverKeyStore")
|
|
||||||
}
|
|
||||||
|
|
||||||
// FindCert implements fi.CAStore
|
// FindCert implements fi.CAStore
|
||||||
func (s *configserverKeyStore) FindCert(name string) (*pki.Certificate, error) {
|
func (s *configserverKeyStore) FindCert(name string) (*pki.Certificate, error) {
|
||||||
for _, cert := range s.nodeConfig.Certificates {
|
for _, cert := range s.nodeConfig.Certificates {
|
||||||
|
|
|
@ -88,15 +88,9 @@ type CAStore interface {
|
||||||
// FindCertificatePool returns the named CertificatePool, or (nil,nil) if not found
|
// FindCertificatePool returns the named CertificatePool, or (nil,nil) if not found
|
||||||
FindCertificatePool(name string) (*CertificatePool, error)
|
FindCertificatePool(name string) (*CertificatePool, error)
|
||||||
|
|
||||||
// FindCertificateKeyset will return the keyset for a certificate
|
|
||||||
FindCertificateKeyset(name string) (*kops.Keyset, error)
|
|
||||||
|
|
||||||
// FindPrivateKey returns the named private key, or (nil,nil) if not found
|
// FindPrivateKey returns the named private key, or (nil,nil) if not found
|
||||||
FindPrivateKey(name string) (*pki.PrivateKey, error)
|
FindPrivateKey(name string) (*pki.PrivateKey, error)
|
||||||
|
|
||||||
// FindPrivateKeyset will return the keyset for a private key
|
|
||||||
FindPrivateKeyset(name string) (*kops.Keyset, error)
|
|
||||||
|
|
||||||
// FindCert returns the specified certificate, if it exists, or nil if not found
|
// FindCert returns the specified certificate, if it exists, or nil if not found
|
||||||
FindCert(name string) (*pki.Certificate, error)
|
FindCert(name string) (*pki.Certificate, error)
|
||||||
|
|
||||||
|
|
|
@ -197,19 +197,6 @@ func (c *ClientsetCAStore) FindCertificatePool(name string) (*CertificatePool, e
|
||||||
return pool, nil
|
return pool, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindCertificateKeyset implements CAStore::FindCertificateKeyset
|
|
||||||
func (c *ClientsetCAStore) FindCertificateKeyset(name string) (*kops.Keyset, error) {
|
|
||||||
ctx := context.TODO()
|
|
||||||
o, err := c.clientset.Keysets(c.namespace).Get(ctx, name, metav1.GetOptions{})
|
|
||||||
if err != nil {
|
|
||||||
if errors.IsNotFound(err) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("error reading keyset %q: %v", name, err)
|
|
||||||
}
|
|
||||||
return o, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListKeysets implements CAStore::ListKeysets
|
// ListKeysets implements CAStore::ListKeysets
|
||||||
func (c *ClientsetCAStore) ListKeysets() ([]*kops.Keyset, error) {
|
func (c *ClientsetCAStore) ListKeysets() ([]*kops.Keyset, error) {
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
|
@ -278,19 +265,6 @@ func (c *ClientsetCAStore) FindPrivateKey(name string) (*pki.PrivateKey, error)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindPrivateKeyset implements CAStore::FindPrivateKeyset
|
|
||||||
func (c *ClientsetCAStore) FindPrivateKeyset(name string) (*kops.Keyset, error) {
|
|
||||||
ctx := context.TODO()
|
|
||||||
o, err := c.clientset.Keysets(c.namespace).Get(ctx, name, metav1.GetOptions{})
|
|
||||||
if err != nil {
|
|
||||||
if errors.IsNotFound(err) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return nil, fmt.Errorf("error reading keyset %q: %v", name, err)
|
|
||||||
}
|
|
||||||
return o, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// storeKeyset saves the specified keyset to the registry.
|
// storeKeyset saves the specified keyset to the registry.
|
||||||
func (c *ClientsetCAStore) storeKeyset(ctx context.Context, name string, keyset *Keyset, keysetType kops.KeysetType) error {
|
func (c *ClientsetCAStore) storeKeyset(ctx context.Context, name string, keyset *Keyset, keysetType kops.KeysetType) error {
|
||||||
create := false
|
create := false
|
||||||
|
|
|
@ -320,25 +320,6 @@ func (c *VFSCAStore) FindCertificatePool(name string) (*CertificatePool, error)
|
||||||
return pool, nil
|
return pool, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *VFSCAStore) FindCertificateKeyset(name string) (*kops.Keyset, error) {
|
|
||||||
p := c.buildCertificatePoolPath(name)
|
|
||||||
certs, err := c.loadKeyset(p)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("error in 'FindCertificatePool' attempting to load cert %q: %v", name, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if certs == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
o, err := certs.ToAPIObject(name, false)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return o, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ListKeysets implements CAStore::ListKeysets
|
// ListKeysets implements CAStore::ListKeysets
|
||||||
func (c *VFSCAStore) ListKeysets() ([]*kops.Keyset, error) {
|
func (c *VFSCAStore) ListKeysets() ([]*kops.Keyset, error) {
|
||||||
keysets := make(map[string]*kops.Keyset)
|
keysets := make(map[string]*kops.Keyset)
|
||||||
|
@ -606,20 +587,6 @@ func (c *VFSCAStore) FindPrivateKey(id string) (*pki.PrivateKey, error) {
|
||||||
return key, nil
|
return key, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *VFSCAStore) FindPrivateKeyset(name string) (*kops.Keyset, error) {
|
|
||||||
keys, err := c.findPrivateKeyset(name)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
o, err := keys.ToAPIObject(name, true)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return o, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *VFSCAStore) deletePrivateKey(name string, id string) (bool, error) {
|
func (c *VFSCAStore) deletePrivateKey(name string, id string) (bool, error) {
|
||||||
// Delete the file itself
|
// Delete the file itself
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue