fix typos

Signed-off-by: Vacant2333 <rentian.zhou@daocloud.io>
This commit is contained in:
Vacant2333 2023-06-01 18:03:01 +08:00 committed by Vacant2333
parent 8b4703e121
commit 7bd2ced976
20 changed files with 65 additions and 65 deletions

View File

@ -11,7 +11,7 @@ We hope that the items listed below will inspire further engagement from the com
- Multi-cluster HPA (Horizontal Pod Autoscaling)
- Karmada operator
- ResourceInterpreter include third-party CRD resources
- Karmada playgroud
- Karmada playground
## 2023 H2
- Karmada Dashboard - alpha release

View File

@ -4,7 +4,7 @@
The Karmada operator is a method for installing, upgrading, and deleting Karmada instances.
It builds upon the basic Karmada resource and controller concepts, provides convenience to
centrally manage entire lifecyle of Karmada instances in a global cluster. With the operator,
centrally manage entire lifecycle of Karmada instances in a global cluster. With the operator,
you can extend Karmada with custom resources (CRs) to manage your instances not only in local
clusters but also in remote clusters.
@ -64,7 +64,7 @@ kubectl apply -f operator/config/crds/
### Create a Karmada instance
The Karmada operator provides a Karama CR that can define most configurations for Karmada components.
The Karmada operator provides a Karmada CR that can define most configurations for Karmada components.
It includes `image` messages, `replica`, the `args` of binary file, and custom `label`, `annotation`, and `featuregate`.
For details, see [API](./pkg/apis/operator/v1alpha1/type.go).

View File

