Skip to content

Commit

Permalink
Merge pull request openshift#1629 from alvaroaleman/none
Browse files Browse the repository at this point in the history
E2E etcd tests: Always run on none platform
  • Loading branch information
openshift-merge-robot authored Jul 31, 2022
2 parents 586b0aa + fe47043 commit 7e3cd37
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
6 changes: 5 additions & 1 deletion api/fixtures/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,11 @@ web_identity_token_file = /var/run/secrets/openshift/serviceaccount/token
platformSpec = hyperv1.PlatformSpec{
Type: hyperv1.NonePlatform,
}
services = getServicePublishingStrategyMappingByAPIServerAddress(o.None.APIServerAddress, o.NetworkType)
if o.None.APIServerAddress != "" {
services = getServicePublishingStrategyMappingByAPIServerAddress(o.None.APIServerAddress, o.NetworkType)
} else {
services = getIngressServicePublishingStrategyMapping(o.NetworkType)
}
case o.Agent != nil:
platformSpec = hyperv1.PlatformSpec{
Type: hyperv1.AgentPlatform,
Expand Down
3 changes: 2 additions & 1 deletion cmd/cluster/core/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ type AgentPlatformCreateOptions struct {
}

type NonePlatformCreateOptions struct {
APIServerAddress string
APIServerAddress string
ExposeThroughLoadBalancer bool
}

type KubevirtPlatformCreateOptions struct {
Expand Down
3 changes: 2 additions & 1 deletion cmd/cluster/none/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func NewCreateCommand(opts *core.CreateOptions) *cobra.Command {
}

cmd.Flags().StringVar(&opts.NonePlatform.APIServerAddress, "external-api-server-address", opts.NonePlatform.APIServerAddress, "The external API Server Address when using platform none")
cmd.Flags().BoolVar(&opts.NonePlatform.ExposeThroughLoadBalancer, "expose-through-load-balancer", opts.NonePlatform.ExposeThroughLoadBalancer, "If the services should be exposed through LoadBalancer. If not set, nodeports will be used instead")

cmd.RunE = func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
Expand Down Expand Up @@ -48,7 +49,7 @@ func CreateCluster(ctx context.Context, opts *core.CreateOptions) error {
}

func applyPlatformSpecificsValues(ctx context.Context, exampleOptions *apifixtures.ExampleOptions, opts *core.CreateOptions) (err error) {
if opts.NonePlatform.APIServerAddress == "" {
if opts.NonePlatform.APIServerAddress == "" && !opts.NonePlatform.ExposeThroughLoadBalancer {
if opts.NonePlatform.APIServerAddress, err = core.GetAPIServerAddressByNode(ctx, opts.Log); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func TestHAEtcdChaos(t *testing.T) {
clusterOpts.ControlPlaneAvailabilityPolicy = string(hyperv1.HighlyAvailable)
clusterOpts.NodePoolReplicas = 0

cluster := e2eutil.CreateCluster(t, ctx, client, &clusterOpts, globalOpts.Platform, globalOpts.ArtifactDir)
cluster := e2eutil.CreateCluster(t, ctx, client, &clusterOpts, hyperv1.NonePlatform, globalOpts.ArtifactDir)

t.Run("KillRandomMembers", testKillRandomMembers(ctx, client, cluster))
t.Run("KillAllMembers", testKillAllMembers(ctx, client, cluster))
Expand All @@ -64,7 +64,7 @@ func TestEtcdChaos(t *testing.T) {
clusterOpts.ControlPlaneAvailabilityPolicy = string(hyperv1.SingleReplica)
clusterOpts.NodePoolReplicas = 0

cluster := e2eutil.CreateCluster(t, ctx, client, &clusterOpts, globalOpts.Platform, globalOpts.ArtifactDir)
cluster := e2eutil.CreateCluster(t, ctx, client, &clusterOpts, hyperv1.NonePlatform, globalOpts.ArtifactDir)

t.Run("KillAllMembers", testKillAllMembers(ctx, client, cluster))
}
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/util/fixture.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func teardown(ctx context.Context, t *testing.T, client crclient.Client, hc *hyp
func createClusterOpts(ctx context.Context, client crclient.Client, hc *hyperv1.HostedCluster, opts *core.CreateOptions) (*core.CreateOptions, error) {
opts.Namespace = hc.Namespace
opts.Name = hc.Name
opts.NonePlatform.ExposeThroughLoadBalancer = true

switch hc.Spec.Platform.Type {
case hyperv1.AWSPlatform:
Expand All @@ -204,7 +205,6 @@ func createClusterOpts(ctx context.Context, client crclient.Client, hc *hyperv1.
}

opts.BaseDomain = defaultIngressOperator.Status.Domain

}

return opts, nil
Expand Down

0 comments on commit 7e3cd37

Please sign in to comment.