Skip to content

Commit

Permalink
Add sample for BootstrapKubeconfig API type
Browse files Browse the repository at this point in the history
  • Loading branch information
anusha94 committed Jun 21, 2022
1 parent 9d33248 commit a524548
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apis/infrastructure/v1beta1/bootstrapkubeconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type BootstrapKubeconfigSpec struct {
InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty"`

// CertificateAuthorityData contains PEM-encoded certificate authority certificates.
CertificateAuthorityData string `json:"certificate-authority-data,omitempty"`
CertificateAuthorityData string `json:"certificate-authority-data"`
}

// BootstrapKubeconfigStatus defines the observed state of BootstrapKubeconfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
type: boolean
required:
- apiserver
- certificate-authority-data
type: object
status:
description: BootstrapKubeconfigStatus defines the observed state of BootstrapKubeconfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ kind: BootstrapKubeconfig
metadata:
name: bootstrapkubeconfig-sample
spec:
# TODO(user): Add fields here
apiserver: https://<host>:<port>
insecure-skip-tls-verify: true
certificate-authority-data: PEM encoded CA Data
3 changes: 2 additions & 1 deletion test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,10 @@ func generateBootstrapKubeconfig(ctx context.Context, clusterProxy framework.Clu

server := config.Clusters[name].Server
caData := b64.StdEncoding.EncodeToString(config.Clusters[name].CertificateAuthorityData)
skipTLS := config.Clusters[name].InsecureSkipTLSVerify
bootstrapKubeconfigCRD := builder.BootstrapKubeconfig("default", "test-config").
WithServer(server).
WithSkipTLSVerify(true).
WithSkipTLSVerify(skipTLS).
WithCAData(caData).
Build()
Expect(clusterProxy.GetClient().Create(context.TODO(), bootstrapKubeconfigCRD)).NotTo(HaveOccurred(), "failed to create test BootstrapKubeconfig CRD")
Expand Down

0 comments on commit a524548

Please sign in to comment.