Skip to content

Commit

Permalink
Merge pull request kubewarden#867 from fabriziosestito/fix/tiltfile-w…
Browse files Browse the repository at this point in the history
…ebhooks

fix(Tiltfile): remove overriding helm webhooks with kustomize ones
  • Loading branch information
jvanz authored Sep 3, 2024
2 parents 3b49c48 + 01db755 commit 810f26e
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,6 @@ for role in roles:
if len(roles_rules_mapping["ClusterRole"]) == 0 or len(roles_rules_mapping["Role"]) == 0:
fail("Failed to load cluster and namespace roles")

# Get the webhook configuration with the latest values generated in the
# controller repository.
mutating_webhooks = []
validating_webhooks = []
webhooks_config = decode_yaml_stream(kustomize('config/webhook'))
for webhook_config in webhooks_config:
if webhook_config.get('kind') == 'MutatingWebhookConfiguration':
mutating_webhooks = webhook_config.get('webhooks')
for i in range(len(mutating_webhooks)):
mutating_webhooks[i]["clientConfig"]["service"]["name"] = "kubewarden-controller-webhook-service"
mutating_webhooks[i]["clientConfig"]["service"]["namespace"] = "kubewarden"
if webhook_config.get('kind') == 'ValidatingWebhookConfiguration':
validating_webhooks = webhook_config.get('webhooks')
for i in range(len(validating_webhooks)):
validating_webhooks[i]["clientConfig"]["service"]["name"] = "kubewarden-controller-webhook-service"
validating_webhooks[i]["clientConfig"]["service"]["namespace"] = "kubewarden"


# Install kubewarden-controller helm chart
install = helm(
settings.get('helm_charts_path') + '/charts/kubewarden-controller/',
Expand Down Expand Up @@ -87,13 +69,6 @@ for o in objects:
if o.get('kind') == 'Role' and o.get('metadata').get('name') == 'kubewarden-controller-leader-election-role':
o['rules'] = roles_rules_mapping["Role"]["leader-election-role"]

# Update the webhook configuration with the latest values generated in the
# controller repository. This useful when adding/updating webhooks.
if o.get('kind') == 'MutatingWebhookConfiguration':
o['webhooks'] = mutating_webhooks
if o.get('kind') == 'ValidatingWebhookConfiguration':
o['webhooks'] = validating_webhooks

updated_install = encode_yaml_stream(objects)
k8s_yaml(updated_install)

Expand Down

0 comments on commit 810f26e

Please sign in to comment.