utils

package
v0.0.0-...-cda4096 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2021 Red Hat, Inc.

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.

Copyright 2021 Red Hat, Inc.

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.

Copyright 2021 Red Hat, Inc.

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.

Copyright 2021 Red Hat, Inc.

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorinoImage

func AuthorinoImage() (string, error)

func CheckDeploymentAvailable

func CheckDeploymentAvailable(k8sClient client.Client, key types.NamespacedName) (bool, error)

func CreateOnlyK8SObject

func CreateOnlyK8SObject(k8sClient client.Client, obj runtime.Object) error

func CreateOnlyMutator

func CreateOnlyMutator(existing, desired client.Object) (bool, error)

func CreateOrUpdateK8SObject

func CreateOrUpdateK8SObject(k8sClient client.Client, obj runtime.Object) error

func DecodeFile

func DecodeFile(fileData []byte, scheme *runtime.Scheme, cb DecodeCallback) error

func DeleteK8SObject

func DeleteK8SObject(k8sClient client.Client, obj runtime.Object) error

func IsDeploymentAvailable

func IsDeploymentAvailable(dc *appsv1.Deployment) bool

IsDeploymentAvailable returns true when the provided Deployment has the "Available" condition set to true

func IstioImage

func IstioImage() (string, error)

func KuadrantAPIBasicMutator

func KuadrantAPIBasicMutator(existingObj, desiredObj client.Object) (bool, error)

func KuadrantControllerImage

func KuadrantControllerImage() (string, error)

func LimitadorOperatorImage

func LimitadorOperatorImage() (string, error)

func ParseURL

func ParseURL(str string) (*url.URL, bool)

ParseURL returns true when valid HTTP[S] url is found

func ReadExternalResource

func ReadExternalResource(resource string) ([]byte, error)

ReadExternalResource reads data streams from external resources. Currently implemented: - '-' for STDIN - URLs (HTTP[S]) - Files

func ReadURL

func ReadURL(location *url.URL) ([]byte, error)

func ReconcileKuadrantAPI

func ReconcileKuadrantAPI(k8sClient client.Client, desired *kctlrv1beta1.API, mutatefn MutateFn) error

func ReconcileResource

func ReconcileResource(k8sClient client.Client, ctx context.Context, obj, desired client.Object, mutateFn MutateFn) error

ReconcileResource attempts to mutate the existing state in order to match the desired state. The object's desired state must be reconciled with the existing state inside the passed in callback MutateFn.

obj: Object of the same type as the 'desired' object.

Used to read the resource from the kubernetes cluster.
Could be zero-valued initialized object.

desired: Object representing the desired state

It returns an error.

func SetupScheme

func SetupScheme() error

func ValidateOAS3

func ValidateOAS3(docRaw []byte) error

Types

type DecodeCallback

type DecodeCallback = func(runtime.Object) error

type MutateFn

type MutateFn func(existing, desired client.Object) (bool, error)

MutateFn is a function which mutates the existing object into it's desired state.

Jump to

Keyboard shortcuts

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