Skip to content

Commit

Permalink
api: Syncrhonize with latest API specification updates
Browse files Browse the repository at this point in the history
Following Azure#7
  • Loading branch information
Matthew Barnes committed Mar 7, 2024
1 parent 0d79474 commit a724cda
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 126 deletions.
91 changes: 49 additions & 42 deletions pkg/api/hcpopenshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,32 @@ type HCPOpenShiftCluster struct {

// HCPOpenShiftClusterProperties represents the property bag of a HCPOpenShiftCluster resource.
type HCPOpenShiftClusterProperties struct {
ProvisioningState arm.ProvisioningState `json:"provisioningState,omitempty" visibility:"read"`
ClusterProfile ClusterProfile `json:"clusterProfile,omitempty" visibility:"read,create,update"`
APIProfile APIProfile `json:"apiProfile,omitempty" visibility:"read,create"`
ConsoleProfile ConsoleProfile `json:"consoleProfile,omitempty" visibility:"read,create"`
IngressProfiles []IngressProfile `json:"ingressProfiles,omitempty" visibility:"read,create,update"`
NetworkProfile NetworkProfile `json:"networkProfile,omitempty" visibility:"read,create"`
NodePoolProfiles []NodePoolProfile `json:"nodePoolProfiles,omitempty" visibility:"read"`
EtcdEncryption EtcdEncryptionProfile `json:"etcdEncryption,omitempty" visibility:"read,create"`
AutoRepair bool `json:"autoRepair,omitempty" visibility:"read,create,update"`
Labels []string `json:"labels,omitempty" visibility:"read,create,update"`
OIDCIssuerURL json.URL `json:"oidcIssuerUrl,omitempty" visibility:"read"`
ProvisioningState arm.ProvisioningState `json:"provisioningState,omitempty" visibility:"read"`
ClusterProfile ClusterProfile `json:"clusterProfile,omitempty" visibility:"read,create,update"`
ProxyProfile ProxyProfile `json:"proxyProfile,omitempty" visibility:"read,create,update"`
APIProfile APIProfile `json:"apiProfile,omitempty" visibility:"read,create"`
ConsoleProfile ConsoleProfile `json:"consoleProfile,omitempty" visibility:"read,create,update"`
IngressProfile IngressProfile `json:"ingressProfile,omitempty" visibility:"read,create"`
NetworkProfile NetworkProfile `json:"networkProfile,omitempty" visibility:"read,create"`
NodePoolProfiles []NodePoolProfile `json:"nodePoolProfiles,omitempty" visibility:"read"`
EtcdEncryption EtcdEncryptionProfile `json:"etcdEncryption,omitempty" visibility:"read,create"`
}

// ClusterProfile represents a high level cluster configuration.
// Visibility for the entire struct is "read,create,update".
type ClusterProfile struct {
ControlPlaneVersion string `json:"controlPlaneVersion,omitempty"`
SubnetID string `json:"subnetId,omitempty"`
ControlPlaneVersion string `json:"controlPlaneVersion,omitempty" visibility:"read,create,update"`
SubnetID string `json:"subnetId,omitempty" visibility:"read,create"`
ManagedResourceGroup string `json:"managedResourceGroup,omitempty" visibility:"read,create"`
OIDCIssuerURL json.URL `json:"oidcIssuerUrl,omitempty" visibility:"read"`
}

// ProxyProfile represents the cluster proxy configuration.
// Visibility for the entire struct is "read,create,update".
type ProxyProfile struct {
HTTPProxy string `json:"httpProxy,omitempty"`
HTTPSProxy string `json:"httpsProxy,omitempty"`
NoProxy string `json:"noProxy,omitempty"`
TrustedCA string `json:"trustedCa,omitempty"`
}

type Visibility string
Expand All @@ -54,17 +62,16 @@ type APIProfile struct {
}

// ConsoleProfile represents a cluster web console configuration.
// Visibility for the entire struct is "read,create".
type ConsoleProfile struct {
URL json.URL `json:"url,omitempty"`
URL json.URL `json:"url,omitempty" visibility:"read"`
FIPS bool `json:"fips,omitempty" visibility:"read,create,update"`
}

// IngressProfile represents a cluster ingress configuration.
// Visibility for the entire struct is "read,create,update".
type IngressProfile struct {
IP net.IP `json:"ip,omitempty"`
Name string `json:"name,omitempty"`
Visibility Visibility `json:"visibility,omitempty"`
IP net.IP `json:"ip,omitempty" visibility:"read"`
URL json.URL `json:"url,omitempty" visibility:"read"`
Visibility Visibility `json:"visibility,omitempty" visibility:"read,create"`
}

// OutboundType represents a routing strategy to provide egress to the Internet.
Expand All @@ -74,25 +81,15 @@ const (
OutboundTypeLoadBalancer OutboundType = "loadBalancer"
)

// PreconfiguredNSGs represents whether to use a bring-your-own network security
// group (NSG) attached to the subnets.
// FIXME Maybe convert this to a boolean type with JSON marshal/unmarshal
// methods, even if the TypeSpec can't represent it as a boolean?
// Visibility for the entire struct is "read,create".
type PreconfiguredNSGs struct {
Enabled string `json:"enabled,omitempty"`
Disabled string `json:"disabled,omitempty"`
}

// NetworkProfile represents a cluster network configuration.
// Visibility for the entire struct is "read,create".
type NetworkProfile struct {
PodCIDR json.IPNet `json:"podCidr,omitempty"`
ServiceCIDR json.IPNet `json:"serviceCidr,omitempty"`
MachineCIDR json.IPNet `json:"machineCidr,omitempty"`
HostPrefix int32 `json:"hostPrefix,omitempty"`
OutboundType OutboundType `json:"outboundType,omitempty"`
PreconfiguredNSGs PreconfiguredNSGs `json:"preconfiguredNsgs,omitempty"`
PodCIDR json.IPNet `json:"podCidr,omitempty"`
ServiceCIDR json.IPNet `json:"serviceCidr,omitempty"`
MachineCIDR json.IPNet `json:"machineCidr,omitempty"`
HostPrefix int32 `json:"hostPrefix,omitempty"`
OutboundType OutboundType `json:"outboundType,omitempty"`
PreconfiguredNSGs bool `json:"preconfiguredNsgs,omitempty"`
}

// NodePoolAutoscaling represents a node pool autoscaling configuration.
Expand All @@ -105,12 +102,22 @@ type NodePoolAutoscaling struct {
// NodePoolProfile represents a worker node pool configuration.
// Visibility for the entire struct is "read".
type NodePoolProfile struct {
Name string `json:"name,omitempty"`
Replicas int32 `json:"replicas,omitempty"`
SubnetID string `json:"subnetId,omitempty"`
EncryptionAtHost bool `json:"encryptionAtHost,omitempty"`
VMSize string `json:"vmSize,omitempty"`
Autoscaling NodePoolAutoscaling `json:autoscaling,omitempty"`
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
Labels []string `json:"labels,omitempty"`
Taints []string `json:"taints,omitempty"`
DiskSize int32 `json:"diskSize,omitempty"`
EphemeralOSDisk bool `json:"ephemeralOsDisk,omitempty"`
Replicas int32 `json:"replicas,omitempty"`
SubnetID string `json:"subnetId,omitempty"`
EncryptionAtHost bool `json:"encryptionAtHost,omitempty"`
AutoRepair bool `json:"autoRepair,omitempty"`
DiscEncryptionSetID string `json:"discEncryptionSetId,omitempty"`
TuningConfigs []string `json:"tuningConfigs,omitempty"`
AvailabilityZone string `json:"availabilityZone,omitempty"`
DiscStorageAccountType string `json:"discStorageAccountType,omitempty"`
VMSize string `json:"vmSize,omitempty"`
Autoscaling NodePoolAutoscaling `json:"autoscaling,omitempty"`
}

// EtcdEncryptionProfile represents the configuration needed for customer
Expand Down
91 changes: 49 additions & 42 deletions pkg/api/v20240610preview/hcpopenshiftcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,32 @@ type HCPOpenShiftCluster struct {

// HCPOpenShiftClusterProperties represents the property bag of a HCPOpenShiftCluster resource.
type HCPOpenShiftClusterProperties struct {
ProvisioningState arm.ProvisioningState `json:"provisioningState,omitempty" visibility:"read"`
ClusterProfile ClusterProfile `json:"clusterProfile,omitempty" visibility:"read,create,update"`
APIProfile APIProfile `json:"apiProfile,omitempty" visibility:"read,create"`
ConsoleProfile ConsoleProfile `json:"consoleProfile,omitempty" visibility:"read,create"`
IngressProfiles []IngressProfile `json:"ingressProfiles,omitempty" visibility:"read,create,update"`
NetworkProfile NetworkProfile `json:"networkProfile,omitempty" visibility:"read,create"`
NodePoolProfiles []NodePoolProfile `json:"nodePoolProfiles,omitempty" visibility:"read"`
EtcdEncryption EtcdEncryptionProfile `json:"etcdEncryption,omitempty" visibility:"read,create"`
AutoRepair bool `json:"autoRepair,omitempty" visibility:"read,create,update"`
Labels []string `json:"labels,omitempty" visibility:"read,create,update"`
OIDCIssuerURL json.URL `json:"oidcIssuerUrl,omitempty" visibility:"read"`
ProvisioningState arm.ProvisioningState `json:"provisioningState,omitempty" visibility:"read"`
ClusterProfile ClusterProfile `json:"clusterProfile,omitempty" visibility:"read,create,update"`
ProxyProfile ProxyProfile `json:"proxyProfile,omitempty" visibility:"read,create,update"`
APIProfile APIProfile `json:"apiProfile,omitempty" visibility:"read,create"`
ConsoleProfile ConsoleProfile `json:"consoleProfile,omitempty" visibility:"read,create,update"`
IngressProfile IngressProfile `json:"ingressProfile,omitempty" visibility:"read,create"`
NetworkProfile NetworkProfile `json:"networkProfile,omitempty" visibility:"read,create"`
NodePoolProfiles []NodePoolProfile `json:"nodePoolProfiles,omitempty" visibility:"read"`
EtcdEncryption EtcdEncryptionProfile `json:"etcdEncryption,omitempty" visibility:"read,create"`
}

// ClusterProfile represents a high level cluster configuration.
// Visibility for the entire struct is "read,create,update".
type ClusterProfile struct {
ControlPlaneVersion string `json:"controlPlaneVersion,omitempty"`
SubnetID string `json:"subnetId,omitempty"`
ControlPlaneVersion string `json:"controlPlaneVersion,omitempty" visibility:"read,create,update"`
SubnetID string `json:"subnetId,omitempty" visibility:"read,create"`
ManagedResourceGroup string `json:"managedResourceGroup,omitempty" visibility:"read,create"`
OIDCIssuerURL json.URL `json:"oidcIssuerUrl,omitempty" visibility:"read"`
}

// ProxyProfile represents the cluster proxy configuration.
// Visibility for the entire struct is "read,create,update".
type ProxyProfile struct {
HTTPProxy string `json:"httpProxy,omitempty"`
HTTPSProxy string `json:"httpsProxy,omitempty"`
NoProxy string `json:"noProxy,omitempty"`
TrustedCA string `json:"trustedCa,omitempty"`
}

type Visibility string
Expand All @@ -54,17 +62,16 @@ type APIProfile struct {
}

// ConsoleProfile represents a cluster web console configuration.
// Visibility for the entire struct is "read,create".
type ConsoleProfile struct {
URL json.URL `json:"url,omitempty"`
URL json.URL `json:"url,omitempty" visibility:"read"`
FIPS bool `json:"fips,omitempty" visibility:"read,create,update"`
}

// IngressProfile represents a cluster ingress configuration.
// Visibility for the entire struct is "read,create,update".
type IngressProfile struct {
IP net.IP `json:"ip,omitempty"`
Name string `json:"name,omitempty"`
Visibility Visibility `json:"visibility,omitempty"`
IP net.IP `json:"ip,omitempty" visibility:"read"`
URL json.URL `json:"url,omitempty" visibility:"read"`
Visibility Visibility `json:"visibility,omitempty" visibility:"read,create"`
}

// OutboundType represents a routing strategy to provide egress to the Internet.
Expand All @@ -74,25 +81,15 @@ const (
OutboundTypeLoadBalancer OutboundType = "loadBalancer"
)

// PreconfiguredNSGs represents whether to use a bring-your-own network security
// group (NSG) attached to the subnets.
// FIXME Maybe convert this to a boolean type with JSON marshal/unmarshal
// methods, even if the TypeSpec can't represent it as a boolean?
// Visibility for the entire struct is "read,create".
type PreconfiguredNSGs struct {
Enabled string `json:"enabled,omitempty"`
Disabled string `json:"disabled,omitempty"`
}

// NetworkProfile represents a cluster network configuration.
// Visibility for the entire struct is "read,create".
type NetworkProfile struct {
PodCIDR json.IPNet `json:"podCidr,omitempty"`
ServiceCIDR json.IPNet `json:"serviceCidr,omitempty"`
MachineCIDR json.IPNet `json:"machineCidr,omitempty"`
HostPrefix int32 `json:"hostPrefix,omitempty"`
OutboundType OutboundType `json:"outBoundType,omitempty"`
PreconfiguredNSGs PreconfiguredNSGs `json:"preconfiguredNsgs,omitempty"`
PodCIDR json.IPNet `json:"podCidr,omitempty"`
ServiceCIDR json.IPNet `json:"serviceCidr,omitempty"`
MachineCIDR json.IPNet `json:"machineCidr,omitempty"`
HostPrefix int32 `json:"hostPrefix,omitempty"`
OutboundType OutboundType `json:"outboundType,omitempty"`
PreconfiguredNSGs bool `json:"preconfiguredNsgs,omitempty"`
}

// NodePoolAutoscaling represents a node pool autoscaling configuration.
Expand All @@ -105,12 +102,22 @@ type NodePoolAutoscaling struct {
// NodePoolProfile represents a worker node pool configuration.
// Visibility for the entire struct is "read".
type NodePoolProfile struct {
Name string `json:"name,omitempty"`
Replicas int32 `json:"replicas,omitempty"`
SubnetID string `json:"subnetId,omitempty"`
EncryptionAtHost bool `json:"encryptionAtHost,omitempty"`
VMSize string `json:"vmSize,omitempty"`
Autoscaling NodePoolAutoscaling `json:"autoscaling,omitempty"`
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
Labels []string `json:"labels,omitempty"`
Taints []string `json:"taints,omitempty"`
DiskSize int32 `json:"diskSize,omitempty"`
EphemeralOSDisk bool `json:"ephemeralOsDisk,omitempty"`
Replicas int32 `json:"replicas,omitempty"`
SubnetID string `json:"subnetId,omitempty"`
EncryptionAtHost bool `json:"encryptionAtHost,omitempty"`
AutoRepair bool `json:"autoRepair,omitempty"`
DiscEncryptionSetID string `json:"discEncryptionSetId,omitempty"`
TuningConfigs []string `json:"tuningConfigs,omitempty"`
AvailabilityZone string `json:"availabilityZone,omitempty"`
DiscStorageAccountType string `json:"discStorageAccountType,omitempty"`
VMSize string `json:"vmSize,omitempty"`
Autoscaling NodePoolAutoscaling `json:"autoscaling,omitempty"`
}

// EtcdEncryptionProfile represents the configuration needed for customer
Expand Down
Loading

0 comments on commit a724cda

Please sign in to comment.