ibmcloud: add ibm cloud types support the new ibm cloud platform by adding required types ibmcloud: add initial assets Add ibmcloud assets to support the new ibmcloud platform. These changes are functional, but additional functionality will be built out over time ibmcloud: resolve linting issues ibmcloud: obtain the cisInstanceCRN for install-config The cisInstanceCRN field is derived from the user-provided baseDomain. It is needed for all DNS configuration. types: fix ibmcloud machinepool file name ibmcloud: rename platform ResourceGroupID field Rename the field `ResourceGroupID` in the Platform type to `ResourceGroup` ibmcloud: add initial metadata ibmcloud: add ClusterOSImage customization The ClusterOSImage field will allow the user to specify the custom RHCOS image to use for their cluster VSIs ibmcloud: add fields to Platform type Add the DefaultMachinePlatform, VPC, VPCResourceGroup, and Subnets fields to the Platform type. These are needed to fully define a cluster. ibmcloud: improve platform validation and tests Add in additional validation to the ibmcloud Platform. Also, add unit tests around that new validation. This is just a start and more validation and unit tests are required. ibmcloud: fix linting issues These issues were discovered using golangci-lint ibmcloud: use resource group name in install config Use the resource group name instead of ID in the install config. This will be more human friendly. The ID will also still be valid, but name will be preferred. ibmcloud: improve default resource group check Check for the default resource group based off of the 'default' field in the resource group struct. ibmcloud: fix typo ibmcloud: remove vpcResourceGroup and use vpc ID vpcResourceGroup is no longer needed if the vpc field holds the ID of the VPC instead of the name. ibmcloud: enforce clusterOSImage region The clusterOSImage refers to a custom image in a user's VPC. That image is regionally scoped and the region should be honored. Users should not be allowed to pick a custom image from a region that differes from the value of the region field in the install config. ibmcloud: use resourcev2 API The resourcev2 API should be used in place of v1. This is the most up-to-date and well supported version. ibmcloud: fix log message Co-Authored-By: Hidematsu Sueki <Hidematsu.Sueki@ibm.com> ibmcloud: add machinepool type and validation Add the MachinePool type for the IBM Cloud platform. Also include initial validation on the fields. ibmcloud: update survey version ibmcloud: use ibm go sdks instead of bluemix-go The ibm-go-sdk and corresponding service SDKs in the IBM GH org are more up-to-date and routinely supported. The old bluemix-go SDKs should no longer be used. update go mod update vendor fix: make validateVPCConfig a private function Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: improve log message for resource group not found Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: simplify subnet return statement Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: improve log message for vpc not found Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: images slice declaration Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: improve images range loop Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: typo in baseDomain help string Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: clarify resource group help message fix: use platformPath as variable name Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: ibmcloud platform reference Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: remove unnecessary conditionals in validation fix: check encryptionKey exists before validation fix: improve zone validation message Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: keep errors out of happy path fix: add index to subnets validation fix: create VPCResourceNotFoundError fix: use sets.String for contains fix: ibmcloud platform type comments fix: improve vpc config validation messages fix: add omitempty for encryptionKey Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: improve BootVolume copying Co-authored-by: Matthew Staebler <staebler@redhat.com> fix: rename MachinePool.Type to InstanceType fix: remove validateRegion fix: remove unnecessary context from client fix: remove context timeout in ic Platform fix: remove superfluous edit fix: update unit tests fix: move types used by cilent to same package fix: update OWNERS and OWNERS_ALIASES fix: improve client call to load services fix: improve GetZoneIDByName range loop fix: whitepsace in OWNERS fix: populate ibmcloud OWNERS_ALIASES fix: make cisServiceID a const Co-authored-by: Matthew Staebler <staebler@redhat.com> ibmcloud: refactor resource groups Allow users to have VPC resources in a different resource group from the cluster creation. This will enable CI and E2E testing along with making it easier to destroy clusters. This commit also adds a "Name" suffix to resource groups to align with other platforms naming convention. fix: error message format fix: update unit test ibmcloud: move ibmcloud to hidden platforms The IBMCloud platform will be in a developer preview for 4.9. As a result we will move it to the list of hidden platforms. This commit does that by default, but allows for it to show up in the survey via a build flag: 'ibmcloud'. ibmcloud: remove cisInstanceCRN field The cisInstanceCRN platform field is not needed. Though it is possible to manage a single DNS zone with multiple CIS instances, only one zone can be in the "Active" state at a time. As a result, we know which CIS instance to use based off of its managed zone's state. fix: address pr comments update codegen
Universally Unique Lexicographically Sortable Identifier
A Go port of alizain/ulid with binary format implemented.
Background
A GUID/UUID can be suboptimal for many use-cases because:
- It isn't the most character efficient way of encoding 128 bits
- UUID v1/v2 is impractical in many environments, as it requires access to a unique, stable MAC address
- UUID v3/v5 requires a unique seed and produces randomly distributed IDs, which can cause fragmentation in many data structures
- UUID v4 provides no other information than randomness which can cause fragmentation in many data structures
A ULID however:
- Is compatible with UUID/GUID's
- 1.21e+24 unique ULIDs per millisecond (1,208,925,819,614,629,174,706,176 to be exact)
- Lexicographically sortable
- Canonically encoded as a 26 character string, as opposed to the 36 character UUID
- Uses Crockford's base32 for better efficiency and readability (5 bits per character)
- Case insensitive
- No special characters (URL safe)
- Monotonic sort order (correctly detects and handles the same millisecond)
Install
go get github.com/oklog/ulid
Usage
An ULID is constructed with a time.Time and an io.Reader entropy source.
This design allows for greater flexibility in choosing your trade-offs.
Please note that rand.Rand from the math package is not safe for concurrent use.
Instantiate one per long living go-routine or use a sync.Pool if you want to avoid the potential contention of a locked rand.Source as its been frequently observed in the package level functions.
func ExampleULID() {
t := time.Unix(1000000, 0)
entropy := ulid.Monotonic(rand.New(rand.NewSource(t.UnixNano())), 0)
fmt.Println(ulid.MustNew(ulid.Timestamp(t), entropy))
// Output: 0000XSNJG0MQJHBF4QX1EFD6Y3
}
Specification
Below is the current specification of ULID as implemented in this repository.
Components
Timestamp
- 48 bits
- UNIX-time in milliseconds
- Won't run out of space till the year 10895 AD
Entropy
- 80 bits
- User defined entropy source.
- Monotonicity within the same millisecond with
ulid.Monotonic
Encoding
Crockford's Base32 is used as shown. This alphabet excludes the letters I, L, O, and U to avoid confusion and abuse.
0123456789ABCDEFGHJKMNPQRSTVWXYZ
Binary Layout and Byte Order
The components are encoded as 16 octets. Each component is encoded with the Most Significant Byte first (network byte order).
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 32_bit_uint_time_high |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 16_bit_uint_time_low | 16_bit_uint_random |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 32_bit_uint_random |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 32_bit_uint_random |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
String Representation
01AN4Z07BY 79KA1307SR9X4MV3
|----------| |----------------|
Timestamp Entropy
10 chars 16 chars
48bits 80bits
base32 base32
Test
go test ./...
Benchmarks
On a Intel Core i7 Ivy Bridge 2.7 GHz, MacOS 10.12.1 and Go 1.8.0beta1
BenchmarkNew/WithCryptoEntropy-8 2000000 771 ns/op 20.73 MB/s 16 B/op 1 allocs/op
BenchmarkNew/WithEntropy-8 20000000 65.8 ns/op 243.01 MB/s 16 B/op 1 allocs/op
BenchmarkNew/WithoutEntropy-8 50000000 30.0 ns/op 534.06 MB/s 16 B/op 1 allocs/op
BenchmarkMustNew/WithCryptoEntropy-8 2000000 781 ns/op 20.48 MB/s 16 B/op 1 allocs/op
BenchmarkMustNew/WithEntropy-8 20000000 70.0 ns/op 228.51 MB/s 16 B/op 1 allocs/op
BenchmarkMustNew/WithoutEntropy-8 50000000 34.6 ns/op 462.98 MB/s 16 B/op 1 allocs/op
BenchmarkParse-8 50000000 30.0 ns/op 866.16 MB/s 0 B/op 0 allocs/op
BenchmarkMustParse-8 50000000 35.2 ns/op 738.94 MB/s 0 B/op 0 allocs/op
BenchmarkString-8 20000000 64.9 ns/op 246.40 MB/s 32 B/op 1 allocs/op
BenchmarkMarshal/Text-8 20000000 55.8 ns/op 286.84 MB/s 32 B/op 1 allocs/op
BenchmarkMarshal/TextTo-8 100000000 22.4 ns/op 714.91 MB/s 0 B/op 0 allocs/op
BenchmarkMarshal/Binary-8 300000000 4.02 ns/op 3981.77 MB/s 0 B/op 0 allocs/op
BenchmarkMarshal/BinaryTo-8 2000000000 1.18 ns/op 13551.75 MB/s 0 B/op 0 allocs/op
BenchmarkUnmarshal/Text-8 100000000 20.5 ns/op 1265.27 MB/s 0 B/op 0 allocs/op
BenchmarkUnmarshal/Binary-8 300000000 4.94 ns/op 3240.01 MB/s 0 B/op 0 allocs/op
BenchmarkNow-8 100000000 15.1 ns/op 528.09 MB/s 0 B/op 0 allocs/op
BenchmarkTimestamp-8 2000000000 0.29 ns/op 27271.59 MB/s 0 B/op 0 allocs/op
BenchmarkTime-8 2000000000 0.58 ns/op 13717.80 MB/s 0 B/op 0 allocs/op
BenchmarkSetTime-8 2000000000 0.89 ns/op 9023.95 MB/s 0 B/op 0 allocs/op
BenchmarkEntropy-8 200000000 7.62 ns/op 1311.66 MB/s 0 B/op 0 allocs/op
BenchmarkSetEntropy-8 2000000000 0.88 ns/op 11376.54 MB/s 0 B/op 0 allocs/op
BenchmarkCompare-8 200000000 7.34 ns/op 4359.23 MB/s 0 B/op 0 allocs/op
