Documentation ¶
Overview ¶
Copyright 2022 Google LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Google LLC ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func GetDependsOnMap(objects []*fn.KubeObject) map[string]bool
- func ReplaceNamespace(objects []*fn.KubeObject, newNs string, count *int, ...)
- func SetNamespace(rl *fn.ResourceList) (bool, error)
- func UpdateAnnotation(objects []*fn.KubeObject, newNs string, oldNs map[string]struct{}, ...)
- func VisitNamespaces(objects []*fn.KubeObject, visitor func(namespace *Namespace))
- type Namespace
- type NamespaceTransformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDependsOnMap ¶
func GetDependsOnMap(objects []*fn.KubeObject) map[string]bool
GetDependsOnMap iterates `objects` to get the annotation which contains namespace value.
func ReplaceNamespace ¶
func ReplaceNamespace(objects []*fn.KubeObject, newNs string, count *int, oldNamespace map[string]struct{})
ReplaceNamespace iterates the `objects` to replace the `OldNs` with `newNs` on namespace field.
func SetNamespace ¶
func SetNamespace(rl *fn.ResourceList) (bool, error)
func UpdateAnnotation ¶
func UpdateAnnotation(objects []*fn.KubeObject, newNs string, oldNs map[string]struct{}, dependsOnMap map[string]bool)
UpdateAnnotation updates the `objects`'s "config.kubernetes.io/depends-on" annotation which contains namespace value.
func VisitNamespaces ¶
func VisitNamespaces(objects []*fn.KubeObject, visitor func(namespace *Namespace))
VisitNamespaces iterates the `objects` to execute the `visitor` function on each corresponding namespace field.
Types ¶
type Namespace ¶
type Namespace struct { Ptr *string IsNamespace bool DependsOnAnnotation string // contains filtered or unexported fields }
func NewNamespace ¶
func NewNamespace(obj *fn.KubeObject, namespacePtr *string) *Namespace
func (*Namespace) GetDependsOnAnnotation ¶
func (*Namespace) SetDependsOnAnnotation ¶
type NamespaceTransformer ¶
type NamespaceTransformer struct { NewNamespace string DependsOnMap map[string]bool Errors []string }
func (*NamespaceTransformer) Config ¶
func (p *NamespaceTransformer) Config(o *fn.KubeObject) error
Config gets the attributes from different FunctionConfig formats.
func (*NamespaceTransformer) LogResults ¶ added in v0.4.0
func (p *NamespaceTransformer) LogResults(rl *fn.ResourceList, count int, oldNamespaces map[string]struct{}) *fn.Result
func (*NamespaceTransformer) Transform ¶
func (p *NamespaceTransformer) Transform(objects []*fn.KubeObject, oldNamespaces map[string]struct{}) int
Transform replace the existing Namespace object, namespace-scoped resources' `metadata.name` and other namespace reference fields to the new value.