Skip to content

Commit

Permalink
Merge pull request Kuadrant#185 from pehala/fix_labels
Browse files Browse the repository at this point in the history
Update how labels are handles in OpenshiftObjects
  • Loading branch information
pehala authored Mar 23, 2023
2 parents bec7095 + e321db9 commit 3377e03
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
6 changes: 1 addition & 5 deletions testsuite/openshift/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,10 @@ def create_tls_secret(self, name: str, certificate: Certificate, labels: Optiona
model: Dict = {
"kind": "Secret",
"apiVersion": "v1",
"metadata": {
"name": name,
},
"metadata": {"name": name, "labels": labels},
"stringData": {"tls.crt": certificate.chain, "tls.key": certificate.key},
"type": "kubernetes.io/tls",
}
if labels is not None:
model["metadata"]["labels"] = labels

with self.context:
return oc.create(model, ["--save-config=true"])
Expand Down
5 changes: 1 addition & 4 deletions testsuite/openshift/objects/auth_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,10 @@ def create_instance(
model: Dict = {
"apiVersion": "authorino.kuadrant.io/v1beta1",
"kind": "AuthConfig",
"metadata": {"name": name, "namespace": openshift.project},
"metadata": {"name": name, "namespace": openshift.project, "labels": labels},
"spec": {"hosts": hostnames or route.hostnames},
}

if labels is not None:
model["metadata"]["labels"] = labels

return cls(model, context=openshift.context)

@modify
Expand Down
8 changes: 1 addition & 7 deletions testsuite/openshift/objects/auth_config/auth_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,12 @@ def create_instance( # type: ignore
model: Dict = {
"apiVersion": "kuadrant.io/v1beta1",
"kind": "AuthPolicy",
"metadata": {
"name": name,
"namespace": openshift.project,
},
"metadata": {"name": name, "namespace": openshift.project, "labels": labels},
"spec": {
"targetRef": route.reference,
},
}

if labels is not None:
model["metadata"]["labels"] = labels

return cls(model, context=openshift.context, route=route)

def add_host(self, hostname):
Expand Down
5 changes: 1 addition & 4 deletions testsuite/openshift/objects/gateway_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,14 @@ def create_instance(
model = {
"apiVersion": "gateway.networking.k8s.io/v1alpha2",
"kind": "HTTPRoute",
"metadata": {"name": name, "namespace": openshift.project},
"metadata": {"name": name, "namespace": openshift.project, "labels": labels},
"spec": {
"parentRefs": [parent.reference],
"hostnames": [hostname],
"rules": [{"backendRefs": [backend.reference]}],
},
}

if labels is not None:
model["metadata"]["labels"] = labels # type: ignore

return cls(model, context=openshift.context)

@property
Expand Down

0 comments on commit 3377e03

Please sign in to comment.