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

allow ownership job to fail #1201

Merged
merged 2 commits into from
Mar 15, 2023
Merged

allow ownership job to fail #1201

merged 2 commits into from
Mar 15, 2023

Conversation

mcbenjemaa
Copy link
Contributor

@mcbenjemaa mcbenjemaa commented Mar 15, 2023

The job also patch the Alertmanager resource to removes the label managed-by: pmo
from alertmanagerConfigSelector.

If the field doesn't has the label, the job will fail. so deployment will be stuck

@mcbenjemaa mcbenjemaa requested a review from a team as a code owner March 15, 2023 14:04
@mcbenjemaa mcbenjemaa self-assigned this Mar 15, 2023
@@ -39,6 +39,6 @@ spec:
name=$(kubectl get chart --namespace=giantswarm -l app.kubernetes.io/name=prometheus-meta-operator --output=jsonpath="{.items[0].spec.name}")
namespace=$(kubectl get chart --namespace=giantswarm -l app.kubernetes.io/name=prometheus-meta-operator --output=jsonpath="{.items[0].spec.namespace}")
kubectl patch --type=merge --record=false -p '{"metadata":{"annotations":{"meta.helm.sh/release-name": "'"${name}"'","meta.helm.sh/release-namespace": "'"${namespace}"'"},"labels":{"app.kubernetes.io/managed-by": "Helm"}}}' -n "${namespace}" alertmanager alertmanager
kubectl patch --record=false -n "${namespace}" --type json --patch '[{ "op": "remove", "path": "/spec/alertmanagerConfigSelector/matchLabels/app.kubernetes.io~1managed-by", "value": "prometheus-meta-operator" }]' alertmanager alertmanager
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you not check if the field exist instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will require either jq or yq

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you think it's installed in giantswarm/docker-kubect ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I honestly have no idea but I think the script would be more proper because this basically ignores this step even if it fails for other reasons

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you not use grep though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How is it now?

Copy link
Contributor

@QuentinBisson QuentinBisson left a comment

Choose a reason for hiding this comment

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

LGTM if tested

@mcbenjemaa mcbenjemaa merged commit 4cdd5a2 into master Mar 15, 2023
@mcbenjemaa mcbenjemaa deleted the ownership-job branch March 15, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants