Fix default Airshipctl config parameters

Problems description:
Once we execute airshipctl config init, the default config in
~/.airship/config doesn't contain default values for:
currentContext: ~
clusters:
  default:
    clusterType:
      target:
        bootstrapInfo: ~
        managementConfiguration: ~
---
This PS set default values for Airshipctl config to use it
out of the box.

Closes: #234

Change-Id: I57449e678f19ab1c0e2212c38b01ea195f62aa44
This commit is contained in:
Alexander Noskov 2020-05-12 00:53:11 -05:00
parent fc0b53d2b3
commit 84f2bc60c9
8 changed files with 26 additions and 23 deletions

View File

@ -3,7 +3,7 @@ bootstrapInfo:
dummy_bootstrap_config: dummy_bootstrap_config:
container: container:
volume: /tmp/airship:/config volume: /tmp/airship:/config
image: quay.io/airshipit/isogen:latest image: quay.io/airshipit/isogen:latest-debian_stable
containerRuntime: docker containerRuntime: docker
builder: builder:
userDataFileName: user-data userDataFileName: user-data

View File

@ -3,7 +3,7 @@ bootstrapInfo:
dummy_bootstrap_config: dummy_bootstrap_config:
container: container:
volume: /tmp/airship:/config volume: /tmp/airship:/config
image: quay.io/airshipit/isogen:latest image: quay.io/airshipit/isogen:latest-debian_stable
containerRuntime: docker containerRuntime: docker
builder: builder:
userDataFileName: user-data userDataFileName: user-data

View File

@ -188,8 +188,8 @@ func (c *Config) reconcileClusters() (map[string]string, bool) {
} }
configCluster := c.Clusters[clusterComplexName.Name].ClusterTypes[clusterComplexName.Type] configCluster := c.Clusters[clusterComplexName.Name].ClusterTypes[clusterComplexName.Type]
configCluster.NameInKubeconf = clusterComplexName.String() configCluster.NameInKubeconf = clusterComplexName.String()
// TODO What do we do with the BOOTSTRAP CONFIG configCluster.Bootstrap = AirshipDefaultBootstrapInfo
configCluster.ManagementConfiguration = AirshipDefaultManagementConfiguration
// Store the reference to the KubeConfig Cluster in the Airship Config // Store the reference to the KubeConfig Cluster in the Airship Config
configCluster.SetKubeCluster(cluster) configCluster.SetKubeCluster(cluster)
} }

View File

@ -36,22 +36,24 @@ var AllClusterTypes = [2]string{Ephemeral, Target}
// Constants defining default values // Constants defining default values
const ( const (
AirshipConfigGroup = "airshipit.org" AirshipConfig = "config"
AirshipConfigVersion = "v1alpha1" AirshipConfigAPIVersion = AirshipConfigGroup + "/" + AirshipConfigVersion
AirshipConfigAPIVersion = AirshipConfigGroup + "/" + AirshipConfigVersion AirshipConfigDir = ".airship"
AirshipConfigKind = "Config" AirshipConfigEnv = "AIRSHIPCONFIG"
AirshipConfigDir = ".airship" AirshipConfigGroup = "airshipit.org"
AirshipConfig = "config" AirshipConfigKind = "Config"
AirshipKubeConfig = "kubeconfig" AirshipConfigVersion = "v1alpha1"
AirshipConfigEnv = "AIRSHIPCONFIG" AirshipDefaultBootstrapInfo = "default"
AirshipKubeConfigEnv = "AIRSHIP_KUBECONFIG" AirshipDefaultContext = "default"
AirshipDefaultContext = "default" AirshipDefaultManagementConfiguration = "default"
AirshipDefaultManifest = "default" AirshipDefaultManifest = "default"
AirshipDefaultManifestRepo = "treasuremap" AirshipDefaultManifestRepo = "treasuremap"
AirshipDefaultManifestRepoLocation = "https://opendev.org/airship/" + AirshipDefaultManifestRepo AirshipDefaultManifestRepoLocation = "https://opendev.org/airship/" + AirshipDefaultManifestRepo
AirshipKubeConfig = "kubeconfig"
AirshipKubeConfigEnv = "AIRSHIP_KUBECONFIG"
// Modules // Modules
AirshipDefaultBootstrapImage = "quay.io/airshipit/isogen:latest" AirshipDefaultBootstrapImage = "quay.io/airshipit/isogen:latest-debian_stable"
AirshipDefaultIsoURL = "http://localhost:8099/debian-custom.iso" AirshipDefaultIsoURL = "http://localhost:8099/debian-custom.iso"
AirshipDefaultRemoteType = redfish.ClientType AirshipDefaultRemoteType = redfish.ClientType
) )