@ -112,7 +112,7 @@ type KarmadaComponents struct {
// +optional
KarmadaScheduler *KarmadaScheduler `json:"karmadaScheduler,omitempty"`
// KarmadaWebhook holds settings to karmada-webook component of the karmada.
// KarmadaWebhook holds settings to karmada-webhook component of the karmada.
// +optional
KarmadaWebhook *KarmadaWebhook `json:"karmadaWebhook,omitempty"`
@ -151,7 +151,7 @@ type LocalEtcd struct {
CommonSettings `json:",inline"`
// VolumeData describes the settings of etcd data store.
// We will support 3 modes: emtydir, hostPath, PVC. default by hostPath.
// We will support 3 modes: emptyDir, hostPath, PVC. default by hostPath.
// +optional
VolumeData *VolumeData `json:"volumeData,omitempty"`
@ -191,7 +191,7 @@ type VolumeData struct {
}
// ExternalEtcd describes an external etcd cluster.
// operator has no knowledge of where certificate files live and they must be supplied.
// operator has no knowledge of where certificate files live, and they must be supplied.
type ExternalEtcd struct {
// Endpoints of etcd members. Required for ExternalEtcd.
Endpoints []string `json:"endpoints"`
@ -210,7 +210,7 @@ type ExternalEtcd struct {
}
// KarmadaAPIServer holds settings to kube-apiserver component of the kubernetes.
// Karmada uses it as it's own apiserver in order to provide Kubernetes-native APIs.
// Karmada uses it as its own apiserver in order to provide Kubernetes-native APIs.
type KarmadaAPIServer struct {
// CommonSettings holds common settings to kubernetes api server.
CommonSettings `json:",inline"`
@ -220,7 +220,7 @@ type KarmadaAPIServer struct {
ServiceSubnet *string `json:"serviceSubnet,omitempty"`
// ServiceType represents the service type of karmada apiserver.
// it is Nodeport by default.
// it is NodePort by default.
// +optional
ServiceType corev1.ServiceType `json:"serviceType,omitempty"`
@ -231,7 +231,7 @@ type KarmadaAPIServer struct {
// Note: This is a temporary solution to allow for the configuration of the
// kube-apiserver component. In the future, we will provide a more structured way
// to configure the component. Once that is done, this field will be discouraged to be used.
// Incorrect settings on this feild maybe lead to the corresponding component in an unhealthy
// Incorrect settings on this field maybe lead to the corresponding component in an unhealthy
// state. Before you do it, please confirm that you understand the risks of this configuration.
//
// For supported flags, please see
@ -262,7 +262,7 @@ type KarmadaAggregatedAPIServer struct {
// Note: This is a temporary solution to allow for the configuration of the
// karmada-aggregated-apiserver component. In the future, we will provide a more structured way
// to configure the component. Once that is done, this field will be discouraged to be used.
// Incorrect settings on this feild maybe lead to the corresponding component in an unhealthy
// Incorrect settings on this field maybe lead to the corresponding component in an unhealthy
// state. Before you do it, please confirm that you understand the risks of this configuration.
//
// For supported flags, please see
@ -321,7 +321,7 @@ type KubeControllerManager struct {
// https://karmada.io/docs/administrator/configuration/configure-controllers#kubernetes-controllers
//
// Others are disabled by default. If you want to enable or disable other controllers, you
// have to explicitly specify all the controllers that kube-controller-manager shoud enable
// have to explicitly specify all the controllers that kube-controller-manager should enable
// at startup phase.
// +optional
Controllers []string `json:"controllers,omitempty"`
@ -333,7 +333,7 @@ type KubeControllerManager struct {
// Note: This is a temporary solution to allow for the configuration of the
// kube-controller-manager component. In the future, we will provide a more structured way
// to configure the component. Once that is done, this field will be discouraged to be used.
// Incorrect settings on this feild maybe lead to the corresponding component in an unhealthy
// Incorrect settings on this field maybe lead to the corresponding component in an unhealthy
// state. Before you do it, please confirm that you understand the risks of this configuration.
//
// For supported flags, please see
@ -375,7 +375,7 @@ type KarmadaControllerManager struct {
// Note: This is a temporary solution to allow for the configuration of the
// karmada-controller-manager component. In the future, we will provide a more structured way
// to configure the component. Once that is done, this field will be discouraged to be used.
// Incorrect settings on this feild maybe lead to the corresponding component in an unhealthy
// Incorrect settings on this field maybe lead to the corresponding component in an unhealthy
// state. Before you do it, please confirm that you understand the risks of this configuration.
//
// For supported flags, please see
@ -406,7 +406,7 @@ type KarmadaScheduler struct {
// Note: This is a temporary solution to allow for the configuration of the karmada-scheduler
// component. In the future, we will provide a more structured way to configure the component.
// Once that is done, this field will be discouraged to be used.
// Incorrect settings on this feild maybe lead to the corresponding component in an unhealthy
// Incorrect settings on this field maybe lead to the corresponding component in an unhealthy
// state. Before you do it, please confirm that you understand the risks of this configuration.
//
// For supported flags, please see
@ -434,7 +434,7 @@ type KarmadaDescheduler struct {
// Note: This is a temporary solution to allow for the configuration of the karmada-descheduler
// component. In the future, we will provide a more structured way to configure the component.
// Once that is done, this field will be discouraged to be used.
// Incorrect settings on this feild maybe lead to the corresponding component in an unhealthy
// Incorrect settings on this field maybe lead to the corresponding component in an unhealthy
// state. Before you do it, please confirm that you understand the risks of this configuration.
//
// For supported flags, please see
@ -456,7 +456,7 @@ type KarmadaSearch struct {
// Note: This is a temporary solution to allow for the configuration of the karmada-descheduler
// component. In the future, we will provide a more structured way to configure the component.
// Once that is done, this field will be discouraged to be used.
// Incorrect settings on this feild maybe lead to the corresponding component in an unhealthy
// Incorrect settings on this field maybe lead to the corresponding component in an unhealthy
// state. Before you do it, please confirm that you understand the risks of this configuration.
//
// For supported flags, please see
@ -478,7 +478,7 @@ type KarmadaWebhook struct {
// Note: This is a temporary solution to allow for the configuration of the
// karmada-webhook component. In the future, we will provide a more structured way
// to configure the component. Once that is done, this field will be discouraged to be used.
// Incorrect settings on this feild maybe lead to the corresponding component in an unhealthy
// Incorrect settings on this field maybe lead to the corresponding component in an unhealthy
// state. Before you do it, please confirm that you understand the risks of this configuration.
//
// For supported flags, please see
@ -553,7 +553,7 @@ type HostCluster struct {
Networking *Networking `json:"networking,omitempty"`
}
// ConditionType declarative karmada condition type of karmada installtion.
// ConditionType declarative karmada condition type of karmada installation.
type ConditionType string
const (
@ -561,11 +561,11 @@ const (
// or unpredictable condition.
Unknown ConditionType = "Unknown"
// Ready represent a condition type the all installtion process to karmada have compaleted.
// Ready represent a condition type the all installation process to karmada have completed.
Ready ConditionType = "Ready"
)
// KarmadaStatus difine the most recently observed status of the Karmada.
// KarmadaStatus define the most recently observed status of the Karmada.
type KarmadaStatus struct {
// ObservedGeneration is the last observed generation.
// +optional
@ -575,11 +575,11 @@ type KarmadaStatus struct {
// +optional
SecretRef *LocalSecretReference `json:"secretRef,omitempty"`
// KarmadaVersion represente the karmada version.
// KarmadaVersion represent the karmada version.
// +optional
KarmadaVersion string `json:"karmadaVersion,omitempty"`
// KubernetesVersion represente the karmada-apiserver version.
// KubernetesVersion represent the karmada-apiserver version.
// +optional
KubernetesVersion string `json:"kubernetesVersion,omitempty"`

View File

@ -231,7 +231,7 @@ func (cert *KarmadaCert) KeyName() string {
return pair + keyExtension
}
// GeneratePrivateKey generates cert key with default size if 1024. it support
// GeneratePrivateKey generates cert key with default size if 1024. it supports
// ECDSA and RAS algorithm.
func GeneratePrivateKey(keyType x509.PublicKeyAlgorithm) (crypto.Signer, error) {
if keyType == x509.ECDSA {
@ -391,7 +391,7 @@ func appendSANsToAltNames(altNames *certutil.AltNames, SANs []string) {
}
}
// EncodeCertPEM returns PEM-endcoded certificate data
// EncodeCertPEM returns PEM-encoded certificate data
func EncodeCertPEM(cert *x509.Certificate) []byte {
block := pem.Block{
Type: CertificateBlockType,

View File

@ -97,7 +97,7 @@ const (
// KarmadaDeschedulerComponent defines the name of the karmada-descheduler component
KarmadaDeschedulerComponent = "KarmadaDescheduler"
// KarmadaOperatorLabelKeyName defines a label key used by all of resources created by karmada operator
// KarmadaOperatorLabelKeyName defines a label key used by all resources created by karmada operator
KarmadaOperatorLabelKeyName = "app.kubernetes.io/managed-by"
)

View File

@ -12,7 +12,7 @@ import (
"github.com/karmada-io/karmada/operator/pkg/workflow"
)
// Action is a intention corresponding karmada resource modification
// Action is an intention corresponding karmada resource modification
type Action string
const (
@ -22,8 +22,8 @@ const (
DeInitAction Action = "deInit"
)
// Planner represents a planner to build a job woflow and startup it.
// the karmada resource change and enqueue is correspond to a action.
// Planner represents a planner to build a job workflow and startup it.
// the karmada resource change and enqueue is corresponded to an action.
// it will create different job workflow according to action.
type Planner struct {
action Action

View File

@ -34,7 +34,7 @@ func EnsureKarmadaAggregatedAPIServer(client clientset.Interface, cfg *operatorv
}
func installKarmadaAPIServer(client clientset.Interface, cfg *operatorv1alpha1.KarmadaAPIServer, name, namespace string) error {
apiserverDeploymentbytes, err := util.ParseTemplate(KarmadaApiserverDeployment, struct {
apiserverDeploymentBytes, err := util.ParseTemplate(KarmadaApiserverDeployment, struct {
DeploymentName, Namespace, Image, EtcdClientService string
ServiceSubnet, KarmadaCertsSecret, EtcdCertsSecret string
Replicas *int32
@ -55,7 +55,7 @@ func installKarmadaAPIServer(client clientset.Interface, cfg *operatorv1alpha1.K
}
apiserverDeployment := &appsv1.Deployment{}
if err := kuberuntime.DecodeInto(clientsetscheme.Codecs.UniversalDecoder(), apiserverDeploymentbytes, apiserverDeployment); err != nil {
if err := kuberuntime.DecodeInto(clientsetscheme.Codecs.UniversalDecoder(), apiserverDeploymentBytes, apiserverDeployment); err != nil {
return fmt.Errorf("error when decoding karmadaApiserver deployment: %w", err)
}

View File

@ -67,7 +67,7 @@ func getComponentManifests(name, namespace string, cfg *operatorv1alpha1.Karmada
}
func getKubeControllerManagerManifest(name, namespace string, cfg *operatorv1alpha1.KubeControllerManager) (*appsv1.Deployment, error) {
kubeControllerManageretBytes, err := util.ParseTemplate(KubeControllerManagerDeployment, struct {
kubeControllerManagerBytes, err := util.ParseTemplate(KubeControllerManagerDeployment, struct {
DeploymentName, Namespace, Image string
KarmadaCertsSecret, KubeconfigSecret string
Replicas *int32
@ -84,7 +84,7 @@ func getKubeControllerManagerManifest(name, namespace string, cfg *operatorv1alp
}
kcm := &appsv1.Deployment{}
if err := kuberuntime.DecodeInto(clientsetscheme.Codecs.UniversalDecoder(), kubeControllerManageretBytes, kcm); err != nil {
if err := kuberuntime.DecodeInto(clientsetscheme.Codecs.UniversalDecoder(), kubeControllerManagerBytes, kcm); err != nil {
return nil, fmt.Errorf("err when decoding kube-controller-manager deployment: %w", err)
}
@ -93,7 +93,7 @@ func getKubeControllerManagerManifest(name, namespace string, cfg *operatorv1alp
}
func getKarmadaControllerManagerManifest(name, namespace string, cfg *operatorv1alpha1.KarmadaControllerManager) (*appsv1.Deployment, error) {
karmadaControllerManageretBytes, err := util.ParseTemplate(KamradaControllerManagerDeployment, struct {
karmadaControllerManagerBytes, err := util.ParseTemplate(KamradaControllerManagerDeployment, struct {
Replicas *int32
DeploymentName, Namespace string
Image, KubeconfigSecret string
@ -109,7 +109,7 @@ func getKarmadaControllerManagerManifest(name, namespace string, cfg *operatorv1
}
kcm := &appsv1.Deployment{}
if err := kuberuntime.DecodeInto(clientsetscheme.Codecs.UniversalDecoder(), karmadaControllerManageretBytes, kcm); err != nil {
if err := kuberuntime.DecodeInto(clientsetscheme.Codecs.UniversalDecoder(), karmadaControllerManagerBytes, kcm); err != nil {
return nil, fmt.Errorf("err when decoding karmada-controller-manager deployment: %w", err)
}

View File

@ -27,7 +27,7 @@ func EnsureKarmadaEtcd(client clientset.Interface, cfg *operatorv1alpha1.LocalEt
func installKarmadaEtcd(client clientset.Interface, name, namespace string, cfg *operatorv1alpha1.LocalEtcd) error {
// if the number of etcd is greater than one, we need to concatenate the peerURL for each member cluster.
// memberName is podName generated by etcd statefuleset: ${statefulsetName}-index
// memberName is podName generated by etcd statefulset: ${statefulsetName}-index
// memberPeerURL uses the etcd peer headless service name: ${podName}.${serviceName}.${namespace}.svc.cluster.local:2380
initialClusters := make([]string, *cfg.Replicas)
for index := range initialClusters {
@ -44,7 +44,7 @@ func installKarmadaEtcd(client clientset.Interface, name, namespace string, cfg
initialClusters[index] = fmt.Sprintf("%s=%s", memberName, memberPeerURL)
}
etcdStatefuleSetBytes, err := util.ParseTemplate(KarmadaEtcdStatefulSet, struct {
etcdStatefulSetBytes, err := util.ParseTemplate(KarmadaEtcdStatefulSet, struct {
StatefulSetName, Namespace, Image, EtcdClientService string
CertsSecretName, EtcdPeerServiceName string
InitialCluster, EtcdDataVolumeName string
@ -67,7 +67,7 @@ func installKarmadaEtcd(client clientset.Interface, name, namespace string, cfg
}
etcdStatefulSet := &appsv1.StatefulSet{}
if err := kuberuntime.DecodeInto(clientsetscheme.Codecs.UniversalDecoder(), etcdStatefuleSetBytes, etcdStatefulSet); err != nil {
if err := kuberuntime.DecodeInto(clientsetscheme.Codecs.UniversalDecoder(), etcdStatefulSetBytes, etcdStatefulSet); err != nil {
return fmt.Errorf("error when decoding Etcd StatefulSet: %w", err)
}

View File

@ -18,7 +18,7 @@ import (
operatorscheme "github.com/karmada-io/karmada/operator/pkg/scheme"
tasks "github.com/karmada-io/karmada/operator/pkg/tasks/init"
"github.com/karmada-io/karmada/operator/pkg/util"
workflow "github.com/karmada-io/karmada/operator/pkg/workflow"
"github.com/karmada-io/karmada/operator/pkg/workflow"
)
var (
@ -49,7 +49,7 @@ type initData struct {
name string
namespace string
karmadaVersion *utilversion.Version
controlplaneConifig *rest.Config
controlplaneConfig *rest.Config
controlplaneAddress string
remoteClient clientset.Interface
karmadaClient clientset.Interface
@ -61,12 +61,12 @@ type initData struct {
components *operatorv1alpha1.KarmadaComponents
}
// NewInitJob initializes a job with list of init sub task. and build
// NewInitJob initializes a job with list of init sub-task. and build
// init runData object.
func NewInitJob(opt *InitOptions) *workflow.Job {
initJob := workflow.NewJob()
// add the all of tasks to the init job workflow.
// add the all tasks to the init job workflow.
initJob.AppendTask(tasks.NewPrepareCrdsTask())
initJob.AppendTask(tasks.NewCertTask())
initJob.AppendTask(tasks.NewNamespaceTask())
@ -168,7 +168,7 @@ func (data *initData) RemoteClient() clientset.Interface {
func (data *initData) KarmadaClient() clientset.Interface {
if data.karmadaClient == nil {
data.Once.Do(func() {
client, err := clientset.NewForConfig(data.controlplaneConifig)
client, err := clientset.NewForConfig(data.controlplaneConfig)
if err != nil {
klog.Errorf("error when init karmada client, err: %w", err)
}
@ -179,12 +179,12 @@ func (data *initData) KarmadaClient() clientset.Interface {
return data.karmadaClient
}
func (data *initData) ControlplaneConifg() *rest.Config {
return data.controlplaneConifig
func (data *initData) ControlplaneConfig() *rest.Config {
return data.controlplaneConfig
}
func (data *initData) SetControlplaneConifg(config *rest.Config) {
data.controlplaneConifig = config
func (data *initData) SetControlplaneConfig(config *rest.Config) {
data.controlplaneConfig = config
}
func (data *initData) Components() *operatorv1alpha1.KarmadaComponents {
@ -195,7 +195,7 @@ func (data *initData) DataDir() string {
return data.karmadaDataDir
}
func (data *initData) CrdsRomoteURL() string {
func (data *initData) CrdsRemoteURL() string {
return data.crdRemoteURL
}

View File

@ -99,7 +99,7 @@ func runWaitKarmadaAPIServer(r workflow.RunData) error {
return errors.New("wait-KarmadaAPIServer task invoked with an invalid data struct")
}
waiter := apiclient.NewKarmadaWaiter(data.ControlplaneConifg(), data.RemoteClient(), time.Second*30)
waiter := apiclient.NewKarmadaWaiter(data.ControlplaneConfig(), data.RemoteClient(), time.Second*30)
err := waiter.WaitForSomePods(karmadaApiserverLabels.String(), data.GetNamespace(), 1)
if err != nil {
@ -137,7 +137,7 @@ func runWaitKarmadaAggregatedAPIServer(r workflow.RunData) error {
return errors.New("wait-KarmadaAggregatedAPIServer task invoked with an invalid data struct")
}
waiter := apiclient.NewKarmadaWaiter(data.ControlplaneConifg(), data.RemoteClient(), time.Second*30)
waiter := apiclient.NewKarmadaWaiter(data.ControlplaneConfig(), data.RemoteClient(), time.Second*30)
err := waiter.WaitForSomePods(karmadaAggregatedAPIServerLabels.String(), data.GetNamespace(), 1)
if err != nil {

View File

@ -92,7 +92,7 @@ func runCrdsDownload(r workflow.RunData) error {
}
if !existCrdsTar(crdsDir) {
err := util.DownloadFile(data.CrdsRomoteURL(), crdsTarPath)
err := util.DownloadFile(data.CrdsRemoteURL(), crdsTarPath)
if err != nil {
return fmt.Errorf("failed to download crd tar, err: %w", err)
}

View File

@ -13,13 +13,13 @@ type InitData interface {
certs.CertStore
GetName() string
GetNamespace() string
SetControlplaneConifg(config *rest.Config)
ControlplaneConifg() *rest.Config
SetControlplaneConfig(config *rest.Config)
ControlplaneConfig() *rest.Config
ControlplaneAddress() string
RemoteClient() clientset.Interface
KarmadaClient() clientset.Interface
DataDir() string
CrdsRomoteURL() string
CrdsRemoteURL() string
KarmadaVersion() string
Components() *operatorv1alpha1.KarmadaComponents
}

View File

@ -72,7 +72,7 @@ func runWaitEtcd(r workflow.RunData) error {
return errors.New("wait-etcd task invoked with an invalid data struct")
}
waiter := apiclient.NewKarmadaWaiter(data.ControlplaneConifg(), data.RemoteClient(), time.Second*30)
waiter := apiclient.NewKarmadaWaiter(data.ControlplaneConfig(), data.RemoteClient(), time.Second*30)
// wait etcd, karmada apiserver and aggregated apiserver to ready
// as long as a replica of pod is ready, we consider the service available.

View File

@ -92,7 +92,7 @@ func runCrds(r workflow.RunData) error {
crdsPatchPath = path.Join(crdsDir, "crds/patches")
)
crdsClient, err := apiclient.NewCRDsClient(data.ControlplaneConifg())
crdsClient, err := apiclient.NewCRDsClient(data.ControlplaneConfig())
if err != nil {
return err
}
@ -189,7 +189,7 @@ func runAPIService(r workflow.RunData) error {
return errors.New("webhookConfiguration task invoked with an invalid data struct")
}
config := data.ControlplaneConifg()
config := data.ControlplaneConfig()
client, err := apiclient.NewAPIRegistrationClient(config)
if err != nil {
return err

View File

@ -91,7 +91,7 @@ func runUploadAdminKubeconfig(r workflow.RunData) error {
if err != nil {
return err
}
data.SetControlplaneConifg(config)
data.SetControlplaneConfig(config)
klog.V(2).InfoS("[UploadAdminKubeconfig] Successfully created secret of karmada apiserver kubeconfig", "karmada", klog.KObj(data))
return nil

View File

@ -38,7 +38,7 @@ func runWaitApiserver(r workflow.RunData) error {
}
klog.V(4).InfoS("[check-apiserver-health] Running task", "karmada", klog.KObj(data))
waiter := apiclient.NewKarmadaWaiter(data.ControlplaneConifg(), data.RemoteClient(), time.Second*30)
waiter := apiclient.NewKarmadaWaiter(data.ControlplaneConfig(), data.RemoteClient(), time.Second*30)
// check whether the karmada apiserver is health.
if err := apiclient.TryRunCommand(waiter.WaitForAPI, 3); err != nil {

View File

@ -4,10 +4,10 @@ import (
"k8s.io/klog/v2"
)
// RunData is a interface represents all of runDatas abstract object.
// RunData is an interface represents all of runDatas abstract object.
type RunData = interface{}
// Job represents a executable workflow, it has list of tasks.
// Job represents an executable workflow, it has list of tasks.
// these tasks must be execution order. if one of these tasks throws
// error, the entire job will fail. During the workflow,if there are
// some artifacts, we can store it to runData.
@ -48,8 +48,8 @@ func (j *Job) SetDataInitializer(build func() (RunData, error)) {
j.runDataInitializer = build
}
// Run start execte job workflow. if the task has sub task, it will
// recursive call the sub tasks util all of task be completed or error be thrown.
// Run start execute job workflow. if the task has sub-task, it will
// recursive call the sub-tasks util all task be completed or error be thrown.
func (j *Job) Run() error {
runData := j.runData
if runData == nil {

View File

@ -1,7 +1,7 @@
package workflow
// Task is minimum unit workflow. It is sample tree structrue.
// we can set a list of sub tasks, they will all be executed if
// Task is minimum unit workflow. It is sample tree structure.
// we can set a list of sub-tasks, they will all be executed if
// RunSubTasks is true.
type Task struct {
Name string

View File

@ -52,7 +52,7 @@ type CertsConfig struct {
PublicKeyAlgorithm x509.PublicKeyAlgorithm
}
// EncodeCertPEM returns PEM-endcoded certificate data
// EncodeCertPEM returns PEM-encoded certificate data
func EncodeCertPEM(cert *x509.Certificate) []byte {
block := pem.Block{
Type: certificateBlockType,