1/* 2Copyright 2018 The Kubernetes Authors. 3 4Licensed under the Apache License, Version 2.0 (the "License"); 5you may not use this file except in compliance with the License. 6You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10Unless required by applicable law or agreed to in writing, software 11distributed under the License is distributed on an "AS IS" BASIS, 12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13See the License for the specific language governing permissions and 14limitations under the License. 15*/ 16 17package patch 18 19// StrategicMerge represents a relative path to a 20// stategic merge patch with the format 21// https://github.com/kubernetes/community/blob/master/contributors/devel/strategic-merge-patch.md 22type StrategicMerge string 23 24// Append appends a slice of patch paths to a StrategicMerge slice 25func Append(patches []StrategicMerge, paths ...string) []StrategicMerge { 26 for _, p := range paths { 27 patches = append(patches, StrategicMerge(p)) 28 } 29 return patches 30} 31 32// Exist determines if a patch path exists in a slice of StrategicMerge 33func Exist(patches []StrategicMerge, path string) bool { 34 for _, p := range patches { 35 if p == StrategicMerge(path) { 36 return true 37 } 38 } 39 return false 40} 41