jx installation failing on existing AKS cluster

Created on 28 Jan 2019  路  8Comments  路  Source: jenkins-x/jx

Summary

jx install --provider aks fails on existing AKS cluster

Steps to reproduce the behavior

az aks create with RBAC, http app routing. az get-credentials and then jx install --provider aks

Expected behavior

jx installs successfully

Actual behavior

Failing with ACR error:

Saving the Git authentication configuration
Failed to create ACR edp-cluster in resource group k8s-managed
error: configuring the docker registry: configure cloud provider docker registry: getting registry configuration from Azure: failed to run 'az acr create -g k8s-managed -n ***-cluster --sku Standard --admin-enabled --query id -o tsv' command in directory '', output: 'ERROR: Parameter 'registry_name' must conform to the following pattern: '^[a-zA-Z0-9]*$'.
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in execute
    raise ex
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 388, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 381, in _run_job
    six.reraise(*sys.exc_info())
  File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 357, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 171, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 442, in default_command_handler
    return op(**command_args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/acr/custom.py", line 103, in acr_create
    return client.create(resource_group_name, registry_name, registry)
  File "/opt/az/lib/python3.6/site-packages/azure/mgmt/containerregistry/v2018_09_01/operations/registries_operations.py", line 351, in create
    **operation_config
  File "/opt/az/lib/python3.6/site-packages/azure/mgmt/containerregistry/v2018_09_01/operations/registries_operations.py", line 276, in _create_initial
    'registryName': self._serialize.url("registry_name", registry_name, 'str', max_length=50, min_length=5, pattern=r'^[a-zA-Z0-9]*$')
  File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 592, in url
    data = self.validate(data, name, required=True, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/msrest/serialization.py", line 672, in validate
    raise ValidationError(key, name, value)
msrest.exceptions.ValidationError: Parameter 'registry_name' must conform to the following pattern: '^[a-zA-Z0-9]*$'.'

Jx version

$ jx version

NAME               VERSION
jx                 1.3.809
Kubernetes cluster v1.11.5
kubectl            v1.13.1
helm client        v2.12.1+g02a47c7
helm server        v2.12.1+g02a47c7
git                git version 2.17.1
Operating System   Ubuntu 18.04.1 LTS

Jenkins type

  • [x] Classic Jenkins
  • [ ] Serverless Jenkins

Kubernetes cluster

AKS cluster
Kubernetes cluster v1.11.5
kubectl v1.13.1
helm client v2.12.1+g02a47c7
helm server v2.12.1+g02a47c7

Operating system / Environment

Windows 10 / WSL Ubuntu 18.04 LTS

areaks arejenkins kinbug lifecyclstale prioritimportant-longterm

Most helpful comment

@elluvium JX tries to create an ACR with the same name as your AKS. For a workaround, you can create an ACR yourself, and set the --docker-registry <registry>.azurecr.io

All 8 comments

@elluvium Did you create the registry manually, or is created by jx? It looks that its name is not conform with Azure naming conversion.
msrest.exceptions.ValidationError: Parameter 'registry_name' must conform to the following pattern: '^[a-zA-Z0-9]*$'.'

@ccojocar I didn't create a registry beforehand. Jx tries to create it by itself

@elluvium JX tries to create an ACR with the same name as your AKS. For a workaround, you can create an ACR yourself, and set the --docker-registry <registry>.azurecr.io

Hi, just to add in, same here. my AKS name format is "dev-cluster" and I get the same issue.
Your workaround of the following is good though:
jx install --provider aks --docker-registry=nameofacr.azurecr.io

Currently I have no Go environment to test the code. Take the following if anyone wants to apply the fix.

The fix should be at this line to acrName = normalize(name), the normalize function should

https://github.com/jenkins-x/jx/blob/09f5bc49c813ed2a348434cad32bd0e9645136ab/pkg/cloud/aks/aks.go#L111

/area jenkins

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Provide feedback via https://jenkins-x.io/community.
/lifecycle stale

Hi @elluvium, We are closing this issue because static Jenkins masters have been deprecated and removed from Jenkins X in favor of focusing on Tekton pipelines.

This blog has more information as to the reasons why: https://jenkins-x.io/blog/2020/03/11/tekton/

If you鈥檇 like to discuss this in more detail, please join our Jenkins X channels in the Kubernetes Slack and tag any of our product leadership (Deane Smith, Viktor Farcic, Ethan Jones, Dave Conde, James Rawlings, James Strachan) and we鈥檇 be happy to discuss further.

If this is a surprise to you, consider joining the Jenkins X newsletter and other community channels to make sure that important notices like this always make it to you: https://jenkins-x.io/community/ https://jenkins-x.io/community/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tdcox picture tdcox  路  3Comments

igdianov picture igdianov  路  3Comments

rudolph9 picture rudolph9  路  3Comments

CobraFlow picture CobraFlow  路  5Comments

SmartassSkeleton picture SmartassSkeleton  路  4Comments