// Manifests generates manifestworks to deploy the submariner-addon agent on the managed cluster.
Manifests generates manifestworks to deploy the submariner-addon agent on the managed cluster.
// Manifests generates manifestworks to deploy the submariner - addon agent on the managed cluster .
func (a *addOnAgent) Manifests(cluster *clusterv1.ManagedCluster, addon *addonapiv1alpha1.ManagedClusterAddOn) ([]runtime.Object, error) {
	objects := []runtime.Object{}
	installNamespace := addon.Spec.InstallNamespace
	if installNamespace == "" {
		installNamespace = defaultInstallationNamespace
	}
	deploymentFiles := append([]string{}, agentDeploymentFiles...)
	if installNamespace != defaultInstallationNamespace {
		deploymentFiles = append(deploymentFiles, agentInstallationNamespaceFile)
	}
	manifestConfig := struct {
		KubeConfigSecret      string
		ClusterName           string
		AddonInstallNamespace string
		Image                 string
	}{
		KubeConfigSecret:      fmt.Sprintf("%s-hub-kubeconfig", a.GetAgentAddonOptions().AddonName),
		AddonInstallNamespace: installNamespace,
		ClusterName:           cluster.Name,
		Image:                 a.agentImage,
	}
	for _, file := range deploymentFiles {
		template, err := manifestFiles.ReadFile(file)
		if err != nil {
			return objects, err
		}
		raw := assets.MustCreateAssetFromTemplate(file, template, &manifestConfig).Data
		object, _, err := genericCodec.Decode(raw, nil, nil)
		if err != nil {
			return nil, err
		}
		objects = append(objects, object)
	}
	return objects, nil
}
func ( a * addOnAgent ) Manifests ( cluster * clusterv1 . ManagedCluster , addon * addonapiv1alpha1 . ManagedClusterAddOn ) ( [ ] runtime . Object , error ) { objects := [ ] runtime . Object { } installNamespace := addon . Spec . InstallNamespace if installNamespace == " " { installNamespace = defaultInstallationNamespace } deploymentFiles := append ( [ ] string { } , agentDeploymentFiles ... ) if installNamespace != defaultInstallationNamespace { deploymentFiles = append ( deploymentFiles , agentInstallationNamespaceFile ) } manifestConfig := struct { KubeConfigSecret string ClusterName string AddonInstallNamespace string Image string } { KubeConfigSecret : fmt . Sprintf ( " " , a . GetAgentAddonOptions ( ) . AddonName ) , AddonInstallNamespace : installNamespace , ClusterName : cluster . Name , Image : a . agentImage , } for _ , file := range deploymentFiles { template , err := manifestFiles . ReadFile ( file ) if err != nil { return objects , err } raw := assets . MustCreateAssetFromTemplate ( file , template , & manifestConfig ) . Data object , _ , err := genericCodec . Decode ( raw , nil , nil ) if err != nil { return nil , err } objects = append ( objects , object ) } return objects , nil }
Manifests generates manifestworks to deploy the submariner-addon agent on the managed cluster.
Manifests generates manifestworks to deploy the submariner - addon agent on the managed cluster .
// if the installation namespace is not set, to keep consistent with addon-framework, // using open-cluster-management-agent-addon namespace as default namespace. // if the installation namesapce is default namespace (open-cluster-management-agent-addon), // we will not maintain (create/delete) it, because other ACM addons will be installed this namespace.