View File

@ -33,7 +33,7 @@ func NewConfig() *Config {
Kind: AirshipConfigKind, Kind: AirshipConfigKind,
APIVersion: AirshipConfigAPIVersion, APIVersion: AirshipConfigAPIVersion,
BootstrapInfo: map[string]*Bootstrap{ BootstrapInfo: map[string]*Bootstrap{
AirshipDefaultContext: { AirshipDefaultBootstrapInfo: {
Container: &Container{ Container: &Container{
Volume: "/srv/iso:/config", Volume: "/srv/iso:/config",
Image: AirshipDefaultBootstrapImage, Image: AirshipDefaultBootstrapImage,
@ -56,8 +56,9 @@ func NewConfig() *Config {
Manifest: AirshipDefaultManifest, Manifest: AirshipDefaultManifest,
}, },
}, },
CurrentContext: AirshipDefaultContext,
ManagementConfiguration: map[string]*ManagementConfiguration{ ManagementConfiguration: map[string]*ManagementConfiguration{
AirshipDefaultContext: { AirshipDefaultManagementConfiguration: {
Type: redfish.ClientType, Type: redfish.ClientType,
Insecure: true, Insecure: true,
UseProxy: false, UseProxy: false,

View File

@ -3,7 +3,7 @@ bootstrapInfo:
dummy_bootstrap_config: dummy_bootstrap_config:
container: container:
volume: /tmp/airship:/config volume: /tmp/airship:/config
image: quay.io/airshipit/isogen:latest image: quay.io/airshipit/isogen:latest-debian_stable
containerRuntime: docker containerRuntime: docker
builder: builder:
userDataFileName: user-data userDataFileName: user-data

View File

@ -16,7 +16,7 @@ airship_config_manifest_directory: /tmp/airship
airship_config_primary_repo_url: "https://review.opendev.org/airship/airshipctl" airship_config_primary_repo_url: "https://review.opendev.org/airship/airshipctl"
airship_config_primary_repo_branch: "master" airship_config_primary_repo_branch: "master"
airship_config_ephemeral_ip: "10.23.25.101" airship_config_ephemeral_ip: "10.23.25.101"
airship_config_iso_builder_docker_image: quay.io/airshipit/isogen:latest airship_config_iso_builder_docker_image: quay.io/airshipit/isogen:latest-debian_stable
airship_config_iso_port: 8099 airship_config_iso_port: 8099
airship_config_iso_serve_host: localhost airship_config_iso_serve_host: localhost
airship_config_iso_name: debian-custom.iso airship_config_iso_name: debian-custom.iso

View File

@ -7,7 +7,7 @@ bootstrapInfo:
userDataFileName: user-data userDataFileName: user-data
container: container:
containerRuntime: docker containerRuntime: docker
image: quay.io/airshipit/isogen:latest image: quay.io/airshipit/isogen:latest-debian_stable
volume: /srv/iso:/config volume: /srv/iso:/config
remoteDirect: remoteDirect:
isoUrl: http://localhost:8099/debian-custom.iso isoUrl: http://localhost:8099/debian-custom.iso