Skip to content

Commit

Permalink
use new fkas
Browse files Browse the repository at this point in the history
  • Loading branch information
mboukhalfa committed Oct 7, 2024
1 parent 564c27e commit ab9a769
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/e2e/config/e2e_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ variables:
BMO_RELEASE_0.6: "data/bmo-deployment/overlays/release-0.6"
BMO_RELEASE_LATEST: "data/bmo-deployment/overlays/release-latest"
FKAS_RELEASE_LATEST: "data/fkas-deployment"
FKAS_CERT_PATH: "data/cluster-template-centos-fake/secrets.yaml"

intervals:
default/wait-controllers: ["10m", "10s"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
resources:
- ../bases/ippool
- ../bases/centos-kubeadm-config
- secrets.yaml
55 changes: 54 additions & 1 deletion test/e2e/pivoting_based_feature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,60 @@ func createFakeTargetCluster(k8sVersion string) (framework.ClusterProxy, *cluste
os.Setenv("CA_CERT_ENCODED", caCertEncoded)
os.Setenv("ETCD_KEY_ENCODED", etcdKeyEncoded)
os.Setenv("ETCD_CERT_ENCODED", etcdCertEncoded)
cluster_endpoints, err :=http.Get("http://172.22.0.2:3333/register?resource=metal3/test1&caKey="+caKeyEncoded+"&caCert="+caCertEncoded+"&etcdKey="+etcdKeyEncoded+"&etcdCert="+etcdCertEncoded)
By("Creating a Cluster CA Secret resource")
secretClusterCA := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: clusterName+"-ca",
Namespace: namespace,
Labels: map[string]string{
clusterv1.ClusterNameLabel: clusterName,
},
},
Type: corev1.SecretTypeTLS,
Data: map[string][]byte{
"tls.crt": []byte(caCertEncoded),
"tls.key": []byte(caKeyEncoded),
},
}

Expect(bootstrapClient.Create(ctx, secretClusterCA)).To(Succeed(), "should create Cluster CA Secret CR")
By("Creating a ETCD CA Secret resource")
secretClusterETCD := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: clusterName+"-etcd",
Namespace: namespace,
Labels: map[string]string{
clusterv1.ClusterNameLabel: clusterName,
},
},
Type: corev1.SecretTypeTLS,
Data: map[string][]byte{
"tls.crt": []byte(etcdCertEncoded),
"tls.key": []byte(etcdKeyEncoded),
},
}

Expect(bootstrapClient.Create(ctx, secretClusterETCD)).To(Succeed(), "should create ETCD CA Secret CR")

type FKASCluster struct {
resource string `json:"resource"`
caKey string `json:"caKey"`
caCert string `json:"caCert"`
etcdKey string `json:"etcdKey"`
etcdCert string `json:"etcdCert"`
}
fkasCluster := FKASCluster{
resource: "'"+$namespace+"/"+clusterName+"'",
caKey: caKey,
caCert: caCert,
etcdKey: etcdKey,
etcdCert: etcdCert,
}
marshalled, err := json.Marshal(fkasCluster)
if err != nil {
log.Fatalf("impossible to marshall fkasCluster: %s", err)
}
cluster_endpoints, err :=http.Post("http://172.22.0.2:3333/register?resource=metal3/", bytes.NewReader(marshalled))
check(err)
defer cluster_endpoints.Body.Close()
body, err := ioutil.ReadAll(cluster_endpoints.Body)
Expand Down

0 comments on commit ab9a769

Please sign in to comment.