infrastructure

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 7 Imported by: 19

Documentation

Overview

Copyright (c) 2019-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 (c) 2019-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 (c) 2019-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

View Source
const (
	WatchNamespaceEnvVar = "WATCH_NAMESPACE"
)

Variables

This section is empty.

Functions

func GetNamespace added in v0.10.0

func GetNamespace() (string, error)

GetNamespace gets the namespace of the operator by checking GetOperatorNamespace and GetWatchNamespace in that order. Returns an error if both GetOperatorNamespace and GetWatchNamespace return an error.

func GetOperatorNamespace

func GetOperatorNamespace() (string, error)

GetOperatorNamespace returns the namespace the operator should be running in.

This function was ported over from Operator SDK 0.17.0 and modified.

func GetWatchNamespace

func GetWatchNamespace() (string, error)

GetWatchNamespace returns the namespace the operator should be watching for changes

This function was ported over from Operator SDK 0.17.0

func Initialize

func Initialize() error

Initialize attempts to determine the type of cluster its currently running on (OpenShift or Kubernetes). This function *must* be called before others; otherwise the call will panic.

func InitializeForTesting

func InitializeForTesting(currentInfrastructure Type)

InitializeForTesting is used to mock running on a specific type of cluster (Kubernetes, OpenShift) in testing code.

func IsOpenShift

func IsOpenShift() bool

IsOpenShift returns true if the current cluster is an OpenShift (v4.x) cluster.

func IsWebhookConfigurationEnabled

func IsWebhookConfigurationEnabled() (bool, error)

IsWebhookConfigurationEnabled returns true if both of mutating and validating webhook configurations are enabled

Types

type Type

type Type int

Type specifies what kind of infrastructure we're operating in.

const (
	// Unsupported represents an Unsupported cluster version (e.g. OpenShift v3)
	Unsupported Type = iota
	Kubernetes
	OpenShiftv4
)

Jump to

Keyboard shortcuts

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