mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #58542 from hyperbolic2346/mwilson/nginx-version
Automatic merge from submit-queue (batch tested with PRs 58412, 56132, 58506, 58542, 58394). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Adding support for changing default backend and nginx container images **What this PR does / why we need it**: Adding support for changing the images used by kubernetes worker for nginx and the default backend. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # https://github.com/juju-solutions/bundle-canonical-kubernetes/issues/470 **Special notes for your reviewer**: **Release note**: ```release-note Added nginx and default backend images to kubernetes-worker config. ```
This commit is contained in:
commit
f2dc1bd781
@ -58,3 +58,15 @@ options:
|
||||
|
||||
The value for this config must be a JSON array of credential objects, like this:
|
||||
[{"server": "my.registry", "username": "myUser", "password": "myPass"}]
|
||||
nginx-image:
|
||||
type: string
|
||||
default: "auto"
|
||||
description: |
|
||||
Docker image to use for the nginx ingress controller. Auto will select an image
|
||||
based on architecture.
|
||||
default-backend-image:
|
||||
type: string
|
||||
default: "auto"
|
||||
description: |
|
||||
Docker image to use for the default backend. Auto will select an image
|
||||
based on architecture.
|
||||
|
@ -624,17 +624,30 @@ def create_kubeconfig(kubeconfig, server, ca, key=None, certificate=None,
|
||||
check_call(split(cmd.format(kubeconfig, context)))
|
||||
|
||||
|
||||
@when_any('config.changed.default-backend-image',
|
||||
'config.changed.nginx-image')
|
||||
def launch_default_ingress_controller():
|
||||
''' Launch the Kubernetes ingress controller & default backend (404) '''
|
||||
config = hookenv.config()
|
||||
|
||||
# need to test this in case we get in
|
||||
# here from a config change to the image
|
||||
if not config.get('ingress'):
|
||||
return
|
||||
|
||||
context = {}
|
||||
context['arch'] = arch()
|
||||
addon_path = '/root/cdk/addons/{}'
|
||||
|
||||
context['defaultbackend_image'] = \
|
||||
"gcr.io/google_containers/defaultbackend:1.4"
|
||||
if arch() == 's390x':
|
||||
context['defaultbackend_image'] = \
|
||||
"gcr.io/google_containers/defaultbackend-s390x:1.4"
|
||||
context['defaultbackend_image'] = config.get('default-backend-image')
|
||||
if (context['defaultbackend_image'] == "" or
|
||||
context['defaultbackend_image'] == "auto"):
|
||||
if context['arch'] == 's390x':
|
||||
context['defaultbackend_image'] = \
|
||||
"gcr.io/google_containers/defaultbackend-s390x:1.4"
|
||||
else:
|
||||
context['defaultbackend_image'] = \
|
||||
"gcr.io/google_containers/defaultbackend:1.4"
|
||||
|
||||
# Render the default http backend (404) replicationcontroller manifest
|
||||
manifest = addon_path.format('default-http-backend.yaml')
|
||||
@ -650,11 +663,14 @@ def launch_default_ingress_controller():
|
||||
return
|
||||
|
||||
# Render the ingress daemon set controller manifest
|
||||
context['ingress_image'] = \
|
||||
"gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.13"
|
||||
if arch() == 's390x':
|
||||
context['ingress_image'] = \
|
||||
"docker.io/cdkbot/nginx-ingress-controller-s390x:0.9.0-beta.13"
|
||||
context['ingress_image'] = config.get('nginx-image')
|
||||
if context['ingress_image'] == "" or context['ingress_image'] == "auto":
|
||||
if context['arch'] == 's390x':
|
||||
context['ingress_image'] = \
|
||||
"docker.io/cdkbot/nginx-ingress-controller-s390x:0.9.0-beta.13"
|
||||
else:
|
||||
context['ingress_image'] = \
|
||||
"gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.15" # noqa
|
||||
context['juju_application'] = hookenv.service_name()
|
||||
manifest = addon_path.format('ingress-daemon-set.yaml')
|
||||
render('ingress-daemon-set.yaml', manifest, context)
|
||||
|
Loading…
Reference in New Issue
Block a user