Trying to create a Domain Claim in a AKS Cluster using Knative API

39 views Asked by At

I am trying to create a domain mapping object in a kubernetes cluster, but before that I need to create a domain claim. So I'm making a request as per the documentations and when I debug it there are no errors in the code itself, every parameter is being returned correctly, so I can only assume the error lies within the request itself, it keeps coming back as Error 404:

def create_domain_claim(self, namespace: str, domain_name: str):
    uri = f"https://{self.api_server_url}/apis/serving.knative.dev/v1/namespaces/{namespace}/clusterdomainclaim"
    
    response = requests.post(
        uri,
        headers={"Authorization": f"Bearer {self.api_server_token}"},
        verify=False,
        json={
            "apiVersion": "networking.internal.knative.dev/v1alpha1",
            "kind": "ClusterDomainClaim",
            "metadata": {"name": domain_name},
            "spec": {"namespace": namespace},
        },
    )

    if response.status_code == 200:
        print("Domain Claim created successfully!")
    else:
        print(
            f"Failed to create Domain Claim. Status code: {response.status_code}"
        )
        print(response.text)

The namespace for now is "default", maybe that has something to do with it?

0

There are 0 answers