controllers

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_DEPLOYMENT_PREFIX = "tangdeployment-"
	DEFAULT_REPLICA_AMOUNT    = 1
	DEFAULT_DEPLOYMENT_TYPE   = "Deployment"
)

Constants to use

View Source
const (
	DEFAULT_SERVICE_PORT   = 7500
	DEFAULT_SERVICE_TYPE   = "Service"
	DEFAULT_API_VERSION    = "v1"
	DEFAULT_SERVICE_PREFIX = "service-"
	DEFAULT_SERVICE_PROTO  = "http"
)

constants to use

View Source
const DEFAULT_APP_IMAGE = "registry.redhat.io/rhel9/tang"
View Source
const DEFAULT_APP_VERSION = "latest"
View Source
const DEFAULT_DEPLOYMENT_HEALTH_CHECK = "/usr/bin/tangd-health-check"
View Source
const DEFAULT_DEPLOYMENT_KEY_PATH = "/var/db/tang"
View Source
const DEFAULT_LIVENESS_INITIALDELAYSECONDS = 27
View Source
const DEFAULT_LIVENESS_PERIOD_SECONDS = 16
View Source
const DEFAULT_LIVENESS_TIMEOUT_SECONDS = 5
View Source
const DEFAULT_POD_RUNNING_PORT = 8080
View Source
const DEFAULT_READY_INITIALDELAYSECONDS = 5
View Source
const DEFAULT_READY_PERIOD_SECONDS = 15
View Source
const DEFAULT_READY_TIMEOUT_SECONDS = 5
View Source
const DEFAULT_RECONCILE_TIMER_NO_ACTIVE_KEYS = 5 // seconds

Default recheck of keys when no active keys exit

View Source
const DEFAULT_TANGSERVER_NAME = "tangserver"
View Source
const DEFAULT_TANGSERVER_PVC_NAME = "tangserver-pvc"
View Source
const DEFAULT_TANGSERVER_SECRET = "tangserversecret"
View Source
const DEFAULT_TANG_FINALIZER = "finalizer.daemons.tangserver.redhat.com"

Finalizer for tang server

View Source
const KEY_STATUS_FILE_NAME = "key_status.txt"

Variables

View Source
var FORBIDDEN_PATH_MAP = map[string]string{
	".":          "FORBIDDEN",
	"..":         "FORBIDDEN",
	"lost+found": "FORBIDDEN",
}

Functions

func GetClientsetFromClusterConfig

func GetClientsetFromClusterConfig(config *rest.Config) (*kubernetes.Clientset, error)

GetClientsetFromClusterConfig takes REST config and Create a clientset based on that and return that clientset

func GetClusterClientConfig

func GetClusterClientConfig() (*rest.Config, error)

GetClusterClientConfig first tries to get a config object which uses the service account kubernetes gives to pods, if it is called from a process running in a kubernetes environment. Otherwise, it tries to build config from a default kubeconfig filepath if it fails, it fallback to the default config. Once it get the config, it returns the same.

func GetClusterClientset

func GetClusterClientset() (*kubernetes.Clientset, error)

GetClusterClientset first tries to get a config object which uses the service account kubernetes gives to pods, if it is called from a process running in a kubernetes environment. Otherwise, it tries to build config from a default kubeconfig filepath if it fails, it fallback to the default config. Once it get the config, it creates a new Clientset for the given config and returns the clientset.

func GetLogInstance added in v0.0.28

func GetLogInstance() logr.Logger

func GetRESTClient

func GetRESTClient() (*rest.RESTClient, error)

GetRESTClient first tries to get a config object which uses the service account kubernetes gives to pods, if it is called from a process running in a kubernetes environment. Otherwise, it tries to build config from a default kubeconfig filepath if it fails, it fallback to the default config. Once it get the config, it

func SetLogInstance added in v0.0.28

func SetLogInstance(l logr.Logger)

Types

type FileModType

type FileModType uint8
const (
	UNKNOWN_MOD FileModType = iota
	CREATION
	MODIFICATION
)

type KeyAdvertisingType

type KeyAdvertisingType uint8
const (
	UNKNOWN_ADVERTISED KeyAdvertisingType = iota
	ALL_KEYS
	ONLY_ADVERTISED
	ONLY_UNADVERTISED
)

type KeyAssociation added in v0.0.23

type KeyAssociation struct {
	Sha1          string `json:"-"`
	Sha256        string `json:"-"`
	SigningKey    string `json:"signing"`
	EncriptionKey string `json:"encryption"`
}

type KeyAssociationInfo added in v0.0.23

type KeyAssociationInfo struct {
	KeyInfo  *KeyObtainInfo
	KeyAssoc KeyAssociation
}

type KeyAssociationMap added in v0.0.23

type KeyAssociationMap struct {
	KeyStatusSha1Map   KeyAssociationSha1Map   `json:"sha1"`
	KeyStatusSha256Map KeyAssociationSha256Map `json:"sha256"`
}

type KeyAssociationSha1Map added in v0.0.23

type KeyAssociationSha1Map map[string]KeyAssociation

type KeyAssociationSha256Map added in v0.0.23

type KeyAssociationSha256Map map[string]KeyAssociation

type KeyAssociationShaMap added in v0.0.23

type KeyAssociationShaMap map[string]KeyAssociation

type KeyObtainInfo

type KeyObtainInfo struct {
	PodName    string
	Namespace  string
	DbPath     string
	TangServer *daemonsv1alpha1.TangServer
}

type KeyRotateInfo

type KeyRotateInfo struct {
	KeyInfo     *KeyObtainInfo
	KeyFileName string
}

type KeySelectiveMap added in v0.0.23

type KeySelectiveMap map[string]string

type SHAType

type SHAType uint8
const (
	UNKNOWN_SHA SHAType = iota
	SHA256
	SHA1
)

type TangServerReconciler

type TangServerReconciler struct {
	client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
}

TangServerReconciler reconciles a TangServer object

func (*TangServerReconciler) CreateNewKeysIfNecessary

func (r *TangServerReconciler) CreateNewKeysIfNecessary(k KeyObtainInfo) bool

CreateNewKeysIfNecessary creates new keys if spec mandates so

func (*TangServerReconciler) Reconcile

func (r *TangServerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the TangServer object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.8.3/pkg/reconcile +kubebuilder:rbac:groups=apps.redhat,resources=tangservers,verbs=get;list;watch;create;update;patch;delete +kubebuilder:rbac:groups=apps.redhat,resources=tangservers/status,verbs=get;update;patch

func (*TangServerReconciler) SetupWithManager

func (r *TangServerReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

func (*TangServerReconciler) UpdateKeys

func (r *TangServerReconciler) UpdateKeys(k KeyObtainInfo)

UpdateKeys updates keys in the CR status

Jump to

Keyboard shortcuts

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