Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/rb_shift/openshift_kind.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ def update(patch = nil)
execute "patch #{self.class.class_name} #{name} -p #{patch.shellescape}"
end

def change_label(label)
@obj[:metadata][:labels].merge!(label)
end

def execute(command, **opts)
parent.execute(command, **opts) if parent.respond_to? :execute
end
Expand Down
5 changes: 5 additions & 0 deletions lib/rb_shift/route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ def address
protocol = termination ? 'https' : 'http'
"#{protocol}://#{host.chomp '/'}"
end

def change_service(name, port)
@obj[:spec][:to][:name] = name
@obj[:spec][:port][:targetPort] = port
end
end
end
8 changes: 8 additions & 0 deletions lib/rb_shift/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ def routes(update = false)
@_routes
end

def filter_routes_by_labels(update = false, labels: {})
routes = routes(update)
routes.select do |_, value|
(labels.to_a - value.metadata.labels.to_a).empty?
end

end

def create_route(name, hostname, termination = 'edge', **opts)
log.info "Creating route #{name} #{hostname} for service #{self.name}"
if termination
Expand Down