-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Port CNI installer from shell to golang * Capitalize acronyms in constant names * Decouple environment variables from functions * Make variable and function names more clear * Convert array to set * Fix filepath bug in tests * Wait until main CNI config file exists to intall Istio CNI as a chained CNI plugin * Add check install and cleanup; Keep container alive * Cleanup on SIGINT and SIGTERM caused by killing container * Refactor, clean up, add comments * Sort test data JSON map keys and update cniVersions * Remove unnecessary prefix characters for creating temp dirs * Fix and clean up unit tests * Extend context to createCNIConfigFile; Add unit test * Remove relative paths and clean up CNI config e2e tests * Fix lint errors * Fix kubeconfig template; Add unit tests for creating kubeconfig file * Remove install-cni.sh and dependencies; Update Dockerfile and charts * Write kubeconfig file with default 0600 permissions * Test script restart in CNI config integration test; cleanup * Add unit test for checkInstall * Add helper functions to handle json unmarshalling panic; add unit tests * Address PR comments; cleanup * Add test cases for standalone CNI plugin in integration tests * Add make target for install-cni integration test * Address PR comments; cleanup * Decouple signal handling from install process * Add Installer struct and refactor * Fix lint error * Remove absolute path to install-cni binary Co-authored-by: Jonh Wendell <jonh.wendell@redhat.com>
- Loading branch information
Showing
49 changed files
with
2,499 additions
and
594 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright Istio Authors | ||
// | ||
// 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. | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"os/signal" | ||
"syscall" | ||
|
||
"istio.io/istio/cni/pkg/install-cni/cmd" | ||
"istio.io/pkg/log" | ||
) | ||
|
||
func main() { | ||
// Create context that cancels on termination signal | ||
ctx, cancel := context.WithCancel(context.Background()) | ||
sigChan := make(chan os.Signal, 1) | ||
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) | ||
go func(sigChan chan os.Signal, cancel context.CancelFunc) { | ||
sig := <-sigChan | ||
log.Infof("Exit signal received: %s", sig) | ||
cancel() | ||
}(sigChan, cancel) | ||
|
||
rootCmd := cmd.GetCommand() | ||
if err := rootCmd.ExecuteContext(ctx); err != nil { | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.