github.com/smartcontractkit/chainlink-testing-framework/libs@v0.0.0-20240227141906-ec710b4eb1a3/k8s/pkg/helm/kafka/kafka.go (about) 1 package kafka 2 3 import ( 4 "github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/config" 5 "github.com/smartcontractkit/chainlink-testing-framework/libs/k8s/environment" 6 ) 7 8 type Props struct { 9 } 10 11 type Chart struct { 12 Name string 13 Path string 14 Version string 15 Props *Props 16 Values *map[string]interface{} 17 } 18 19 func (m Chart) IsDeploymentNeeded() bool { 20 return true 21 } 22 23 func (m Chart) GetName() string { 24 return m.Name 25 } 26 27 func (m Chart) GetPath() string { 28 return m.Path 29 } 30 31 func (m Chart) GetVersion() string { 32 return m.Version 33 } 34 35 func (m Chart) GetProps() interface{} { 36 return m.Props 37 } 38 39 func (m Chart) GetValues() *map[string]interface{} { 40 return m.Values 41 } 42 43 func (m Chart) ExportData(e *environment.Environment) error { 44 return nil 45 } 46 47 func defaultProps() map[string]interface{} { 48 return map[string]interface{}{ 49 "auth": map[string]interface{}{ 50 "clientProtocol": "plaintext", 51 "interBrokerProtocol": "plaintext", 52 }, 53 "image": map[string]interface{}{ 54 "debug": true, 55 }, 56 "provisioning": map[string]interface{}{ 57 "enabled": true, 58 "resources": map[string]interface{}{ 59 "limits": map[string]interface{}{ 60 "cpu": "0.1", 61 "memory": "500M", 62 }, 63 }, 64 }, 65 "zookeeper": map[string]interface{}{ 66 "persistence": map[string]interface{}{ 67 "enabled": true, 68 }, 69 }, 70 "podSecurityContext": map[string]interface{}{ 71 "enabled": false, 72 }, 73 "containerSecurityContext": map[string]interface{}{ 74 "enabled": false, 75 }, 76 "persistence": map[string]interface{}{ 77 "enabled": false, 78 }, 79 "livenessProbe": map[string]interface{}{ 80 "enabled": true, 81 "initialDelaySeconds": 10, 82 "timeoutSeconds": 5, 83 "failureThreshold": 3, 84 "periodSeconds": 10, 85 "successThreshold": 1, 86 }, 87 "readinessProbe": map[string]interface{}{ 88 "enabled": true, 89 "initialDelaySeconds": 5, 90 "failureThreshold": 6, 91 "timeoutSeconds": 5, 92 "periodSeconds": 10, 93 "successThreshold": 1, 94 }, 95 "startupProbe": map[string]interface{}{ 96 "enabled": true, 97 "initialDelaySeconds": 30, 98 "periodSeconds": 10, 99 "timeoutSeconds": 1, 100 "failureThreshold": 15, 101 "successThreshold": 1, 102 }, 103 "commonLabels": map[string]interface{}{ 104 "app": "kafka", 105 }, 106 "commonAnnotations": map[string]interface{}{ 107 "app": "kafka", 108 }, 109 } 110 } 111 112 func New(props map[string]interface{}) environment.ConnectedChart { 113 return NewVersioned("", props) 114 } 115 116 // NewVersioned enables choosing a specific helm chart version 117 func NewVersioned(helmVersion string, props map[string]interface{}) environment.ConnectedChart { 118 dp := defaultProps() 119 config.MustMerge(&dp, props) 120 return Chart{ 121 Name: "kafka", 122 Path: "bitnami/kafka", 123 Values: &dp, 124 Version: helmVersion, 125 } 126 }