diff --git a/data/data/bootstrap/files/usr/local/bin/bootkube.sh.template b/data/data/bootstrap/files/usr/local/bin/bootkube.sh.template index eecfee2060f..b904a6153a2 100755 --- a/data/data/bootstrap/files/usr/local/bin/bootkube.sh.template +++ b/data/data/bootstrap/files/usr/local/bin/bootkube.sh.template @@ -100,7 +100,7 @@ then --asset-input-dir=/assets/tls \ --asset-output-dir=/assets/kube-apiserver-bootstrap \ --config-output-file=/assets/kube-apiserver-bootstrap/config \ - --cluster-config-file=/assets/openshift/99_openshift-cluster-api_cluster.yaml + --cluster-config-file=/assets/manifests/cluster-network-02-config.yml cp kube-apiserver-bootstrap/config /etc/kubernetes/bootstrap-configs/kube-apiserver-config.yaml cp kube-apiserver-bootstrap/bootstrap-manifests/* bootstrap-manifests/ @@ -125,7 +125,7 @@ then --asset-input-dir=/assets/tls \ --asset-output-dir=/assets/kube-controller-manager-bootstrap \ --config-output-file=/assets/kube-controller-manager-bootstrap/config \ - --cluster-config-file=/assets/openshift/99_openshift-cluster-api_cluster.yaml + --cluster-config-file=/assets/manifests/cluster-network-02-config.yml cp kube-controller-manager-bootstrap/config /etc/kubernetes/bootstrap-configs/kube-controller-manager-config.yaml cp kube-controller-manager-bootstrap/bootstrap-manifests/* bootstrap-manifests/ diff --git a/pkg/asset/manifests/cluster_k8s_io.go b/pkg/asset/manifests/cluster_k8s_io.go deleted file mode 100644 index 751de92fdb6..00000000000 --- a/pkg/asset/manifests/cluster_k8s_io.go +++ /dev/null @@ -1,63 +0,0 @@ -package manifests - -import ( - "github.com/ghodss/yaml" - "github.com/pkg/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/openshift/installer/pkg/asset" - "github.com/openshift/installer/pkg/asset/installconfig" - clusterv1a1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" -) - -// This file was originally in pkg/assets/machines, but is now in -// /manifests due to an import loop. - -// ClusterK8sIO generates the `Cluster.machine.openshift.io/v1beta1` object. -type ClusterK8sIO struct { - Raw []byte -} - -var _ asset.Asset = (*ClusterK8sIO)(nil) - -// Name returns a human friendly name for the ClusterK8sIO Asset. -func (c *ClusterK8sIO) Name() string { - return "Cluster.machine.openshift.io/v1beta1" -} - -// Dependencies returns all of the dependencies directly needed by the -// ClusterK8sIO asset -func (c *ClusterK8sIO) Dependencies() []asset.Asset { - return []asset.Asset{ - &installconfig.ClusterID{}, - &Networking{}, - } -} - -// Generate generates the Worker asset. -func (c *ClusterK8sIO) Generate(dependencies asset.Parents) error { - clusterID := &installconfig.ClusterID{} - net := &Networking{} - dependencies.Get(clusterID, net) - clusterNet, err := net.ClusterNetwork() - if err != nil { - return errors.Wrap(err, "failed to generate ClusterNetworkingConfig") - } - - cluster := clusterv1a1.Cluster{ - TypeMeta: metav1.TypeMeta{ - APIVersion: "machine.openshift.io/v1beta1", - Kind: "Cluster", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: clusterID.InfraID, - Namespace: "openshift-machine-api", - }, - Spec: clusterv1a1.ClusterSpec{ - ClusterNetwork: *clusterNet, - }, - } - - c.Raw, err = yaml.Marshal(cluster) - return err -} diff --git a/pkg/asset/manifests/network.go b/pkg/asset/manifests/network.go index c763b965316..eba2ce76743 100644 --- a/pkg/asset/manifests/network.go +++ b/pkg/asset/manifests/network.go @@ -13,7 +13,6 @@ import ( "github.com/openshift/installer/pkg/asset/templates/content/openshift" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1a1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) var ( @@ -122,31 +121,6 @@ func (no *Networking) Files() []*asset.File { return no.FileList } -// ClusterNetwork returns the ClusterNetworkingConfig for the ClusterConfig -// object. This is called by ClusterK8sIO, which captures generalized cluster -// state but shouldn't need to be fully networking aware. -func (no *Networking) ClusterNetwork() (*clusterv1a1.ClusterNetworkingConfig, error) { - if no.Config == nil { - // should be unreachable. - return nil, errors.Errorf("ClusterNetwork called before initialization") - } - - pods := []string{} - for _, cn := range no.Config.Spec.ClusterNetwork { - pods = append(pods, cn.CIDR) - } - - cn := &clusterv1a1.ClusterNetworkingConfig{ - Services: clusterv1a1.NetworkRanges{ - CIDRBlocks: no.Config.Spec.ServiceNetwork, - }, - Pods: clusterv1a1.NetworkRanges{ - CIDRBlocks: pods, - }, - } - return cn, nil -} - // Load returns false since this asset is not written to disk by the installer. func (no *Networking) Load(f asset.FileFetcher) (bool, error) { return false, nil diff --git a/pkg/asset/manifests/openshift.go b/pkg/asset/manifests/openshift.go index f1e76d7ab6f..5e3db74e6e4 100644 --- a/pkg/asset/manifests/openshift.go +++ b/pkg/asset/manifests/openshift.go @@ -40,7 +40,6 @@ func (o *Openshift) Name() string { func (o *Openshift) Dependencies() []asset.Asset { return []asset.Asset{ &installconfig.InstallConfig{}, - &ClusterK8sIO{}, &machines.Worker{}, &password.KubeadminPassword{}, @@ -55,9 +54,8 @@ func (o *Openshift) Dependencies() []asset.Asset { func (o *Openshift) Generate(dependencies asset.Parents) error { installConfig := &installconfig.InstallConfig{} kubeadminPassword := &password.KubeadminPassword{} - clusterk8sio := &ClusterK8sIO{} worker := &machines.Worker{} - dependencies.Get(installConfig, clusterk8sio, worker, kubeadminPassword) + dependencies.Get(installConfig, worker, kubeadminPassword) var cloudCreds cloudCredsSecretData platform := installConfig.Config.Platform.Name() switch platform { @@ -118,7 +116,6 @@ func (o *Openshift) Generate(dependencies asset.Parents) error { assetData := map[string][]byte{ "99_binding-discovery.yaml": []byte(bindingDiscovery.Files()[0].Data), "99_kubeadmin-password-secret.yaml": applyTemplateData(kubeadminPasswordSecret.Files()[0].Data, templateData), - "99_openshift-cluster-api_cluster.yaml": clusterk8sio.Raw, "99_openshift-cluster-api_worker-machineset.yaml": worker.MachineSetRaw, "99_openshift-cluster-api_worker-user-data-secret.yaml": worker.UserDataSecretRaw, }