Skip to content

Commit ff32b6b

Browse files
committed
Corrections and multiple certificate copy.
1 parent b3cb928 commit ff32b6b

11 files changed

Lines changed: 24 additions & 38 deletions

File tree

config/crds/hive.openshift.io_clusterdeployments.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ spec:
443443
type: string
444444
credentialsSecretRef:
445445
description: 'CredentialsSecretRef refers to a secret that contains
446-
the vSphere account access credentials: GOVC_HOST, GOVC_USERNAME,
447-
GOVC_PASSWORD fields.'
446+
the vSphere account access credentials: GOVC_USERNAME, GOVC_PASSWORD
447+
fields.'
448448
properties:
449449
name:
450450
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

contrib/pkg/createcluster/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ create-cluster CLUSTER_DEPLOYMENT_NAME --cloud=aws
196196
create-cluster CLUSTER_DEPLOYMENT_NAME --cloud=azure --azure-base-domain-resource-group-name=RESOURCE_GROUP_NAME
197197
create-cluster CLUSTER_DEPLOYMENT_NAME --cloud=gcp
198198
create-cluster CLUSTER_DEPLOYMENT_NAME --cloud=openstack --openstack-api-floating-ip=192.168.1.2 --openstack-cloud=mycloud
199-
create-cluster CLUSTER_DEPLOYMENT_NAME --cloud=vsphere --vsphere-vcenter=vcsa.vmware.devcluster.openshift.com --vsphere-datacenter=dc1 --vsphere-default-datastore=nvme-ds1 --vsphere-api-vip=192.168.1.2 --vsphere-ingress-vip=192.168.1.3 --vsphere-cluster=devel --vsphere-network="VM Network" --vsphere-ca-certs=/path/to/cert`,
199+
create-cluster CLUSTER_DEPLOYMENT_NAME --cloud=vsphere --vsphere-vcenter=vmware.devcluster.com --vsphere-datacenter=dc1 --vsphere-default-datastore=nvme-ds1 --vsphere-api-vip=192.168.1.2 --vsphere-ingress-vip=192.168.1.3 --vsphere-cluster=devel --vsphere-network="VM Network" --vsphere-ca-certs=/path/to/cert`,
200200
Short: "Creates a new Hive cluster deployment",
201201
Long: fmt.Sprintf(longDesc, defaultSSHPublicKeyFile, defaultPullSecretFile),
202202
Args: cobra.ExactArgs(1),
@@ -573,7 +573,7 @@ func (o *Options) GenerateObjects() ([]runtime.Object, error) {
573573
APIVIP: o.VSphereAPIVIP,
574574
IngressVIP: o.VSphereIngressVIP,
575575
Network: vSphereNetwork,
576-
CACert: bytes.Join(caCerts[:], []byte("\n")),
576+
CACert: bytes.Join(caCerts, []byte("\n")),
577577
}
578578
builder.SkipMachinePoolGeneration = true
579579
builder.CloudBuilder = vsphereProvider

contrib/pkg/deprovision/vsphere.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ import (
77
log "github.com/sirupsen/logrus"
88
"github.com/spf13/cobra"
99

10-
"github.com/openshift/hive/pkg/constants"
1110
"github.com/openshift/installer/pkg/destroy/vsphere"
1211
"github.com/openshift/installer/pkg/types"
1312
typesvsphere "github.com/openshift/installer/pkg/types/vsphere"
13+
14+
"github.com/openshift/hive/pkg/constants"
1415
)
1516

