-
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.
Generate Network.cluster config instead of NetworkConfig.networkoperator
* Add the Network.config.openshift.io CRD * Generate the network config from the install config * Remove networkoperator types from install config (but use the same schema) * Move network CRDs to templates to match #943 This doesn't change the json/yaml serialization of the install config, but it changes it internally.
- Loading branch information
Showing
13 changed files
with
214 additions
and
197 deletions.
There are no files selected for viewing
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,16 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: networks.config.openshift.io | ||
spec: | ||
group: config.openshift.io | ||
names: | ||
kind: Network | ||
listKind: NetworkList | ||
plural: networks | ||
singular: network | ||
scope: Cluster | ||
versions: | ||
- name: v1 | ||
served: true | ||
storage: true |
19 changes: 19 additions & 0 deletions
19
data/data/manifests/openshift/cluster-networkconfig-crd.yaml
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,19 @@ | ||
# This is the advanced network configuration CRD | ||
# Only necessary if you need to tweak certain settings. | ||
# See https://github.com/openshift/cluster-network-operator#configuring | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: networkconfigs.networkoperator.openshift.io | ||
spec: | ||
group: networkoperator.openshift.io | ||
names: | ||
kind: NetworkConfig | ||
listKind: NetworkConfigList | ||
plural: networkconfigs | ||
singular: networkconfig | ||
scope: Cluster | ||
versions: | ||
- name: v1 | ||
served: true | ||
storage: true |
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
69 changes: 69 additions & 0 deletions
69
pkg/asset/templates/content/openshift/cluster-network-crds.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,69 @@ | ||
package openshift | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/openshift/installer/pkg/asset" | ||
"github.com/openshift/installer/pkg/asset/templates/content" | ||
) | ||
|
||
const ( | ||
netCRDfilename = "cluster-network-crd.yaml" | ||
netopCRDfilename = "cluster-networkconfig-crd.yaml" | ||
) | ||
|
||
var _ asset.WritableAsset = (*NetworkCRDs)(nil) | ||
|
||
// NetworkCRDs is the custom resource definitions for the network operator types: | ||
// - Network.config.openshift.io | ||
// - NetworkConfig.networkoperator.openshift.io | ||
type NetworkCRDs struct { | ||
FileList []*asset.File | ||
} | ||
|
||
// Dependencies returns all of the dependencies directly needed by the asset | ||
func (t *NetworkCRDs) Dependencies() []asset.Asset { | ||
return []asset.Asset{} | ||
} | ||
|
||
// Name returns the human-friendly name of the asset. | ||
func (t *NetworkCRDs) Name() string { | ||
return "Network CRDs" | ||
} | ||
|
||
// Generate generates the actual files by this asset | ||
func (t *NetworkCRDs) Generate(parents asset.Parents) error { | ||
for _, filename := range []string{netCRDfilename, netopCRDfilename} { | ||
data, err := content.GetOpenshiftTemplate(filename) | ||
if err != nil { | ||
return err | ||
} | ||
t.FileList = append(t.FileList, &asset.File{ | ||
Filename: filepath.Join(content.TemplateDir, filename), | ||
Data: []byte(data), | ||
}) | ||
} | ||
return nil | ||
} | ||
|
||
// Files returns the files generated by the asset. | ||
func (t *NetworkCRDs) Files() []*asset.File { | ||
return t.FileList | ||
} | ||
|
||
// Load returns the asset from disk. | ||
func (t *NetworkCRDs) Load(f asset.FileFetcher) (bool, error) { | ||
for _, filename := range []string{netCRDfilename, netopCRDfilename} { | ||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, filename)) | ||
if err != nil { | ||
if os.IsNotExist(err) { | ||
return false, nil | ||
} | ||
return false, err | ||
} | ||
t.FileList = append(t.FileList, file) | ||
} | ||
|
||
return true, nil | ||
} |
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
Oops, something went wrong.