featureflag

package
v1.19.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 4 Imported by: 320

Documentation

Overview

Package featureflag implements simple feature-flagging. Feature flags can become an anti-pattern if abused. We should try to use them for two use-cases:

  • `Preview` feature flags enable a piece of functionality we haven't yet fully baked. The user needs to 'opt-in'. We expect these flags to be removed at some time. Normally these will default to false.
  • Escape-hatch feature flags turn off a default that we consider risky (e.g. pre-creating DNS records). This lets us ship a behaviour, and if we encounter unusual circumstances in the field, we can allow the user to turn the behaviour off. Normally these will default to true.

Index

Constants

View Source
const (
	// Name is the name of the environment variable which encapsulates feature flags
	Name = "KOPS_FEATURE_FLAGS"
)

Variables

View Source
var (
	// CacheNodeidentityInfo enables NodeidentityInfo caching
	// in order to reduce the number of EC2 DescribeInstance calls.
	CacheNodeidentityInfo = New("CacheNodeidentityInfo", Bool(false))
	// DNSPreCreate controls whether we pre-create DNS records.
	DNSPreCreate = New("DNSPreCreate", Bool(true))
	// EnableLaunchTemplates indicates we wish to switch to using launch templates rather than launchconfigurations
	EnableLaunchTemplates = New("EnableLaunchTemplates", Bool(true))
	//EnableExternalCloudController toggles the use of cloud-controller-manager introduced in v1.7
	EnableExternalCloudController = New("EnableExternalCloudController", Bool(false))
	// EnableExternalDNS enables external DNS
	EnableExternalDNS = New("EnableExternalDNS", Bool(false))
	// EnableNodeAuthorization enables the node authorization features
	EnableNodeAuthorization = New("EnableNodeAuthorization", Bool(false))
	// EnableSeparateConfigBase allows a config-base that is different from the state store
	EnableSeparateConfigBase = New("EnableSeparateConfigBase", Bool(false))
	// ExperimentalClusterDNS allows for setting the kubelet dns flag to experimental values.
	ExperimentalClusterDNS = New("ExperimentalClusterDNS", Bool(false))
	// GoogleCloudBucketACL means the ACL will be set on a bucket when using GCS
	GoogleCloudBucketACL = New("GoogleCloudBucketAcl", Bool(false))
	// KeepLaunchConfigurations can be set to prevent garbage collection of old launch configurations
	KeepLaunchConfigurations = New("KeepLaunchConfigurations", Bool(false))
	// SkipTerraformFormat if set means we will not `tf fmt` the generated terraform.
	// However we should no longer need it, with the keyset.yaml fix
	// In particular, this is the only (?) way to grant the bucket.list permission
	// It allows for experiments with alternative DNS configurations - in particular local proxies.
	SkipTerraformFormat = New("SkipTerraformFormat", Bool(false))
	// SpecOverrideFlag allows setting spec values on create
	SpecOverrideFlag = New("SpecOverrideFlag", Bool(false))
	// Spotinst toggles the use of Spotinst integration.
	Spotinst = New("Spotinst", Bool(false))
	// SpotinstOcean toggles the use of Spotinst Ocean instance group implementation.
	SpotinstOcean = New("SpotinstOcean", Bool(false))
	// SpotinstHybrid toggles between hybrid and full instance group implementations.
	SpotinstHybrid = New("SpotinstHybrid", Bool(false))
	// SpotinstController toggles the installation of the Spotinst controller addon.
	SpotinstController = New("SpotinstController", Bool(true))
	// VFSVaultSupport enables setting Vault as secret/keystore
	VFSVaultSupport = New("VFSVaultSupport", Bool(false))
	// VPCSkipEnableDNSSupport if set will make that a VPC does not need DNSSupport enabled.
	VPCSkipEnableDNSSupport = New("VPCSkipEnableDNSSupport", Bool(false))
	// SkipEtcdVersionCheck will bypass the check that etcd-manager is using a supported etcd version
	SkipEtcdVersionCheck = New("SkipEtcdVersionCheck", Bool(false))
	// TerraformJSON outputs terraform in JSON instead of hcl output. JSON output can be also parsed by terraform 0.12
	TerraformJSON = New("TerraformJSON", Bool(false))
	// Terraform012 will output terraform in the 0.12 (hcl2) syntax
	Terraform012 = New("Terraform-0.12", Bool(true))
	// LegacyIAM will permit use of legacy IAM permissions.
	LegacyIAM = New("LegacyIAM", Bool(false))
	// ClusterAddons activates experimental cluster-addons support
	ClusterAddons = New("ClusterAddons", Bool(false))
	// UseServiceAccountIAM controls whether we use pod-level IAM permissions for our system pods.
	UseServiceAccountIAM = New("UseServiceAccountIAM", Bool(false))
	// PublicJWKS enables public jwks access.  This is generally not as secure as republishing.
	PublicJWKS = New("PublicJWKS", Bool(false))
)

Functions

func Bool

func Bool(b bool) *bool

Bool returns a pointer to the boolean value

func ParseFlags

func ParseFlags(f string)

ParseFlags responsible for parse out the feature flag usage

Types

type FeatureFlag

type FeatureFlag struct {
	Key string
	// contains filtered or unexported fields
}

FeatureFlag defines a feature flag

func New

func New(key string, defaultValue *bool) *FeatureFlag

New creates a new feature flag

func (*FeatureFlag) Enabled

func (f *FeatureFlag) Enabled() bool

Enabled checks if the flag is enabled

Jump to

Keyboard shortcuts

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