github.com/verrazzano/verrazzano@v1.7.1/tests/e2e/clusterapi/oke-capi-driver/structs.go (about) 1 // Copyright (c) 2023, Oracle and/or its affiliates. 2 // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 3 4 package okecapidriver 5 6 import ( 7 "github.com/Masterminds/semver/v3" 8 "time" 9 ) 10 11 // Used for filling the body of the API request to create the cloud credential 12 type RancherCloudCred struct { 13 Type string `json:"type"` 14 Metadata struct { 15 GenerateName string `json:"generateName"` 16 Namespace string `json:"namespace"` 17 } `json:"metadata"` 18 InternalName string `json:"_name"` 19 Annotations struct { 20 ProvisioningCattleIoDriver string `json:"provisioning.cattle.io/driver"` 21 } `json:"annotations"` 22 RancherOcicredentialConfig `json:"ocicredentialConfig"` 23 InternalType string `json:"_type"` 24 Name string `json:"name"` 25 } 26 type RancherOcicredentialConfig struct { 27 Fingerprint string `json:"fingerprint"` 28 PrivateKeyContents string `json:"privateKeyContents"` 29 Region string `json:"region"` 30 TenancyID string `json:"tenancyId"` 31 UserID string `json:"userId"` 32 } 33 34 // Used for filling the body of the API request to create/update the OKE cluster 35 type RancherOKECluster struct { 36 DockerRootDir string `json:"dockerRootDir"` 37 EnableClusterAlerting bool `json:"enableClusterAlerting"` 38 EnableClusterMonitoring bool `json:"enableClusterMonitoring"` 39 EnableNetworkPolicy bool `json:"enableNetworkPolicy"` 40 WindowsPreferedCluster bool `json:"windowsPreferedCluster"` 41 Type string `json:"type"` 42 Name string `json:"name"` 43 Description string `json:"description"` 44 OKECAPIEngineConfig RancherOKECAPIEngine `json:"okecapiEngineConfig"` 45 CloudCredentialID string `json:"cloudCredentialId"` 46 Labels struct { 47 } `json:"labels"` 48 } 49 type RancherOKECAPIEngine struct { 50 CloudCredentialID string `json:"cloudCredentialId"` 51 ClusterCidr string `json:"clusterCidr"` 52 CompartmentID string `json:"compartmentId"` 53 ControlPlaneSubnet string `json:"controlPlaneSubnet"` 54 DisplayName string `json:"displayName"` 55 DriverName string `json:"driverName"` 56 ImageDisplayName string `json:"imageDisplayName"` 57 ImageID string `json:"imageId"` 58 KubernetesVersion string `json:"kubernetesVersion"` 59 LoadBalancerSubnet string `json:"loadBalancerSubnet"` 60 Name string `json:"name"` 61 NodePublicKeyContents string `json:"nodePublicKeyContents"` 62 PodCidr string `json:"podCidr"` 63 Region string `json:"region"` 64 VcnID string `json:"vcnId"` 65 WorkerNodeSubnet string `json:"workerNodeSubnet"` 66 Type string `json:"type"` 67 NodeShape string `json:"nodeShape"` 68 NodePools []string `json:"nodePools"` 69 ApplyYamls []string `json:"applyYamls"` 70 InstallVerrazzano bool `json:"installVerrazzano"` 71 } 72 73 // Fills in values of this RancherOKECluster object according to the values taken from environment variables. 74 // Other fields of the struct that are not filled by environment variables are not filled in. 75 func (roc *RancherOKECluster) fillCommonValues() { 76 roc.OKECAPIEngineConfig.ClusterCidr = clusterCidr 77 roc.OKECAPIEngineConfig.DriverName = "okecapi" 78 roc.OKECAPIEngineConfig.ImageDisplayName = imageDisplayName 79 roc.OKECAPIEngineConfig.ImageID = imageID 80 roc.OKECAPIEngineConfig.KubernetesVersion = kubernetesVersion 81 roc.OKECAPIEngineConfig.Name = "" 82 roc.OKECAPIEngineConfig.PodCidr = podCidr 83 roc.OKECAPIEngineConfig.Region = region 84 roc.OKECAPIEngineConfig.Type = "okecapiEngineConfig" 85 roc.OKECAPIEngineConfig.NodeShape = nodeShape 86 roc.OKECAPIEngineConfig.CompartmentID = compartmentID 87 roc.OKECAPIEngineConfig.ControlPlaneSubnet = controlPlaneSubnet 88 roc.OKECAPIEngineConfig.LoadBalancerSubnet = loadBalancerSubnet 89 roc.OKECAPIEngineConfig.Region = region 90 roc.OKECAPIEngineConfig.VcnID = vcnID 91 roc.OKECAPIEngineConfig.WorkerNodeSubnet = workerNodeSubnet 92 if applyYAMLs == "" { 93 roc.OKECAPIEngineConfig.ApplyYamls = []string{} 94 } else { 95 roc.OKECAPIEngineConfig.ApplyYamls = []string{applyYAMLs} 96 } 97 roc.OKECAPIEngineConfig.InstallVerrazzano = installVerrazzano 98 99 roc.DockerRootDir = dockerRootDir 100 roc.EnableClusterAlerting = enableClusterAlerting 101 roc.EnableClusterMonitoring = enableClusterMonitoring 102 roc.EnableNetworkPolicy = enableNetworkPolicy 103 roc.WindowsPreferedCluster = windowsPreferedCluster 104 roc.Type = "cluster" 105 roc.Labels = struct{}{} 106 } 107 108 // Represents the clusters.provisioning.cattle.io object 109 type ProvisioningCluster struct { 110 APIVersion string `json:"apiVersion"` 111 Kind string `json:"kind"` 112 Metadata struct { 113 Annotations struct { 114 FieldCattleIoCreatorID string `json:"field.cattle.io/creatorId"` 115 ObjectsetRioCattleIoApplied string `json:"objectset.rio.cattle.io/applied"` 116 ObjectsetRioCattleIoID string `json:"objectset.rio.cattle.io/id"` 117 ObjectsetRioCattleIoOwnerGvk string `json:"objectset.rio.cattle.io/owner-gvk"` 118 ObjectsetRioCattleIoOwnerName string `json:"objectset.rio.cattle.io/owner-name"` 119 ObjectsetRioCattleIoOwnerNamespace string `json:"objectset.rio.cattle.io/owner-namespace"` 120 } `json:"annotations"` 121 CreationTimestamp time.Time `json:"creationTimestamp"` 122 Finalizers []string `json:"finalizers"` 123 Generation int `json:"generation"` 124 Labels struct { 125 ObjectsetRioCattleIoHash string `json:"objectset.rio.cattle.io/hash"` 126 } `json:"labels"` 127 Name string `json:"name"` 128 Namespace string `json:"namespace"` 129 ResourceVersion string `json:"resourceVersion"` 130 UID string `json:"uid"` 131 } `json:"metadata"` 132 Spec struct { 133 LocalClusterAuthEndpoint struct { 134 } `json:"localClusterAuthEndpoint"` 135 } `json:"spec"` 136 Status struct { 137 AgentDeployed bool `json:"agentDeployed"` 138 ClientSecretName string `json:"clientSecretName"` 139 ClusterName string `json:"clusterName"` 140 Conditions []struct { 141 Status string `json:"status"` 142 Type string `json:"type"` 143 LastUpdateTime time.Time `json:"lastUpdateTime,omitempty"` 144 } `json:"conditions"` 145 ObservedGeneration int `json:"observedGeneration"` 146 Ready bool `json:"ready"` 147 } `json:"status"` 148 } 149 150 type OKEMetadataItem struct { 151 KubernetesVersion *semver.Version 152 }