1617
// vSphereOptions is the set of options to deprovision an vSphere cluster
@@ -50,7 +51,11 @@ func NewDeprovisionvSphereCommand() *cobra.Command {
5051
// Complete finishes parsing arguments for the command
5152
func (o *vSphereOptions) Complete(cmd *cobra.Command, args []string) error {
5253
o.infraID = args[0]
54+
return nil
55+
}
5356

57+
// Validate ensures that option values make sense
58+
func (o *vSphereOptions) Validate(cmd *cobra.Command) error {
5459
if o.vCenter == "" {
5560
o.vCenter = os.Getenv(constants.VSphereVCenterEnvVar)
5661
if o.vCenter == "" {
@@ -65,12 +70,6 @@ func (o *vSphereOptions) Complete(cmd *cobra.Command, args []string) error {
6570
if o.password == "" {
6671
return fmt.Errorf("No %s env var set, cannot proceed", constants.VSpherePasswordEnvVar)
6772
}
68-
69-
return nil
70-
}
71-
72-
// Validate ensures that option values make sense
73-
func (o *vSphereOptions) Validate(cmd *cobra.Command) error {
7473
return nil
7574
}
7675

pkg/apis/hive/v1/clusterdeprovision_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ type OpenStackClusterDeprovision struct {
7272
// VSphereClusterDeprovision contains VMware vSphere-specific configuration for a ClusterDeprovision
7373
type VSphereClusterDeprovision struct {
7474
// CredentialsSecretRef is the vSphere account credentials to use for deprovisioning the cluster
75-
CredentialsSecretRef *corev1.LocalObjectReference `json:"credentialsSecretRef"`
75+
CredentialsSecretRef corev1.LocalObjectReference `json:"credentialsSecretRef"`
7676
// CertificatesSecretRef refers to a secret that contains the vSphere CA certificates
7777
// necessary for communicating with the VCenter.
78-
CertificatesSecretRef *corev1.LocalObjectReference `json:"certificatesSecretRef"`
78+
CertificatesSecretRef corev1.LocalObjectReference `json:"certificatesSecretRef"`
7979
// VCenter is the vSphere vCenter hostname.
8080
VCenter string `json:"vCenter"`
8181
}

pkg/apis/hive/v1/validating-webhooks/clusterdeployment_validating_admission_hook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ func (a *ClusterDeploymentValidatingAdmissionHook) validateCreate(admissionSpec
316316
allErrs = append(allErrs, field.Required(vspherePath.Child("datacenter"), "must specify vSphere datacenter"))
317317
}
318318
if vsphere.DefaultDatastore == "" {
319-
allErrs = append(allErrs, field.Required(vspherePath.Child("defaultDatastore"), "must specify Vvphere defaultDatastore"))
319+
allErrs = append(allErrs, field.Required(vspherePath.Child("defaultDatastore"), "must specify vSphere defaultDatastore"))
320320
}
321321
}
322322
if newObject.Spec.Platform.BareMetal != nil {

pkg/apis/hive/v1/vsphere/doc.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// Package vsphere contains vSphere-specific structures for installer
2-
// configuration and management.
1+
// Package vsphere contains contains API Schema definitions for vSphere clusters.
32
// +k8s:deepcopy-gen=package,register
4-
// +k8s:conversion-gen=github.com/openshift/hive/pkg/apis/hive
53
package vsphere
6-
7-
// Name is name for the vsphere platform.
8-
const Name string = "vsphere"

pkg/apis/hive/v1/vsphere/platform.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Platform struct {
1010
VCenter string `json:"vCenter"`
1111

1212
// CredentialsSecretRef refers to a secret that contains the vSphere account access
13-
// credentials: GOVC_HOST, GOVC_USERNAME, GOVC_PASSWORD fields.
13+
// credentials: GOVC_USERNAME, GOVC_PASSWORD fields.
1414
CredentialsSecretRef corev1.LocalObjectReference `json:"credentialsSecretRef"`
1515

1616
// CertificatesSecretRef refers to a secret that contains the vSphere CA certificates

pkg/apis/hive/v1/zz_generated.deepcopy.go

Lines changed: 3 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/controller/clusterdeployment/clusterdeployment_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,8 +1556,8 @@ func generateDeprovision(cd *hivev1.ClusterDeployment) (*hivev1.ClusterDeprovisi
15561556
}
15571557
case cd.Spec.Platform.VSphere != nil:
15581558
req.Spec.Platform.VSphere = &hivev1.VSphereClusterDeprovision{
1559-
CredentialsSecretRef: &cd.Spec.Platform.VSphere.CredentialsSecretRef,
1560-
CertificatesSecretRef: &cd.Spec.Platform.VSphere.CertificatesSecretRef,
1559+
CredentialsSecretRef: cd.Spec.Platform.VSphere.CredentialsSecretRef,
1560+
CertificatesSecretRef: cd.Spec.Platform.VSphere.CertificatesSecretRef,
15611561
VCenter: cd.Spec.Platform.VSphere.VCenter,
15621562
}
15631563
default:

pkg/install/generate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func InstallerPodSpec(
312312
hiveArg := fmt.Sprintf("/usr/bin/hiveutil install-manager --work-dir /output --log-level debug %s %s", cd.Namespace, provisionName)
313313
if cd.Spec.Platform.VSphere != nil {
314314
// Add vsphere certificates to CA trust.
315-
hiveArg = fmt.Sprintf("cp -v %s/.cacert /etc/pki/ca-trust/source/anchors/ && update-ca-trust && %s", vsphereCloudsDir, hiveArg)
315+
hiveArg = fmt.Sprintf("cp -vr %s/. /etc/pki/ca-trust/source/anchors/ && update-ca-trust && %s", vsphereCloudsDir, hiveArg)
316316
}
317317

318318
// This container just needs to copy the required install binaries to the shared emptyDir volume,
@@ -660,7 +660,7 @@ func completeVSphereDeprovisionJob(req *hivev1.ClusterDeprovision, job *batchv1.
660660
ImagePullPolicy: images.GetHiveImagePullPolicy(),
661661
Env: env,
662662
Command: []string{"/bin/sh", "-c"},
663-
Args: []string{fmt.Sprintf("cp -v /vsphere/.cacert /etc/pki/ca-trust/source/anchors/ && update-ca-trust && /usr/bin/hiveutil deprovision vsphere --vsphere-vcenter %s --loglevel debug %s", req.Spec.Platform.VSphere.VCenter, req.Spec.InfraID)},
663+
Args: []string{fmt.Sprintf("cp -vr %s/. /etc/pki/ca-trust/source/anchors/ && update-ca-trust && /usr/bin/hiveutil deprovision vsphere --vsphere-vcenter %s --loglevel debug %s", vsphereCloudsDir, req.Spec.Platform.VSphere.VCenter, req.Spec.InfraID)},
664664
VolumeMounts: volumeMounts,
665665
},
666666
}

0 commit comments

Comments
 (0)