Skip to content

Instantly share code, notes, and snippets.

@recalde
Last active January 13, 2025 14:44
Show Gist options
  • Save recalde/ecabbf29cb2b2d4a0d0c39f1b5ab0cd8 to your computer and use it in GitHub Desktop.
Save recalde/ecabbf29cb2b2d4a0d0c39f1b5ab0cd8 to your computer and use it in GitHub Desktop.
k8s model for OpenShift route
using k8s;
using k8s.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace OpenShiftModels
{
public class Route : IKubernetesObject<V1ObjectMeta>, ISpec<RouteSpec>
{
[JsonProperty("apiVersion")]
public string ApiVersion { get; set; }
[JsonProperty("kind")]
public string Kind { get; set; }
[JsonProperty("metadata")]
public V1ObjectMeta Metadata { get; set; }
[JsonProperty("spec")]
public RouteSpec Spec { get; set; }
[JsonProperty("status")]
public RouteStatus Status { get; set; }
}
public class RouteSpec
{
[JsonProperty("host")]
public string Host { get; set; }
[JsonProperty("path")]
public string Path { get; set; }
[JsonProperty("to")]
public RouteTarget To { get; set; }
[JsonProperty("tls")]
public RouteTLS TLS { get; set; }
}
public class RouteTarget
{
[JsonProperty("kind")]
public string Kind { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("weight")]
public int? Weight { get; set; }
}
public class RouteTLS
{
[JsonProperty("termination")]
public string Termination { get; set; }
[JsonProperty("insecureEdgeTerminationPolicy")]
public string InsecureEdgeTerminationPolicy { get; set; }
}
public class RouteStatus
{
[JsonProperty("ingress")]
public List<RouteIngress> Ingress { get; set; }
}
public class RouteIngress
{
[JsonProperty("host")]
public string Host { get; set; }
[JsonProperty("routerName")]
public string RouterName { get; set; }
[JsonProperty("conditions")]
public List<RouteCondition> Conditions { get; set; }
}
public class RouteCondition
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("lastTransitionTime")]
public string LastTransitionTime { get; set; }
}
}
using k8s;
using k8s.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace OpenShiftModels
{
public class RouteList : IKubernetesObject<V1ListMeta>, IItems<Route>
{
[JsonProperty("apiVersion")]
public string ApiVersion { get; set; }
[JsonProperty("kind")]
public string Kind { get; set; }
[JsonProperty("metadata")]
public V1ListMeta Metadata { get; set; }
[JsonProperty("items")]
public IList<Route> Items { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment