Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable serviceLinks #3742

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions plugins/kubernetes/app/models/kubernetes/template_filler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def to_hash(verification: false)
elsif Kubernetes::RoleConfigFile.primary?(template)
if kind == 'Deployment'
set_history_limit
set_disable_service_links
end

make_stateful_set_match_service if kind == 'StatefulSet'
Expand All @@ -55,6 +56,7 @@ def to_hash(verification: false)
set_init_containers
set_kritis_breakglass
set_istio_sidecar_injection

elsif kind == 'PodDisruptionBudget'
set_name
set_match_labels_blue_green if blue_green_color
Expand Down Expand Up @@ -267,6 +269,11 @@ def set_history_limit
template[:spec][:revisionHistoryLimit] ||= 1
end

# disable service links.
def set_disable_service_links
template[:spec][:template][:spec][:enableServiceLinks] ||= false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should set that on pod_templates for consistency, not only Deployments, use pod_template

end

# replace keys in annotations by looking them up in all possible namespaces by specificity
# also supports wildcard expansion
def expand_secret_annotations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ def with_init_container(container)
template.to_hash[:spec][:revisionHistoryLimit].must_equal 1
end

it "disables serviceLinks" do
template.to_hash[:spec][:template][:spec][:enableServiceLinks].must_equal false
end

it "can verify without builds" do
doc.kubernetes_release.builds = []
template.to_hash(verification: true)
Expand Down