Skip to content

Instantly share code, notes, and snippets.

@jsturtevant
Created April 1, 2022 15:40
Show Gist options
  • Save jsturtevant/94b82838fbc8950449157496ae541244 to your computer and use it in GitHub Desktop.
Save jsturtevant/94b82838fbc8950449157496ae541244 to your computer and use it in GitHub Desktop.
Run a sub project of capz e2e
//go:build e2e
// +build e2e
package main
import (
"context"
"sigs.k8s.io/cluster-api-provider-azure/test/e2e"
. "github.com/onsi/gomega"
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
expv1 "sigs.k8s.io/cluster-api-provider-azure/exp/api/v1beta1"
clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/cluster-api/test/framework"
)
func Fail(message string, callerSkip ...int) {
panic(message)
}
func main() {
// needed for ginkgo
RegisterFailHandler(Fail)
kubeconfigPath := "cluster-api-provider-azure/kubeconfig.e2e"
kubeconfigPathWorkload := "cluster-api-provider-azure/kubeconfig.windows.ctrd"
clustername := "capz-conf-xi3nvp"
configPath := "cluster-api-provider-azure/test/e2e/config/azure-dev-envsubst.yaml"
bootstrapClusterProxy, _ := framework.NewClusterProxy("bootstrap", kubeconfigPath, initScheme(), []framework.Option{}...).(framework.ClusterProxy)
workloadproxy, _ := framework.NewClusterProxy("azure", kubeconfigPathWorkload, initScheme(), []framework.Option{}...).(framework.ClusterProxy)
e2eConfig := clusterctl.LoadE2EConfig(context.TODO(), clusterctl.LoadE2EConfigInput{ConfigPath: configPath})
e2e.ConfigureGmsa(context.Background(), workloadproxy, bootstrapClusterProxy, clustername, clustername, e2eConfig)
}
func initScheme() *runtime.Scheme {
scheme := runtime.NewScheme()
framework.TryAddDefaultSchemes(scheme)
infrav1.AddToScheme(scheme)
expv1.AddToScheme(scheme)
clusterv1exp.AddToScheme(scheme)
return scheme
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment