Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ManifestConfig ¶
type ManifestConfig struct { KubeConfigPath string ManifestPath string Namespace string Type ManifestType Operation ManifestOperation Metadata *MetadataConfig Client dynamic.Interface ReadFile func(string) ([]byte, error) }
ManifestConfig represents the configuration needed to manage Kubernetes manifests.
**Attributes:**
KubeConfigPath: Path to the kubeconfig file. ManifestPath: Path to the Kubernetes manifest file. Namespace: Kubernetes namespace in which the operations will be performed. Type: The type of manifest (raw, Helm, or Kustomize). Operation: The operation to perform (apply or delete). Metadata: Metadata related to the manifest. Client: The dynamic Kubernetes client interface. ReadFile: Function to read the manifest file from the filesystem.
func NewManifestConfig ¶
func NewManifestConfig() *ManifestConfig
NewManifestConfig creates a new ManifestConfig with default settings.
**Returns:**
*ManifestConfig: A new ManifestConfig instance with ReadFile set to os.ReadFile.
func (*ManifestConfig) ApplyOrDeleteManifest ¶
func (mc *ManifestConfig) ApplyOrDeleteManifest(ctx context.Context) error
ApplyOrDeleteManifest applies or deletes a Kubernetes manifest based on the ManifestConfig settings.
**Parameters:**
ctx: Context for the operation.
**Returns:**
error: Error if any issue occurs while applying or deleting the manifest.
func (*ManifestConfig) CreateConfigMapFromScript ¶ added in v2.2.7
func (mc *ManifestConfig) CreateConfigMapFromScript(ctx context.Context, scriptPath string, configMapName string) error
CreateConfigMapFromScript creates a ConfigMap from a script file and applies it to the Kubernetes cluster.
**Parameters:**
ctx: The context for the operation. scriptPath: The path to the script file. configMapName: The name of the ConfigMap to create.
**Returns:**
error: Error if any issue occurs while creating the ConfigMap.
func (*ManifestConfig) HandleRawManifest ¶
HandleRawManifest applies or deletes raw Kubernetes manifests based on the operation specified in ManifestConfig.
**Parameters:**
ctx: The context for the operation. dynClient: The dynamic client to perform Kubernetes operations.
**Returns:**
error: Error if any issue occurs while handling the raw manifest.
type ManifestOperation ¶
type ManifestOperation int
ManifestOperation specifies the type of operation to perform on the manifest.
**Values:**
OperationApply: Apply the manifest. OperationDelete: Delete the manifest. OperationUpdate: Update the manifest.
const ( OperationApply ManifestOperation = iota OperationDelete OperationUpdate )
func (ManifestOperation) String ¶
func (mo ManifestOperation) String() string
String returns the string representation of the ManifestType.
**Returns:**
string: The string representation of the ManifestType.
type ManifestType ¶
type ManifestType int
ManifestType defines the type of Kubernetes manifest.
**Values:**
ManifestRaw: Raw Kubernetes manifest. ManifestHelm: Helm chart. ManifestKustomize: Kustomize configuration.
const ( ManifestRaw ManifestType = iota ManifestHelm ManifestKustomize ManifestJob )
type MetadataConfig ¶
type MetadataConfig struct {
Name string // and any other fields you expect
}
MetadataConfig holds metadata configuration for Kubernetes resources.
**Attributes:**
Name: The name of the resource.