utils

package
v0.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright 2021 The k8gb Contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic

Copyright 2021 The k8gb Contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic

Copyright 2021 The k8gb Contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic

Copyright 2021 The k8gb Contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic

Copyright 2021 The k8gb Contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic

Copyright 2021 The k8gb Contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic

Copyright 2021 The k8gb Contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Generated by GoLic, for more details see: https://github.com/AbsaOSS/golic

Package utils implements common, reusable helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dig

func Dig(fqdn string, edgeDNSServers ...DNSServer) (ips []string, err error)

Dig returns a list of IP addresses for a given FQDN by using the dns servers from edgeDNSServers dns servers are tried one by one from the edgeDNSServers and if there is a non-error response it is returned and the rest is not tried

func Exchange

func Exchange(m *dns.Msg, edgeDNSServers []DNSServer) (msg *dns.Msg, err error)

func GetType

func GetType(v interface{}) string

func MergeAnnotations

func MergeAnnotations(target map[string]string, source map[string]string) map[string]string

MergeAnnotations adds or updates annotations from source to target and returns merge

func SplitAfter

func SplitAfter(s string, re *regexp.Regexp) (r []string)

SplitAfter works as the same way as strings.SplitAfter() but the separator is regexp

func YamlToGslb

func YamlToGslb(yaml []byte) (*k8gbv1beta1.Gslb, error)

YamlToGslb takes yaml and returns Gslb object

Types

type DNSList

type DNSList []DNSServer

func (DNSList) String

func (l DNSList) String() string

type DNSMock

type DNSMock struct {
	// contains filtered or unexported fields
}

DNSMock acts as DNS server but returns mock values

func NewFakeDNS

func NewFakeDNS(settings FakeDNSSettings) *DNSMock

func (*DNSMock) AddAAAARecord

func (m *DNSMock) AddAAAARecord(ip net.IP) *DNSMock

func (*DNSMock) AddARecord

func (m *DNSMock) AddARecord(fqdn string, ip net.IP) *DNSMock

func (*DNSMock) AddNSRecord

func (m *DNSMock) AddNSRecord(fqdn, nsName string) *DNSMock

func (*DNSMock) AddTXTRecord

func (m *DNSMock) AddTXTRecord(fqdn string, strings ...string) *DNSMock

func (*DNSMock) RunTestFunc

func (m *DNSMock) RunTestFunc(f func()) *Result

func (*DNSMock) Start

func (m *DNSMock) Start() *DNSMock

type DNSServer

type DNSServer struct {
	Host string
	Port int
}

func (DNSServer) String

func (s DNSServer) String() string

type FakeDNSSettings

type FakeDNSSettings struct {
	FakeDNSPort     int
	EdgeDNSZoneFQDN string
	DNSZoneFQDN     string
}

type ReconcileResultHandler

type ReconcileResultHandler struct {
	// contains filtered or unexported fields
}

func NewReconcileResultHandler

func NewReconcileResultHandler(reconcileAfter int) *ReconcileResultHandler

func (*ReconcileResultHandler) Requeue

func (r *ReconcileResultHandler) Requeue() (ctrl.Result, error)

Requeue requeue loop after config.ReconcileRequeueSeconds this apply in case you didn't modify request resources. If so, reconciliation starts immediately see: https://github.com/operator-framework/operator-sdk/issues/1164

func (*ReconcileResultHandler) RequeueError

func (r *ReconcileResultHandler) RequeueError(err error) (ctrl.Result, error)

RequeueError requeue loop immediately see default controller limiter: https://danielmangum.com/posts/controller-runtime-client-go-rate-limiting/

func (*ReconcileResultHandler) RequeueNow

func (r *ReconcileResultHandler) RequeueNow() (ctrl.Result, error)

func (*ReconcileResultHandler) Stop

func (r *ReconcileResultHandler) Stop() (ctrl.Result, error)

Stop stops reconciliation loop

type Result

type Result struct {
	Error error
}

func (*Result) RequireNoError

func (r *Result) RequireNoError(t *testing.T)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL