Skip to content

Instantly share code, notes, and snippets.

@pweil-
Created June 21, 2018 13:54
Show Gist options
  • Save pweil-/c96685a79cec2d93c20cd3cd3f00fc04 to your computer and use it in GitHub Desktop.
Save pweil-/c96685a79cec2d93c20cd3cd3f00fc04 to your computer and use it in GitHub Desktop.
// OpenShiftManagedCluster represents an OpenShift cluster with an
// agent only node model and a hosted control plane.
type ManagedOpenShiftCluster struct {
ID string `json:"id,omitempty"`
Location string `json:"location,omitempty" validate:"required"`
Name string `json:"name,omitempty"`
Plan *ResourcePurchasePlan `json:"plan,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Type string `json:"type,omitempty"`
// TODO: properties is where we start seeing Kube specific items. In order
// to share we don't necessarily have to factor them out. The top level
// OpenShiftManagedCluster tells us we never even have to consider them but it
// would be cleaner if we did.
//
// Two proposals:
// 1. Use Properties, call "KubernetesVersion" "Version", try to reuse as much as possible
Properties *Properties `json:"properties"`
// 2. Create OpenShiftClusterSpec. Reuse items at a lower level where
// possible.
Spec OpenShiftClusterSpec
Status OpenShiftClusterStatus
}
// OpenShiftConfig represents configuration necessary to realize an OpenShift cluster.
type OpenShiftClusterSpec struct {
// shared
DNSPrefix string `json:"dnsPrefix" validate:"required"`
FQDN string `json:"fqdn,omitempty"`
AgentPoolProfiles []*AgentPoolProfile `json:"agentPoolProfiles,omitempty" validate:"dive,required"`
ServicePrincipalProfile *ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"`
// OpenShift specific
Version string `json:"version"`
RoutingSubdomain string `json:"routingSubdomain" validate:"required"`
// ...etc...
}
type OpenShiftClusterStatus struct {
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
// Conditions includes more detailed status for the cluster
// https://github.com/openshift/cluster-operator/blob/e4514c67c1a60224672c36dcee1d88dca009206f/pkg/apis/clusteroperator/types.go#L419
}
// ManagedCluster complies with the ARM model of
// resource definition in a JSON template.
type ManagedCluster struct {
ID string `json:"id,omitempty"`
Location string `json:"location,omitempty" validate:"required"`
Name string `json:"name,omitempty"`
Plan *ResourcePurchasePlan `json:"plan,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Type string `json:"type,omitempty"`
Properties *Properties `json:"properties"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment