Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,082 changes: 1,320 additions & 762 deletions docs/design/resource_dep.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions pkg/asset/ignition/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (a *Bootstrap) Dependencies() []asset.Asset {
&machines.Master{},
&manifests.Manifests{},
&manifests.Openshift{},
&tls.AdminKubeConfigCABundle{},
&tls.AggregatorCA{},
&tls.AggregatorCABundle{},
&tls.AggregatorClientCertKey{},
Expand All @@ -90,6 +91,7 @@ func (a *Bootstrap) Dependencies() []asset.Asset {
&tls.KubeAPIServerServiceNetworkCABundle{},
&tls.KubeAPIServerServiceNetworkServerCertKey{},
&tls.KubeAPIServerServiceNetworkSignerCertKey{},
&tls.KubeAPIServerCompleteCABundle{},
&tls.KubeAPIServerToKubeletCABundle{},
&tls.KubeAPIServerToKubeletClientCertKey{},
&tls.KubeAPIServerToKubeletSignerCertKey{},
Expand Down Expand Up @@ -375,6 +377,7 @@ func (a *Bootstrap) addParentFiles(dependencies asset.Parents) {
&kubeconfig.Kubelet{},
&kubeconfig.KubeletClient{},
&kubeconfig.KubeletClient{},
&tls.AdminKubeConfigCABundle{},
&tls.AggregatorCA{},
&tls.AggregatorCABundle{},
&tls.AggregatorClientCertKey{},
Expand All @@ -395,6 +398,7 @@ func (a *Bootstrap) addParentFiles(dependencies asset.Parents) {
&tls.KubeAPIServerServiceNetworkCABundle{},
&tls.KubeAPIServerServiceNetworkServerCertKey{},
&tls.KubeAPIServerServiceNetworkSignerCertKey{},
&tls.KubeAPIServerCompleteCABundle{},
&tls.KubeAPIServerToKubeletCABundle{},
&tls.KubeAPIServerToKubeletClientCertKey{},
&tls.KubeAPIServerToKubeletSignerCertKey{},
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/kubeconfig/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ var _ asset.WritableAsset = (*AdminClient)(nil)
func (k *AdminClient) Dependencies() []asset.Asset {
return []asset.Asset{
&tls.AdminKubeConfigClientCertKey{},
&tls.AdminKubeConfigCABundle{},
&tls.KubeAPIServerCompleteCABundle{},
&installconfig.InstallConfig{},
}
}

// Generate generates the kubeconfig.
func (k *AdminClient) Generate(parents asset.Parents) error {
ca := &tls.AdminKubeConfigCABundle{}
ca := &tls.KubeAPIServerCompleteCABundle{}
clientCertKey := &tls.AdminKubeConfigClientCertKey{}
installConfig := &installconfig.InstallConfig{}
parents.Get(ca, clientCertKey, installConfig)
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/kubeconfig/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ var _ asset.WritableAsset = (*KubeletClient)(nil)
// Dependencies returns the dependency of the kubeconfig.
func (k *KubeletClient) Dependencies() []asset.Asset {
return []asset.Asset{
&tls.KubeletClientCABundle{},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the kubelet-client-ca-bundle.crt still be used by anything once it is removed from the kubelet kubeconfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the kubelet-client-ca-bundle.crt still be used by anything once it is removed from the kubelet kubeconfig?

I think it was wired improperly here before (kube-ca for everyone!). It is logically distinct and is for verifying kubelet clients.

&tls.KubeAPIServerCompleteCABundle{},
&tls.KubeletClientCertKey{},
&installconfig.InstallConfig{},
}
}

// Generate generates the kubeconfig.
func (k *KubeletClient) Generate(parents asset.Parents) error {
ca := &tls.KubeletClientCABundle{}
ca := &tls.KubeAPIServerCompleteCABundle{}
clientcertkey := &tls.KubeletClientCertKey{}
installConfig := &installconfig.InstallConfig{}
parents.Get(ca, clientcertkey, installConfig)
Expand Down
3 changes: 0 additions & 3 deletions pkg/asset/tls/adminkubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ var _ asset.Asset = (*AdminKubeConfigCABundle)(nil)
func (a *AdminKubeConfigCABundle) Dependencies() []asset.Asset {
return []asset.Asset{
&AdminKubeConfigSignerCertKey{},
&KubeAPIServerLBSignerCertKey{},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
KAS can use this file to trust the client certificate generated by admin-kubeconfig-signer. just drop kubeapiserver*signer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I deleted these lines. We're trying to create a call bundle to verify the KAS serving cert, not one to verify clients.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I understand now. Sure, I'll make it client ca only. Lgty otherwise? An lgtm and hold so I can get it this weekend?

&KubeAPIServerLocalhostSignerCertKey{},
&KubeAPIServerServiceNetworkSignerCertKey{},
}
}

Expand Down
33 changes: 33 additions & 0 deletions pkg/asset/tls/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,3 +454,36 @@ func (a *KubeAPIServerLBServerCertKey) Generate(dependencies asset.Parents) erro
func (a *KubeAPIServerLBServerCertKey) Name() string {
return "Certificate (kube-apiserver-lb-server)"
}

// KubeAPIServerCompleteCABundle is the asset the generates the kube-apiserver-complete-server-ca-bundle,
// which contains all the certs that are valid to confirm the kube-apiserver identity.
type KubeAPIServerCompleteCABundle struct {
CertBundle
}

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

// Dependencies returns the dependency of the cert bundle.
func (a *KubeAPIServerCompleteCABundle) Dependencies() []asset.Asset {
return []asset.Asset{
&KubeCA{}, // TODO this should be removed once the KAS no longer serves with it
&KubeAPIServerLocalhostCABundle{},
&KubeAPIServerServiceNetworkCABundle{},
&KubeAPIServerLBCABundle{},
}
}

// Generate generates the cert bundle based on its dependencies.
func (a *KubeAPIServerCompleteCABundle) Generate(deps asset.Parents) error {
var certs []CertInterface
for _, asset := range a.Dependencies() {
deps.Get(asset)
certs = append(certs, asset.(CertInterface))
}
return a.CertBundle.Generate("kube-apiserver-complete-server-ca-bundle", certs...)
}

// Name returns the human-friendly name of the asset.
func (a *KubeAPIServerCompleteCABundle) Name() string {
return "Certificate (kube-apiserver-complete-server-ca-bundle)"
}